diff options
424 files changed, 2258 insertions, 681 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3c1c9cc..032a6fc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -105,6 +105,7 @@ l:iwyu-debian12: - .debian12_iwyu - .cmake_build_linux - .linux_x86_64_tags + - .cmake_cdash_artifacts - .run_automatically l:tidy-fedora38: @@ -112,6 +113,7 @@ l:tidy-fedora38: - .fedora38_tidy - .cmake_build_linux - .linux_x86_64_tags + - .cmake_cdash_artifacts - .run_automatically l:sphinx-fedora38: diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml index d9943b8..f4d413b 100644 --- a/.gitlab/artifacts.yml +++ b/.gitlab/artifacts.yml @@ -62,6 +62,10 @@ - ${CMAKE_CI_BUILD_DIR}/Testing/ - ${CMAKE_CI_BUILD_DIR}/DartConfiguation.tcl - ${CMAKE_CI_BUILD_DIR}/CTestCustom.cmake + - ${CMAKE_CI_BUILD_DIR}/cdash-build-id + reports: + annotations: + - ${CMAKE_CI_BUILD_DIR}/annotations.json .cmake_release_artifacts: artifacts: @@ -82,12 +86,26 @@ - ${CMAKE_CI_BUILD_DIR}/cmake-*.zip # Any unsigned packages made. - ${CMAKE_CI_BUILD_DIR}/unsigned/cmake-* + - ${CMAKE_CI_BUILD_DIR}/cdash-build-id + reports: + annotations: + - ${CMAKE_CI_BUILD_DIR}/annotations.json + +.cmake_cdash_artifacts: + artifacts: + expire_in: 1d + when: always + reports: + annotations: + - ${CMAKE_CI_BUILD_DIR}/annotations.json .cmake_junit_artifacts: artifacts: expire_in: 1d when: always reports: + annotations: + - ${CMAKE_CI_BUILD_DIR}/annotations.json junit: - ${CMAKE_CI_BUILD_DIR}/junit.xml @@ -95,6 +113,9 @@ artifacts: expire_in: 1d when: always + reports: + annotations: + - ${CMAKE_CI_BUILD_DIR}/annotations.json paths: # Take the sphinx logs. - ${CMAKE_CI_BUILD_DIR}/build-*.log @@ -108,6 +129,8 @@ reports: junit: - ${CMAKE_CI_BUILD_DIR}/junit.xml + annotations: + - ${CMAKE_CI_BUILD_DIR}/annotations.json paths: # Take the install tree. - ${CMAKE_CI_BUILD_DIR}/install/ @@ -115,6 +138,9 @@ .cmake_doc_artifacts: artifacts: expire_in: 1d + reports: + annotations: + - ${CMAKE_CI_BUILD_DIR}/annotations.json paths: # Take the install tree. - ${CMAKE_CI_BUILD_DIR}/install-doc/ diff --git a/.gitlab/ci/ctest_annotation.cmake b/.gitlab/ci/ctest_annotation.cmake new file mode 100644 index 0000000..a219753 --- /dev/null +++ b/.gitlab/ci/ctest_annotation.cmake @@ -0,0 +1,32 @@ +function (ctest_annotation_report file) + set(label "") + + if (EXISTS "${file}") + file(READ "${file}" json) + else () + set(json "{\"CDash\": []}") + endif () + + foreach (arg IN LISTS ARGN) + if (NOT label) + set(label "${arg}") + continue () + endif () + + set(item "{\"external_link\":{\"label\":\"${label}\",\"url\":\"${arg}\"}}") + set(label "") + + string(JSON length LENGTH "${json}" "CDash") + string(JSON json SET "${json}" "CDash" "${length}" "${item}") + endforeach () + + file(WRITE "${file}" "${json}") +endfunction () + +if (NOT DEFINED build_id) + include("${CTEST_BINARY_DIRECTORY}/cdash-build-id" OPTIONAL) +endif () +function (store_build_id build_id) + file(WRITE "${CTEST_BINARY_DIRECTORY}/cdash-build-id" + "set(build_id \"${build_id}\")\n") +endfunction () diff --git a/.gitlab/ci/ctest_build.cmake b/.gitlab/ci/ctest_build.cmake index e874a62..b1b9830 100644 --- a/.gitlab/ci/ctest_build.cmake +++ b/.gitlab/ci/ctest_build.cmake @@ -45,11 +45,17 @@ if (iwyu_source_name AND "$ENV{CMAKE_CONFIGURATION}" MATCHES "iwyu") endif () ctest_build( + NUMBER_ERRORS num_errors NUMBER_WARNINGS num_warnings RETURN_VALUE build_result ${ctest_build_args}) ctest_submit(PARTS Build) +include("${CMAKE_CURRENT_LIST_DIR}/ctest_annotation.cmake") +ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json" + "Build Errors (${num_errors})" "https://open.cdash.org/viewBuildError.php?buildid=${build_id}" + "Build Warnings (${num_warnings})" "https://open.cdash.org/viewBuildError.php?type=1&buildid=${build_id}") + if (build_result) message(FATAL_ERROR "Failed to build") diff --git a/.gitlab/ci/ctest_configure.cmake b/.gitlab/ci/ctest_configure.cmake index 2682055..04285fd 100644 --- a/.gitlab/ci/ctest_configure.cmake +++ b/.gitlab/ci/ctest_configure.cmake @@ -22,10 +22,18 @@ ctest_configure( # Read the files from the build directory. ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}") -# We can now submit because we've configured. This is a cmb-superbuild-ism. -ctest_submit(PARTS Update) +# We can now submit because we've configured. +ctest_submit(PARTS Update + BUILD_ID build_id) ctest_submit(PARTS Configure) +include("${CMAKE_CURRENT_LIST_DIR}/ctest_annotation.cmake") +ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json" + "Build Summary" "https://open.cdash.org/build/${build_id}" + "Update" "https://open.cdash.org/build/${build_id}/update" + "Configure" "https://open.cdash.org/build/${build_id}/configure") +store_build_id("${build_id}") + if (configure_result) message(FATAL_ERROR "Failed to configure") diff --git a/.gitlab/ci/ctest_memcheck.cmake b/.gitlab/ci/ctest_memcheck.cmake index dac907c..c650681 100644 --- a/.gitlab/ci/ctest_memcheck.cmake +++ b/.gitlab/ci/ctest_memcheck.cmake @@ -34,6 +34,15 @@ ctest_memcheck( ctest_submit(PARTS Test) ctest_submit(PARTS Memcheck) +include("${CMAKE_CURRENT_LIST_DIR}/ctest_annotation.cmake") +ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json" + "Build Summary" "https://open.cdash.org/build/${build_id}" + "All Tests" "https://open.cdash.org/viewTest.php?buildid=${build_id}" + "Dynamic Analysis" "https://open.cdash.org/viewDynamicAnalysis.php?buildid=${build_id}" + "Test Failures" "https://open.cdash.org/viewTest.php?onlyfailed&buildid=${build_id}" + "Tests Not Run" "https://open.cdash.org/viewTest.php?onlynotrun&buildid=${build_id}" + "Test Passes" "https://open.cdash.org/viewTest.php?onlypassed&buildid=${build_id}") + if (test_result) message(FATAL_ERROR "Failed to test") diff --git a/.gitlab/ci/ctest_standalone.cmake b/.gitlab/ci/ctest_standalone.cmake index 36ba71c..2e67793 100644 --- a/.gitlab/ci/ctest_standalone.cmake +++ b/.gitlab/ci/ctest_standalone.cmake @@ -38,9 +38,16 @@ ctest_configure( ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}") # We can now submit because we've configured. This is a cmb-superbuild-ism. -ctest_submit(PARTS Update) +ctest_submit(PARTS Update + BUILD_ID build_id) ctest_submit(PARTS Configure) +include("${CMAKE_CURRENT_LIST_DIR}/ctest_annotation.cmake") +ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json" + "Build Summary" "https://open.cdash.org/build/${build_id}" + "Update" "https://open.cdash.org/build/${build_id}/update" + "Configure" "https://open.cdash.org/build/${build_id}/configure") + if (configure_result) ctest_submit(PARTS Done) message(FATAL_ERROR @@ -54,10 +61,15 @@ elseif (CTEST_CMAKE_GENERATOR MATCHES "Ninja") endif () ctest_build( + NUMBER_ERRORS num_errors NUMBER_WARNINGS num_warnings RETURN_VALUE build_result) ctest_submit(PARTS Build) +ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json" + "Build Errors (${num_errors})" "https://open.cdash.org/viewBuildError.php?buildid=${build_id}" + "Build Warnings (${num_warnings})" "https://open.cdash.org/viewBuildError.php?type=1&buildid=${build_id}") + if (build_result) ctest_submit(PARTS Done) message(FATAL_ERROR @@ -86,6 +98,12 @@ ctest_test( EXCLUDE "${test_exclusions}") ctest_submit(PARTS Test) +ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json" + "All Tests" "https://open.cdash.org/viewTest.php?buildid=${build_id}" + "Test Failures" "https://open.cdash.org/viewTest.php?onlyfailed&buildid=${build_id}" + "Tests Not Run" "https://open.cdash.org/viewTest.php?onlynotrun&buildid=${build_id}" + "Test Passes" "https://open.cdash.org/viewTest.php?onlypassed&buildid=${build_id}") + if (test_result) ctest_submit(PARTS Done) message(FATAL_ERROR diff --git a/.gitlab/ci/ctest_test.cmake b/.gitlab/ci/ctest_test.cmake index b02d032..c155ab3 100644 --- a/.gitlab/ci/ctest_test.cmake +++ b/.gitlab/ci/ctest_test.cmake @@ -25,6 +25,14 @@ ctest_test( EXCLUDE "${test_exclusions}") ctest_submit(PARTS Test) +include("${CMAKE_CURRENT_LIST_DIR}/ctest_annotation.cmake") +ctest_annotation_report("${CTEST_BINARY_DIRECTORY}/annotations.json" + "Build Summary" "https://open.cdash.org/build/${build_id}" + "All Tests" "https://open.cdash.org/viewTest.php?buildid=${build_id}" + "Test Failures" "https://open.cdash.org/viewTest.php?onlyfailed&buildid=${build_id}" + "Tests Not Run" "https://open.cdash.org/viewTest.php?onlynotrun&buildid=${build_id}" + "Test Passes" "https://open.cdash.org/viewTest.php?onlypassed&buildid=${build_id}") + if (test_result) message(FATAL_ERROR "Failed to test") diff --git a/Help/command/if.rst b/Help/command/if.rst index 5d85a1f..1afbe04 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -178,6 +178,47 @@ File Operations False if the given path is an empty string. + .. warning:: + To check the readability of a file, use preferably ``if(IS_READABLE)`` + because this test will evolve to check file existence only in a future + release. + +.. signature:: if(IS_READABLE <path-to-file-or-directory>) + + .. versionadded:: 3.29 + + True if the named file or directory is readable. Behavior + is well-defined only for explicit full paths (a leading ``~/`` is not + expanded as a home directory and is considered a relative path). + Resolves symbolic links, i.e. if the named file or directory is a + symbolic link, returns true if the target of the symbolic link is readable. + + False if the given path is an empty string. + +.. signature:: if(IS_WRITABLE <path-to-file-or-directory>) + + .. versionadded:: 3.29 + + True if the named file or directory is writable. Behavior + is well-defined only for explicit full paths (a leading ``~/`` is not + expanded as a home directory and is considered a relative path). + Resolves symbolic links, i.e. if the named file or directory is a + symbolic link, returns true if the target of the symbolic link is writable. + + False if the given path is an empty string. + +.. signature:: if(IS_EXECUTABLE <path-to-file-or-directory>) + + .. versionadded:: 3.29 + + True if the named file or directory is executable. Behavior + is well-defined only for explicit full paths (a leading ``~/`` is not + expanded as a home directory and is considered a relative path). + Resolves symbolic links, i.e. if the named file or directory is a + symbolic link, returns true if the target of the symbolic link is executable. + + False if the given path is an empty string. + .. signature:: if(<file1> IS_NEWER_THAN <file2>) :target: IS_NEWER_THAN diff --git a/Help/manual/cmake-cxxmodules.7.rst b/Help/manual/cmake-cxxmodules.7.rst index 99915e3..b4c9cf1 100644 --- a/Help/manual/cmake-cxxmodules.7.rst +++ b/Help/manual/cmake-cxxmodules.7.rst @@ -27,7 +27,8 @@ following queries. The first query that provides a yes/no answer is used. - If the :prop_tgt:`CXX_SCAN_FOR_MODULES` target property is set, its value will be used. Set the :variable:`CMAKE_CXX_SCAN_FOR_MODULES` variable to initialize this property on all targets as they are created. -- Otherwise, the source file will be scanned. See policy :policy:`CMP0155`. +- Otherwise, the source file will be scanned if the compiler and generator + support scanning. See policy :policy:`CMP0155`. Compiler Support ================ diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 047dfd1..46707ff 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,7 +57,7 @@ Policies Introduced by CMake 3.28 .. toctree:: :maxdepth: 1 - CMP0155: C++ sources in targets with at least C++20 are scanned for imports. </policy/CMP0155> + CMP0155: C++ sources in targets with at least C++20 are scanned for imports when supported. </policy/CMP0155> CMP0154: Generated files are private by default in targets using file sets. </policy/CMP0154> CMP0153: The exec_program command should not be called. </policy/CMP0153> CMP0152: file(REAL_PATH) resolves symlinks before collapsing ../ components. </policy/CMP0152> diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 9320ffa..bf6fc0a 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -74,6 +74,10 @@ Variables that Provide Information /variable/CMAKE_JOB_POOLS /variable/CMAKE_LANG_COMPILER_AR /variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT + /variable/CMAKE_LANG_COMPILER_LINKER + /variable/CMAKE_LANG_COMPILER_LINKER_FRONTEND_VARIANT + /variable/CMAKE_LANG_COMPILER_LINKER_ID + /variable/CMAKE_LANG_COMPILER_LINKER_VERSION /variable/CMAKE_LANG_COMPILER_RANLIB /variable/CMAKE_LANG_LINK_LIBRARY_SUFFIX /variable/CMAKE_LINK_LIBRARY_SUFFIX diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 5223acb..621c005 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -891,6 +891,10 @@ Available commands are: ``-`` will result in an error. Use ``--`` to indicate the end of options, in case a file starts with ``-``. + .. versionadded:: 3.29 + + ``cat`` can now print the standard input by passing the ``-`` argument. + .. program:: cmake-E .. option:: chdir <dir> <cmd> [<arg>...] @@ -1311,6 +1315,7 @@ The following ``cmake -E`` commands are available only on Windows: Write Windows registry value. +.. _`Find-Package Tool Mode`: Run the Find-Package Tool ========================= diff --git a/Help/policy/CMP0155.rst b/Help/policy/CMP0155.rst index 2dafadf..8b741cb 100644 --- a/Help/policy/CMP0155.rst +++ b/Help/policy/CMP0155.rst @@ -3,7 +3,8 @@ CMP0155 .. versionadded:: 3.28 -C++ sources in targets with at least C++20 are scanned for imports. +C++ sources in targets with at least C++20 are scanned for imports +when supported. CMake 3.27 and below assume that C++ sources do not ``import`` modules. CMake 3.28 and above prefer to assume that C++ sources in targets using C++20 @@ -16,7 +17,8 @@ support. The ``OLD`` behavior for this policy is to assume that C++ 20 and newer sources do not import modules. The ``NEW`` behavior for this policy is to -assume that C++ 20 and newer files may import modules, and need to be scanned. +assume that C++ 20 and newer files may import modules if the compiler +understands how to scan for their dependencies, and need to be scanned. This policy was introduced in CMake version 3.28. Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. diff --git a/Help/prop_tgt/IMPORTED_LOCATION.rst b/Help/prop_tgt/IMPORTED_LOCATION.rst index 915085b..b7bb748 100644 --- a/Help/prop_tgt/IMPORTED_LOCATION.rst +++ b/Help/prop_tgt/IMPORTED_LOCATION.rst @@ -36,7 +36,7 @@ listed in the :prop_tgt:`IMPORTED_CONFIGURATIONS` target property may be selected and its :prop_tgt:`IMPORTED_LOCATION_<CONFIG>` value used. To get the location of an imported target read one of the :prop_tgt:`LOCATION` -or ``LOCATION_<CONFIG>`` properties. +or :prop_tgt:`LOCATION_<CONFIG>` properties. For platforms with import libraries (e.g. Windows, AIX or macOS) see also :prop_tgt:`IMPORTED_IMPLIB`. diff --git a/Help/prop_tgt/UNITY_BUILD.rst b/Help/prop_tgt/UNITY_BUILD.rst index f827a20..52f4714 100644 --- a/Help/prop_tgt/UNITY_BUILD.rst +++ b/Help/prop_tgt/UNITY_BUILD.rst @@ -30,11 +30,23 @@ values: If no explicit :prop_tgt:`UNITY_BUILD_MODE` has been specified, CMake will default to ``BATCH``. -Unity builds are not currently supported for all languages. CMake version -|release| supports combining ``C`` and ``CXX`` source files. For targets that -mix source files from more than one language, CMake will separate the languages -such that each generated unity source file only contains sources for a single -language. +Unity builds are supported for the following languages: + +``C`` + .. versionadded:: 3.16 + +``CXX`` + .. versionadded:: 3.16 + +``OBJC`` + .. versionadded:: 3.29 + +``OBJCXX`` + .. versionadded:: 3.29 + +For targets that mix source files from more than one language, CMake +separates the languages such that each generated unity source file only +contains sources for a single language. This property is initialized by the value of the :variable:`CMAKE_UNITY_BUILD` variable when a target is created. diff --git a/Help/release/dev/cmake-E-cat-stdin.rst b/Help/release/dev/cmake-E-cat-stdin.rst new file mode 100644 index 0000000..43a8aed --- /dev/null +++ b/Help/release/dev/cmake-E-cat-stdin.rst @@ -0,0 +1,5 @@ +cmake-E-cat-stdin +----------------- + +* :manual:`cmake(1)` :option:`-E cat <cmake-E cat>` can now print the standard + input by passing the ``-`` argument. diff --git a/Help/release/dev/compiler-linker.rst b/Help/release/dev/compiler-linker.rst new file mode 100644 index 0000000..4783656 --- /dev/null +++ b/Help/release/dev/compiler-linker.rst @@ -0,0 +1,8 @@ +compiler-linker +--------------- + +* The linker effectively used for the link step is now documented with the + :variable:`CMAKE_<LANG>_COMPILER_LINKER`, + :variable:`CMAKE_<LANG>_COMPILER_LINKER_ID`, + :variable:`CMAKE_<LANG>_COMPILER_LINKER_VERSION` and + :variable:`CMAKE_<LANG>_COMPILER_LINKER_FRONTEND_VARIANT` variables. diff --git a/Help/release/dev/if-check-file-permissions.rst b/Help/release/dev/if-check-file-permissions.rst new file mode 100644 index 0000000..ec69b00 --- /dev/null +++ b/Help/release/dev/if-check-file-permissions.rst @@ -0,0 +1,5 @@ +if-check-file-permissions +------------------------- + +* The :command:`if` command gained new tests ``IS_READABLE``, ``IS_WRITABLE`` + and ``IS_EXECUTABLE`` to check file or directory permissions. diff --git a/Help/release/dev/unity-build-objc.rst b/Help/release/dev/unity-build-objc.rst new file mode 100644 index 0000000..ce6460b --- /dev/null +++ b/Help/release/dev/unity-build-objc.rst @@ -0,0 +1,5 @@ +unity-build-objc +---------------- + +* The :prop_tgt:`UNITY_BUILD` target property now supports the + Objective C (``OBJC``) and Objective C++ (``OBJCXX``) languages. diff --git a/Help/variable/CMAKE_LANG_COMPILER_LINKER.rst b/Help/variable/CMAKE_LANG_COMPILER_LINKER.rst new file mode 100644 index 0000000..c0ae1cd --- /dev/null +++ b/Help/variable/CMAKE_LANG_COMPILER_LINKER.rst @@ -0,0 +1,15 @@ +CMAKE_<LANG>_COMPILER_LINKER +---------------------------- + +.. versionadded:: 3.29 + +The full path to the linker for ``LANG``. + +This is the command that will be used as the ``<LANG>`` linker. + +This variable is not guaranteed to be defined for all linkers or languages. + +.. note:: + This variable is read-only. It must not be set by the user. To select a + specific linker, use the :variable:`CMAKE_LINKER_TYPE` variable or the + :prop_tgt:`LINKER_TYPE` target property. diff --git a/Help/variable/CMAKE_LANG_COMPILER_LINKER_FRONTEND_VARIANT.rst b/Help/variable/CMAKE_LANG_COMPILER_LINKER_FRONTEND_VARIANT.rst new file mode 100644 index 0000000..d7d028a --- /dev/null +++ b/Help/variable/CMAKE_LANG_COMPILER_LINKER_FRONTEND_VARIANT.rst @@ -0,0 +1,21 @@ +CMAKE_<LANG>_COMPILER_LINKER_FRONTEND_VARIANT +--------------------------------------------- + +.. versionadded:: 3.29 + +Identification string of the linker frontend variant. + +Some linkers have multiple, different frontends for accepting command +line options. (For example ``LLCM LLD`` originally only had a frontend +compatible with the ``GNU`` compiler but since its port to Windows +(``lld-link``) it now also supports a frontend compatible with ``MSVC``.) +When CMake detects such a linker it sets this variable to what would have been +the :variable:`CMAKE_<LANG>_COMPILER_LINKER_ID` for the linker whose frontend +it resembles. + +.. note:: + In other words, this variable describes what command line options + and language extensions the linker frontend expects. + + This variable is set for ``GNU``, ``MSVC``, ``MOLD`` and ``AppleClang`` + linkers that have only one frontend variant. diff --git a/Help/variable/CMAKE_LANG_COMPILER_LINKER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_LINKER_ID.rst new file mode 100644 index 0000000..560f522 --- /dev/null +++ b/Help/variable/CMAKE_LANG_COMPILER_LINKER_ID.rst @@ -0,0 +1,31 @@ +CMAKE_<LANG>_COMPILER_LINKER_ID +------------------------------- + +.. versionadded:: 3.29 + +Linker identification string. + +A short string unique to the linker vendor. Possible values +include: + +=============================== =============================================== +Value Name +=============================== =============================================== +``AppleClang`` Apple Clang +``LLD`` `LLVM LLD`_ +``GNU`` `GNU Binutils - ld linker`_ (also known as + ``bfd``) +``GNUgold`` `GNU Binutils - gold linker`_ +``MSVC`` `Microsoft Visual Studio`_ +``MOLD`` `mold: A Modern Linker`_ or, on Apple, `sold`_ + linker +=============================== =============================================== + +This variable is not guaranteed to be defined for all linkers or languages. + +.. _LLVM LLD: https://lld.llvm.org +.. _GNU Binutils - ld linker: https://sourceware.org/binutils +.. _GNU Binutils - gold linker: https://sourceware.org/binutils +.. _Microsoft Visual Studio: https://visualstudio.microsoft.com +.. _mold\: A Modern Linker: https://github.com/rui314/mold +.. _sold: https://github.com/bluewhalesystems/sold diff --git a/Help/variable/CMAKE_LANG_COMPILER_LINKER_VERSION.rst b/Help/variable/CMAKE_LANG_COMPILER_LINKER_VERSION.rst new file mode 100644 index 0000000..72b0551 --- /dev/null +++ b/Help/variable/CMAKE_LANG_COMPILER_LINKER_VERSION.rst @@ -0,0 +1,10 @@ +CMAKE_<LANG>_COMPILER_LINKER_VERSION +------------------------------------ + +.. versionadded:: 3.29 + +Linker version string. + +Linker version in major[.minor[.patch[.tweak]]] format. This +variable is not guaranteed to be defined for all linkers or +languages. diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in index fab366a..c7dbfae 100644 --- a/Modules/CMakeASMCompiler.cmake.in +++ b/Modules/CMakeASMCompiler.cmake.in @@ -7,6 +7,10 @@ set(CMAKE_ASM@ASM_DIALECT@_COMPILER_RANLIB "@_CMAKE_ASM_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@") set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@") +set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER "@CMAKE_ASM_COMPILER_LINKER@") +set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_ID "@CMAKE_ASM_COMPILER_LINKER_ID@") +set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_VERSION @CMAKE_ASM_COMPILER_LINKER_VERSION@) +set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_ASM_COMPILER_LINKER_FRONTEND_VARIANT@) set(CMAKE_MT "@CMAKE_MT@") set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1) diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 01185a3..df2a060 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -28,6 +28,10 @@ set(CMAKE_C_COMPILER_RANLIB "@CMAKE_C_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@") set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@") +set(CMAKE_C_COMPILER_LINKER "@CMAKE_C_COMPILER_LINKER@") +set(CMAKE_C_COMPILER_LINKER_ID "@CMAKE_C_COMPILER_LINKER_ID@") +set(CMAKE_C_COMPILER_LINKER_VERSION @CMAKE_C_COMPILER_LINKER_VERSION@) +set(CMAKE_C_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_C_COMPILER_LINKER_FRONTEND_VARIANT@) set(CMAKE_MT "@CMAKE_MT@") set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@) diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in index 3bc21fb..ef0255c 100644 --- a/Modules/CMakeCUDACompiler.cmake.in +++ b/Modules/CMakeCUDACompiler.cmake.in @@ -74,5 +74,9 @@ set(CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_FR set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@") set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@") +set(CMAKE_CUDA_COMPILER_LINKER "@CMAKE_CUDA_COMPILER_LINKER@") +set(CMAKE_CUDA_COMPILER_LINKER_ID "@CMAKE_CUDA_COMPILER_LINKER_ID@") +set(CMAKE_CUDA_COMPILER_LINKER_VERSION @CMAKE_CUDA_COMPILER_LINKER_VERSION@) +set(CMAKE_CUDA_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_CUDA_COMPILER_LINKER_FRONTEND_VARIANT@) set(CMAKE_AR "@CMAKE_AR@") set(CMAKE_MT "@CMAKE_MT@") diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index fbc1540..0957d9b 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -29,6 +29,10 @@ set(CMAKE_CXX_COMPILER_RANLIB "@CMAKE_CXX_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@") set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@") +set(CMAKE_CXX_COMPILER_LINKER "@CMAKE_CXX_COMPILER_LINKER@") +set(CMAKE_CXX_COMPILER_LINKER_ID "@CMAKE_CXX_COMPILER_LINKER_ID@") +set(CMAKE_CXX_COMPILER_LINKER_VERSION @CMAKE_CXX_COMPILER_LINKER_VERSION@) +set(CMAKE_CXX_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_CXX_COMPILER_LINKER_FRONTEND_VARIANT@) set(CMAKE_MT "@CMAKE_MT@") set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@) diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 585b2aa..6ac4dad 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -164,26 +164,7 @@ if(MSVC_CUDA_ARCHITECTURE_ID) "set(MSVC_CUDA_ARCHITECTURE_ID ${MSVC_CUDA_ARCHITECTURE_ID})") endif() -if(CMAKE_GENERATOR MATCHES "Visual Studio") - set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${CMAKE_LINKER}") - set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "") - set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "") - set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") - - # We do not currently detect CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES but we - # do need to detect CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT from the compiler by - # looking at which cudart library exists in the implicit link libraries passed - # to the host linker. - if(CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT MATCHES "link\\.exe [^\n]*cudart_static\\.lib") - set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC") - elseif(CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT MATCHES "link\\.exe [^\n]*cudart\\.lib") - set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "SHARED") - else() - set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "NONE") - endif() - set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT - "set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")") -elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") +if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") string(REGEX MATCHALL "-target-cpu sm_([0-9]+)" _clang_target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}") foreach(_clang_target_cpu ${_clang_target_cpus}) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index efc18f9..012a87c 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -6,6 +6,7 @@ # This is used internally by CMake and should not be included by user # code. +include(${CMAKE_ROOT}/Modules/Internal/CMakeDetermineLinkerId.cmake) include(${CMAKE_ROOT}/Modules/CMakeParseImplicitIncludeInfo.cmake) include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) include(${CMAKE_ROOT}/Modules/CMakeParseLibraryArchitecture.cmake) @@ -19,15 +20,19 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerABI_${lang}.bin") set(CMAKE_FLAGS ) set(COMPILE_DEFINITIONS ) + set(LINK_OPTIONS ) if(DEFINED CMAKE_${lang}_VERBOSE_FLAG) - set(CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}") + set(LINK_OPTIONS "${CMAKE_${lang}_VERBOSE_FLAG}") set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_FLAG}") endif() if(DEFINED CMAKE_${lang}_VERBOSE_COMPILE_FLAG) set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_COMPILE_FLAG}") endif() + if(DEFINED CMAKE_${lang}_VERBOSE_LINK_FLAG) + list(APPEND LINK_OPTIONS "${CMAKE_${lang}_VERBOSE_LINK_FLAG}") + endif() if(lang MATCHES "^(CUDA|HIP)$") - if(CMAKE_${lang}_ARCHITECTURES STREQUAL "native") + if(CMAKE_CUDA_ARCHITECTURES STREQUAL "native") # We are about to detect the native architectures, so we do # not yet know them. Use all architectures during detection. set(CMAKE_${lang}_ARCHITECTURES "all") @@ -39,6 +44,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) # from which we might detect implicit link libraries. list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=") endif() + list(JOIN LINK_OPTIONS " " LINK_OPTIONS) + list(APPEND CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${LINK_OPTIONS}") + __TestCompiler_setTryCompileTargetType() # Avoid failing ABI detection on warnings. @@ -53,7 +61,6 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) set(ENV{LC_ALL} C) set(ENV{LC_MESSAGES} C) set(ENV{LANG} C) - try_compile(CMAKE_${lang}_ABI_COMPILED SOURCES ${src} CMAKE_FLAGS ${CMAKE_FLAGS} @@ -146,39 +153,42 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) set(implicit_libs "${CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES}") set(implicit_fwks "${CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES}") else() - # Parse implicit linker information for this language, if available. - set(implicit_dirs "") - set(implicit_objs "") - set(implicit_libs "") - set(implicit_fwks "") - if(CMAKE_${lang}_VERBOSE_FLAG) - CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs implicit_fwks log - "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}" - COMPUTE_IMPLICIT_OBJECTS implicit_objs - LANGUAGE ${lang}) - message(CONFIGURE_LOG - "Parsed ${lang} implicit link information:\n${log}\n\n") - endif() - # for VS IDE Intel Fortran we have to figure out the - # implicit link path for the fortran run time using - # a try-compile - if("${lang}" MATCHES "Fortran" - AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio") - message(CHECK_START "Determine Intel Fortran Compiler Implicit Link Path") - # Build a sample project which reports symbols. - try_compile(IFORT_LIB_PATH_COMPILED - PROJECT IntelFortranImplicit - SOURCE_DIR ${CMAKE_ROOT}/Modules/IntelVSImplicitPath - BINARY_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath - CMAKE_FLAGS - "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}" - OUTPUT_VARIABLE _output) - file(WRITE - "${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt" - "${_output}") - include(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL) - message(CHECK_PASS "done") - endif() + # Parse implicit linker information for this language, if available. + set(implicit_dirs "") + set(implicit_objs "") + set(implicit_libs "") + set(implicit_fwks "") + set(compute_artifacts COMPUTE_LINKER linker_tool) + if(CMAKE_${lang}_VERBOSE_FLAG) + list(APPEND compute_artifacts COMPUTE_IMPLICIT_LIBS implicit_libs + COMPUTE_IMPLICIT_DIRS implicit_dirs + COMPUTE_IMPLICIT_FWKS implicit_fwks + COMPUTE_IMPLICIT_OBJECTS implicit_objs) + endif() + cmake_parse_implicit_link_info2("${OUTPUT}" log "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}" + ${compute_artifacts} LANGUAGE ${lang}) + message(CONFIGURE_LOG + "Parsed ${lang} implicit link information:\n${log}\n\n") + # for VS IDE Intel Fortran we have to figure out the + # implicit link path for the fortran run time using + # a try-compile + if("${lang}" MATCHES "Fortran" + AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio") + message(CHECK_START "Determine Intel Fortran Compiler Implicit Link Path") + # Build a sample project which reports symbols. + try_compile(IFORT_LIB_PATH_COMPILED + PROJECT IntelFortranImplicit + SOURCE_DIR ${CMAKE_ROOT}/Modules/IntelVSImplicitPath + BINARY_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath + CMAKE_FLAGS + "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}" + OUTPUT_VARIABLE _output) + file(WRITE + "${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt" + "${_output}") + include(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL) + message(CHECK_PASS "done") + endif() endif() # Implicit link libraries cannot be used explicitly for multiple @@ -193,6 +203,12 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) list(REMOVE_ITEM implicit_dirs $ENV{CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}) endif() + set(CMAKE_${lang}_COMPILER_LINKER "${linker_tool}" PARENT_SCOPE) + cmake_determine_linker_id(${lang} "${linker_tool}") + set(CMAKE_${lang}_COMPILER_LINKER_ID "${CMAKE_${lang}_COMPILER_LINKER_ID}" PARENT_SCOPE) + set(CMAKE_${lang}_COMPILER_LINKER_VERSION ${CMAKE_${lang}_COMPILER_LINKER_VERSION} PARENT_SCOPE) + set(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT ${CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT} PARENT_SCOPE) + set(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE) set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE) set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE) diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index 726e2a2..a6bbcc4 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -5,10 +5,9 @@ CMakeFindPackageMode -------------------- - - -This file is executed by cmake when invoked with --find-package. It -expects that the following variables are set using -D: +This file is executed by cmake when invoked with +:ref:`--find-package <Find-Package Tool Mode>`. +It expects that the following variables are set using ``-D``: ``NAME`` name of the package diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 89a00ab..90c2ad0 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -15,6 +15,10 @@ set(CMAKE_AR "@CMAKE_AR@") set(CMAKE_Fortran_COMPILER_AR "@CMAKE_Fortran_COMPILER_AR@") set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") +set(CMAKE_Fortran_COMPILER_LINKER "@CMAKE_Fortran_COMPILER_LINKER@") +set(CMAKE_Fortran_COMPILER_LINKER_ID "@CMAKE_Fortran_COMPILER_LINKER_ID@") +set(CMAKE_Fortran_COMPILER_LINKER_VERSION @CMAKE_Fortran_COMPILER_LINKER_VERSION@) +set(CMAKE_Fortran_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_Fortran_COMPILER_LINKER_FRONTEND_VARIANT@) set(CMAKE_Fortran_COMPILER_RANLIB "@CMAKE_Fortran_COMPILER_RANLIB@") set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@) diff --git a/Modules/CMakeHIPCompiler.cmake.in b/Modules/CMakeHIPCompiler.cmake.in index 0c06c3b..9d70e03 100644 --- a/Modules/CMakeHIPCompiler.cmake.in +++ b/Modules/CMakeHIPCompiler.cmake.in @@ -76,5 +76,9 @@ set(CMAKE_HIP_COMPILER_RANLIB "@CMAKE_HIP_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@") set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@") +set(CMAKE_HIP_COMPILER_LINKER "@CMAKE_HIP_COMPILER_LINKER@") +set(CMAKE_HIP_COMPILER_LINKER_ID "@CMAKE_HIP_COMPILER_LINKER_ID@") +set(CMAKE_HIP_COMPILER_LINKER_VERSION @CMAKE_HIP_COMPILER_LINKER_VERSION@) +set(CMAKE_HIP_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_HIP_COMPILER_LINKER_FRONTEND_VARIANT@) set(CMAKE_MT "@CMAKE_MT@") set(CMAKE_TAPI "@CMAKE_TAPI@") diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in index 95e52bf..a8bb0d2 100644 --- a/Modules/CMakeOBJCCompiler.cmake.in +++ b/Modules/CMakeOBJCCompiler.cmake.in @@ -26,6 +26,10 @@ set(CMAKE_OBJC_COMPILER_RANLIB "@CMAKE_OBJC_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@") set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@") +set(CMAKE_OBJC_COMPILER_LINKER "@CMAKE_OBJC_COMPILER_LINKER@") +set(CMAKE_OBJC_COMPILER_LINKER_ID "@CMAKE_OBJC_COMPILER_LINKER_ID@") +set(CMAKE_OBJC_COMPILER_LINKER_VERSION @CMAKE_OBJC_COMPILER_LINKER_VERSION@) +set(CMAKE_OBJC_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_OBJC_COMPILER_LINKER_FRONTEND_VARIANT@) set(CMAKE_MT "@CMAKE_MT@") set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUOBJC @CMAKE_COMPILER_IS_GNUOBJC@) diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in index 87aca96..d8b6ef0 100644 --- a/Modules/CMakeOBJCXXCompiler.cmake.in +++ b/Modules/CMakeOBJCXXCompiler.cmake.in @@ -27,6 +27,10 @@ set(CMAKE_OBJCXX_COMPILER_RANLIB "@CMAKE_OBJCXX_COMPILER_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_LINKER_LINK "@CMAKE_LINKER_LINK@") set(CMAKE_LINKER_LLD "@CMAKE_LINKER_LLD@") +set(CMAKE_OBJCXX_COMPILER_LINKER "@CMAKE_OBJCXX_COMPILER_LINKER@") +set(CMAKE_OBJCXX_COMPILER_LINKER_ID "@CMAKE_OBJCXX_COMPILER_LINKER_ID@") +set(CMAKE_OBJCXX_COMPILER_LINKER_VERSION @CMAKE_OBJCXX_COMPILER_LINKER_VERSION@) +set(CMAKE_OBJCXX_COMPILER_LINKER_FRONTEND_VARIANT @CMAKE_OBJCXX_COMPILER_LINKER_FRONTEND_VARIANT@) set(CMAKE_MT "@CMAKE_MT@") set(CMAKE_TAPI "@CMAKE_TAPI@") set(CMAKE_COMPILER_IS_GNUOBJCXX @CMAKE_COMPILER_IS_GNUOBJCXX@) diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 9213cc9..b48eb43 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -15,6 +15,26 @@ cmake_policy(SET CMP0054 NEW) # compatibility don't break. # function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj_regex) + set(keywordArgs) + set(oneValueArgs LANGUAGE COMPUTE_IMPLICIT_OBJECTS) + set(multiValueArgs ) + cmake_parse_arguments(EXTRA_PARSE "${keywordArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + cmake_parse_implicit_link_info2("${text}" "${log_var}" "${obj_regex}" + COMPUTE_IMPLICIT_LIBS "${lib_var}" COMPUTE_IMPLICIT_DIRS "${dir_var}" + COMPUTE_IMPLICIT_FWKS "${fwk_var}" ${ARGN}) + + set(${lib_var} "${${lib_var}}" PARENT_SCOPE) + set(${dir_var} "${${dir_var}}" PARENT_SCOPE) + set(${fwk_var} "${${fwk_var}}" PARENT_SCOPE) + set(${log_var} "${${log_var}}" PARENT_SCOPE) + + if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS) + set(${EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS} "${${EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS}}" PARENT_SCOPE) + endif() +endfunction() + +function(cmake_parse_implicit_link_info2 text log_var obj_regex) set(implicit_libs_tmp "") set(implicit_objs_tmp "") set(implicit_dirs_tmp) @@ -22,25 +42,29 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj set(log "") set(keywordArgs) - set(oneValueArgs COMPUTE_IMPLICIT_OBJECTS LANGUAGE) + set(oneValueArgs LANGUAGE + COMPUTE_IMPLICIT_LIBS COMPUTE_IMPLICIT_DIRS COMPUTE_IMPLICIT_FWKS + COMPUTE_IMPLICIT_OBJECTS COMPUTE_LINKER) set(multiValueArgs ) cmake_parse_arguments(EXTRA_PARSE "${keywordArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) set(is_msvc 0) if(EXTRA_PARSE_LANGUAGE AND - ("x${CMAKE_${EXTRA_PARSE_LANGUAGE}_ID}" STREQUAL "xMSVC" OR + ("x${CMAKE_${EXTRA_PARSE_LANGUAGE}_COMPILER_ID}" STREQUAL "xMSVC" OR "x${CMAKE_${EXTRA_PARSE_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC")) set(is_msvc 1) endif() - # Parse implicit linker arguments. - set(linker "CMAKE_LINKER-NOTFOUND") - if(CMAKE_LINKER) - get_filename_component(linker ${CMAKE_LINKER} NAME) - string(REGEX REPLACE "([][+.*?()^$])" "\\\\\\1" linker "${linker}") - endif() + set(linker "ld[0-9]*(\\.[a-z]+)?") if(is_msvc) - string(APPEND linker "|link\\.exe|lld-link") + string(APPEND linker "|link\\.exe|lld-link(\\.exe)?") + endif() + if(CMAKE_LINKER) + get_filename_component(default_linker ${CMAKE_LINKER} NAME) + if (NOT default_linker MATCHES "(${linker})") + string(REGEX REPLACE "([][+.*?()^$])" "\\\\\\1" default_linker "${default_linker}") + list(PREPEND linker "${default_linker}|") + endif() endif() set(startfile "CMAKE_LINK_STARTFILE-NOTFOUND") if(CMAKE_LINK_STARTFILE) @@ -50,9 +74,35 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj # whole line and just the command (argv[0]). set(linker_regex "^( *|.*[/\\])(${linker}|${startfile}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)") set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=|/ldfe ") + set(linker_tool_regex "^[ \t]*(->|exec:|\")?[ \t]*(.*[/\\](${linker}))(\"|,| |$)") + set(linker_tool_exclude_regex "cuda-fake-ld|-fuse-ld=") + set(linker_tool "NOTFOUND") + set(link_line_parsed 0) string(APPEND log " link line regex: [${linker_regex}]\n") + if(EXTRA_PARSE_COMPUTE_LINKER) + string(APPEND log " linker tool regex: [${linker_tool_regex}]\n") + endif() string(REGEX REPLACE "\r?\n" ";" output_lines "${text}") foreach(line IN LISTS output_lines) + if(EXTRA_PARSE_COMPUTE_LINKER AND + NOT linker_tool AND NOT "${line}" MATCHES "${linker_tool_exclude_regex}" + AND "${line}" MATCHES "${linker_tool_regex}") + set(linker_tool "${CMAKE_MATCH_2}") + if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + # pick-up last path + string(REGEX REPLACE "^.*([A-Za-z]:[/\\][^:]+)$" "\\1" linker_tool "${linker_tool}") + cmake_path(SET linker_tool "${linker_tool}") + endif() + string(APPEND log " linker tool for '${EXTRA_PARSE_LANGUAGE}': ${linker_tool}\n") + endif() + if(NOT (EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS OR EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS + OR EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS OR EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS)) + if(linker_tool) + break() + else() + continue() + endif() + endif() set(cmd) if("${line}" MATCHES "${linker_regex}" AND NOT "${line}" MATCHES "${linker_exclude_regex}") @@ -86,7 +136,8 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj endif() endif() set(search_static 0) - if("${cmd}" MATCHES "${linker_regex}") + if(NOT link_line_parsed AND "${cmd}" MATCHES "${linker_regex}") + set(link_line_parsed 1) string(APPEND log " link line: [${line}]\n") string(REGEX REPLACE ";-([LYz]);" ";-\\1" args "${args}") set(skip_value_of "") @@ -95,58 +146,76 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj string(APPEND log " arg [${arg}] ==> skip value of ${skip_value_of}\n") set(skip_value_of "") elseif("${arg}" MATCHES "^-L(.:)?[/\\]") - # Unix search path. - string(REGEX REPLACE "^-L" "" dir "${arg}") - list(APPEND implicit_dirs_tmp ${dir}) - string(APPEND log " arg [${arg}] ==> dir [${dir}]\n") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS) + # Unix search path. + string(REGEX REPLACE "^-L" "" dir "${arg}") + list(APPEND implicit_dirs_tmp ${dir}) + string(APPEND log " arg [${arg}] ==> dir [${dir}]\n") + endif() elseif("${arg}" MATCHES "^[-/](LIBPATH|libpath):(.+)") - # MSVC search path. - set(dir "${CMAKE_MATCH_2}") - list(APPEND implicit_dirs_tmp ${dir}) - string(APPEND log " arg [${arg}] ==> dir [${dir}]\n") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS) + # MSVC search path. + set(dir "${CMAKE_MATCH_2}") + list(APPEND implicit_dirs_tmp ${dir}) + string(APPEND log " arg [${arg}] ==> dir [${dir}]\n") + endif() elseif(is_msvc AND "${arg}" STREQUAL "-link") string(APPEND log " arg [${arg}] ==> ignore MSVC cl option\n") + elseif(is_msvc AND "${arg}" MATCHES "^[-/][Ii][Mm][Pp][Ll][Ii][Bb]:") + string(APPEND log " arg [${arg}] ==> ignore MSVC link option\n") elseif(is_msvc AND "${arg}" MATCHES "^(.*\\.[Ll][Ii][Bb])$") - set(lib "${CMAKE_MATCH_1}") - list(APPEND implicit_libs_tmp ${lib}) - string(APPEND log " arg [${arg}] ==> lib [${lib}]\n") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS) + set(lib "${CMAKE_MATCH_1}") + list(APPEND implicit_libs_tmp ${lib}) + string(APPEND log " arg [${arg}] ==> lib [${lib}]\n") + endif() elseif("${arg}" STREQUAL "-lto_library") # ld argument "-lto_library <path>" set(skip_value_of "${arg}") string(APPEND log " arg [${arg}] ==> ignore, skip following value\n") elseif("${arg}" MATCHES "^-l([^:].*)$") - # Unix library. - set(lib "${CMAKE_MATCH_1}") - if(search_static AND lib MATCHES "^(gfortran|stdc\\+\\+)$") - # Search for the static library later, once all link dirs are known. - set(lib "SEARCH_STATIC:${lib}") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS) + # Unix library. + set(lib "${CMAKE_MATCH_1}") + if(search_static AND lib MATCHES "^(gfortran|stdc\\+\\+)$") + # Search for the static library later, once all link dirs are known. + set(lib "SEARCH_STATIC:${lib}") + endif() + list(APPEND implicit_libs_tmp ${lib}) + string(APPEND log " arg [${arg}] ==> lib [${lib}]\n") endif() - list(APPEND implicit_libs_tmp ${lib}) - string(APPEND log " arg [${arg}] ==> lib [${lib}]\n") elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$") - # Unix library full path. - list(APPEND implicit_libs_tmp ${arg}) - string(APPEND log " arg [${arg}] ==> lib [${arg}]\n") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS) + # Unix library full path. + list(APPEND implicit_libs_tmp ${arg}) + string(APPEND log " arg [${arg}] ==> lib [${arg}]\n") + endif() elseif("${arg}" MATCHES "^[-/](DEFAULTLIB|defaultlib):(.+)") - # Windows library. - set(lib "${CMAKE_MATCH_2}") - list(APPEND implicit_libs_tmp ${lib}) - string(APPEND log " arg [${arg}] ==> lib [${lib}]\n") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS) + # Windows library. + set(lib "${CMAKE_MATCH_2}") + list(APPEND implicit_libs_tmp ${lib}) + string(APPEND log " arg [${arg}] ==> lib [${lib}]\n") + endif() elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$") if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS) list(APPEND implicit_objs_tmp ${arg}) string(APPEND log " arg [${arg}] ==> obj [${arg}]\n") endif() - if(obj_regex AND "${arg}" MATCHES "${obj_regex}") - # Object file full path. - list(APPEND implicit_libs_tmp ${arg}) + if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS) + if(obj_regex AND "${arg}" MATCHES "${obj_regex}") + # Object file full path. + list(APPEND implicit_libs_tmp ${arg}) + endif() endif() elseif("${arg}" MATCHES "^-Y(P,)?[^0-9]") - # Sun search path ([^0-9] avoids conflict with Mac -Y<num>). - string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}") - string(REPLACE ":" ";" dirs "${dirs}") - list(APPEND implicit_dirs_tmp ${dirs}) - string(APPEND log " arg [${arg}] ==> dirs [${dirs}]\n") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS) + # Sun search path ([^0-9] avoids conflict with Mac -Y<num>). + string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}") + string(REPLACE ":" ";" dirs "${dirs}") + list(APPEND implicit_dirs_tmp ${dirs}) + string(APPEND log " arg [${arg}] ==> dirs [${dirs}]\n") + endif() elseif("${arg}" STREQUAL "-Bstatic") set(search_static 1) string(APPEND log " arg [${arg}] ==> search static\n" ) @@ -154,13 +223,17 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj set(search_static 0) string(APPEND log " arg [${arg}] ==> search dynamic\n" ) elseif("${arg}" MATCHES "^-l:") - # HP named library. - list(APPEND implicit_libs_tmp ${arg}) - string(APPEND log " arg [${arg}] ==> lib [${arg}]\n") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS) + # HP named library. + list(APPEND implicit_libs_tmp ${arg}) + string(APPEND log " arg [${arg}] ==> lib [${arg}]\n") + endif() elseif("${arg}" MATCHES "^-z(all|default|weak)extract") - # Link editor option. - list(APPEND implicit_libs_tmp ${arg}) - string(APPEND log " arg [${arg}] ==> opt [${arg}]\n") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS) + # Link editor option. + list(APPEND implicit_libs_tmp ${arg}) + string(APPEND log " arg [${arg}] ==> opt [${arg}]\n") + endif() elseif("${arg}" STREQUAL "cl.exe") string(APPEND log " arg [${arg}] ==> recognize MSVC cl\n") set(is_msvc 1) @@ -168,25 +241,29 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj string(APPEND log " arg [${arg}] ==> ignore\n") endif() endforeach() - break() elseif("${line}" MATCHES "LPATH(=| is:? *)(.*)$") - string(APPEND log " LPATH line: [${line}]\n") - # HP search path. - string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}") - list(APPEND implicit_dirs_tmp ${paths}) - string(APPEND log " dirs [${paths}]\n") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS) + string(APPEND log " LPATH line: [${line}]\n") + # HP search path. + string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}") + list(APPEND implicit_dirs_tmp ${paths}) + string(APPEND log " dirs [${paths}]\n") + endif() else() string(APPEND log " ignore line: [${line}]\n") endif() + if((NOT EXTRA_PARSE_COMPUTE_LINKER OR linker_tool) AND link_line_parsed) + break() + endif() endforeach() # Look for library search paths reported by linker. - if("${output_lines}" MATCHES ";Library search paths:((;\t[^;]+)+)") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS AND "${output_lines}" MATCHES ";Library search paths:((;\t[^;]+)+)") string(REPLACE ";\t" ";" implicit_dirs_match "${CMAKE_MATCH_1}") string(APPEND log " Library search paths: [${implicit_dirs_match}]\n") list(APPEND implicit_dirs_tmp ${implicit_dirs_match}) endif() - if("${output_lines}" MATCHES ";Framework search paths:((;\t[^;]+)+)") + if(EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS AND "${output_lines}" MATCHES ";Framework search paths:((;\t[^;]+)+)") string(REPLACE ";\t" ";" implicit_fwks_match "${CMAKE_MATCH_1}") string(APPEND log " Framework search paths: [${implicit_fwks_match}]\n") list(APPEND implicit_fwks_tmp ${implicit_fwks_match}) @@ -271,11 +348,21 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj string(APPEND log " implicit fwks: [${implicit_fwks}]\n") # Return results. - set(${lib_var} "${implicit_libs}" PARENT_SCOPE) - set(${dir_var} "${implicit_dirs}" PARENT_SCOPE) - set(${fwk_var} "${implicit_fwks}" PARENT_SCOPE) + if(EXTRA_PARSE_COMPUTE_LINKER) + set(${EXTRA_PARSE_COMPUTE_LINKER} "${linker_tool}" PARENT_SCOPE) + endif() + set(${log_var} "${log}" PARENT_SCOPE) + if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS) + set(${EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS} "${implicit_libs}" PARENT_SCOPE) + endif() + if(EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS) + set(${EXTRA_PARSE_COMPUTE_IMPLICIT_DIRS} "${implicit_dirs}" PARENT_SCOPE) + endif() + if(EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS) + set(${EXTRA_PARSE_COMPUTE_IMPLICIT_FWKS} "${implicit_fwks}" PARENT_SCOPE) + endif() if(EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS) set(${EXTRA_PARSE_COMPUTE_IMPLICIT_OBJECTS} "${implicit_objs}" PARENT_SCOPE) endif() diff --git a/Modules/CheckIPOSupported/main.c b/Modules/CheckIPOSupported/main.c index 5be0864..8d2ab01 100644 --- a/Modules/CheckIPOSupported/main.c +++ b/Modules/CheckIPOSupported/main.c @@ -1,6 +1,6 @@ int foo(); -int main() +int main(void) { return foo(); } diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index d01054b..bb367ea 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -74,28 +74,36 @@ macro(__compiler_gnu lang) if (NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) ## check if this feature is supported by the linker - execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -Wl,--help - OUTPUT_VARIABLE _linker_capabilities - ERROR_VARIABLE _linker_capabilities) - if(_linker_capabilities MATCHES "--dependency-file") - set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED TRUE) + if (CMAKE_${lang}_COMPILER_LINKER AND CMAKE_${lang}_COMPILER_LINKER_ID MATCHES "GNU|LLD") + execute_process(COMMAND "${CMAKE_${lang}_COMPILER_LINKER}" --help + OUTPUT_VARIABLE _linker_capabilities + ERROR_VARIABLE _linker_capabilities) + if(_linker_capabilities MATCHES "--dependency-file") + set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED TRUE) + else() + set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE) + endif() + unset(_linker_capabilities) else() set(CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED FALSE) endif() - unset(_linker_capabilities) endif() endif() if (CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER TRUE) else() - unset(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER) + set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE) endif() - # For now, due to GNU binutils ld bug when LTO is enabled (see GNU bug - # `30568 <https://sourceware.org/bugzilla/show_bug.cgi?id=30568>`_), - # deactivate this feature. - if (NOT DEFINED CMAKE_LINK_DEPENDS_USE_LINKER) - set(CMAKE_LINK_DEPENDS_USE_LINKER FALSE) + # Due to GNU binutils ld bug when LTO is enabled (see GNU bug + # `30568 <https://sourceware.org/bugzilla/show_bug.cgi?id=30568>`_), + # deactivate this feature if the version is less than 2.41. + # For now, all known versions of gold linker have also this bug. + if (CMAKE_${lang}_COMPILER_LINKER_ID + AND (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNUgold" + OR (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNU" + AND CMAKE_${lang}_COMPILER_LINKER_VERSION VERSION_LESS "2.41"))) + set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE) endif() # Initial configuration flags. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 67b805b..801a8de 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -3778,6 +3778,9 @@ function(_ep_extract_configure_command var name) list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}") else() list(APPEND cmd "-G${CMAKE_GENERATOR}") + # GreenHills needs to know about the compiler and toolset. + # Be sure to update the similar section in + # FetchContent.cmake:__FetchContent_directPopulate() if("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI") set(has_cmake_cache_default_args 1) list(APPEND cmake_cache_default_args diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index f10684c..ad5a6f1 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -1596,6 +1596,20 @@ ExternalProject_Add_Step(${contentName}-populate copyfile list(APPEND subCMakeOpts "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}") endif() + # GreenHills needs to know about the compiler and toolset to run the + # subbuild commands. Be sure to update the similar section in + # ExternalProject.cmake:_ep_extract_configure_command() + if(CMAKE_GENERATOR MATCHES "Green Hills MULTI") + list(APPEND subCMakeOpts + "-DGHS_TARGET_PLATFORM:STRING=${GHS_TARGET_PLATFORM}" + "-DGHS_PRIMARY_TARGET:STRING=${GHS_PRIMARY_TARGET}" + "-DGHS_TOOLSET_ROOT:STRING=${GHS_TOOLSET_ROOT}" + "-DGHS_OS_ROOT:STRING=${GHS_OS_ROOT}" + "-DGHS_OS_DIR:STRING=${GHS_OS_DIR}" + "-DGHS_BSP_NAME:STRING=${GHS_BSP_NAME}" + ) + endif() + # Override the sub-build's configuration types for multi-config generators. # This ensures we are not affected by any custom setting from the project # and can always request a known configuration further below. diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index dcf271d..583d056 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -110,11 +110,41 @@ if (freetype_FOUND) endif () get_property(FREETYPE_INCLUDE_DIRS TARGET freetype PROPERTY INTERFACE_INCLUDE_DIRECTORIES) get_property(FREETYPE_LIBRARIES TARGET freetype PROPERTY INTERFACE_LINK_LIBRARIES) - get_property(_Freetype_location TARGET freetype PROPERTY LOCATION) - list(APPEND FREETYPE_LIBRARIES + get_property(_Freetype_location TARGET freetype PROPERTY IMPORTED_IMPLIB) + if (NOT _Freetype_location) + get_property(_Freetype_location_release TARGET freetype PROPERTY IMPORTED_IMPLIB_RELEASE) + get_property(_Freetype_location_debug TARGET freetype PROPERTY IMPORTED_IMPLIB_DEBUG) + if (_Freetype_location_release AND _Freetype_location_debug) + set(_Freetype_location + optimized "${_Freetype_location_release}" + debug "${_Freetype_location_debug}") + elseif (_Freetype_location_release) + set(_Freetype_location "${_Freetype_location_release}") + elseif (_Freetype_location_debug) + set(_Freetype_location "${_Freetype_location_debug}") + else () + get_property(_Freetype_location_release TARGET freetype PROPERTY LOCATION_RELEASE) + get_property(_Freetype_location_debug TARGET freetype PROPERTY LOCATION_DEBUG) + if (_Freetype_location_release AND _Freetype_location_debug) + set(_Freetype_location + optimized "${_Freetype_location_release}" + debug "${_Freetype_location_debug}") + elseif (_Freetype_location_release) + set(_Freetype_location "${_Freetype_location_release}") + elseif (_Freetype_location_debug) + set(_Freetype_location "${_Freetype_location_debug}") + else () + get_property(_Freetype_location TARGET freetype PROPERTY LOCATION) + endif () + endif () + unset(_Freetype_location_release) + unset(_Freetype_location_debug) + endif () + list(INSERT FREETYPE_LIBRARIES 0 "${_Freetype_location}") unset(_Freetype_location) set(Freetype_FOUND 1) + set(FREETYPE_FOUND 1) set(FREETYPE_VERSION_STRING "${freetype_VERSION}") foreach (_Freetype_component IN LISTS Freetype_FIND_COMPONENTS) set(Freetype_${_Freetype_component}_FOUND "${freetype_${_Freetype_component}_FOUND}") diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake index bc45eea..6be3422 100644 --- a/Modules/FindOpenThreads.cmake +++ b/Modules/FindOpenThreads.cmake @@ -5,26 +5,32 @@ FindOpenThreads --------------- - - OpenThreads is a C++ based threading library. Its largest userbase seems to OpenSceneGraph so you might notice I accept OSGDIR as an -environment path. I consider this part of the Findosg* suite used to +environment path. I consider this part of the ``Findosg*`` suite used to find OpenSceneGraph components. Each component is separate and you must opt in to each module. -Locate OpenThreads This module defines OPENTHREADS_LIBRARY -OPENTHREADS_FOUND, if false, do not try to link to OpenThreads -OPENTHREADS_INCLUDE_DIR, where to find the headers +This module defines: + +``OPENTHREADS_LIBRARY`` + +``OPENTHREADS_FOUND`` + if false, do not try to link to OpenThreads +``OPENTHREADS_INCLUDE_DIR`` + where to find the headers + +``$OPENTHREADS_DIR`` is an environment variable that would correspond to the:: + + ./configure --prefix=$OPENTHREADS_DIR -$OPENTHREADS_DIR is an environment variable that would correspond to -the ./configure --prefix=$OPENTHREADS_DIR used in building osg. +used in building osg. -[CMake 2.8.10]: The CMake variables OPENTHREADS_DIR or OSG_DIR can now -be used as well to influence detection, instead of needing to specify -an environment variable. +.. versionadded:: 2.8.10 -Created by Eric Wing. + The CMake variables ``OPENTHREADS_DIR`` or ``OSG_DIR`` can now + be used as well to influence detection, instead of needing to specify + an environment variable. #]=======================================================================] # Header files are presumed to be included like diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 008b537..a7ee0c4 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -299,6 +299,8 @@ function(protobuf_generate) list(APPEND _protobuf_include_path -I ${_abs_dir}) endif() endforeach() + else() + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) endif() foreach(DIR ${protobuf_generate_IMPORT_DIRS}) @@ -309,10 +311,6 @@ function(protobuf_generate) endif() endforeach() - if(NOT _protobuf_include_path) - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - set(_generated_srcs_all) foreach(_proto ${protobuf_generate_PROTOS}) get_filename_component(_abs_file ${_proto} ABSOLUTE) diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 78fa481..b42a85e 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -37,7 +37,7 @@ select a configuration): wxWidgets_EXCLUDE_COMMON_LIBRARIES - Set to TRUE to exclude linking of commonly required libs (e.g., png tiff - jpeg zlib regex expat). + jpeg zlib regex expat scintilla lexilla). @@ -188,6 +188,9 @@ 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 "") @@ -244,8 +247,14 @@ macro(wx_extract_version) "\\2" wxWidgets_VERSION_MINOR "${_wx_version_h}" ) string(REGEX REPLACE "^(.*\n)?#define +wxRELEASE_NUMBER +([0-9]+).*" "\\2" wxWidgets_VERSION_PATCH "${_wx_version_h}" ) + string(REGEX REPLACE "^(.*\n)?#define +wxSUBRELEASE_NUMBER +([0-9]+).*" + "\\2" wxWidgets_VERSION_TWEAK "${_wx_version_h}" ) + set(wxWidgets_VERSION_STRING "${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}" ) + if(${wxWidgets_VERSION_TWEAK} GREATER 0) + string(APPEND wxWidgets_VERSION_STRING ".${wxWidgets_VERSION_TWEAK}") + endif() dbg_msg("wxWidgets_VERSION_STRING: ${wxWidgets_VERSION_STRING}") endmacro() @@ -265,6 +274,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") # Useful common wx libs needed by almost all components. set(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat) + # Libraries needed by stc component + set(wxWidgets_STC_LIBRARIES scintilla lexilla) + # DEPRECATED: Use find_package(wxWidgets COMPONENTS mono) instead. if(NOT wxWidgets_FIND_COMPONENTS) if(wxWidgets_USE_MONOLITHIC) @@ -277,10 +289,15 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") # Add the common (usually required libs) unless # wxWidgets_EXCLUDE_COMMON_LIBRARIES has been set. if(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES) - list(APPEND wxWidgets_FIND_COMPONENTS - ${wxWidgets_COMMON_LIBRARIES}) + if(stc IN_LIST wxWidgets_FIND_COMPONENTS) + list(APPEND wxWidgets_FIND_COMPONENTS ${wxWidgets_STC_LIBRARIES}) + endif() + list(APPEND wxWidgets_FIND_COMPONENTS ${wxWidgets_COMMON_LIBRARIES}) endif() + # Remove duplicates, for example when user has specified common libraries. + list(REMOVE_DUPLICATES wxWidgets_FIND_COMPONENTS) + #------------------------------------------------------------------- # WIN32: Helper MACROS #------------------------------------------------------------------- @@ -312,7 +329,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") # FIXME: What if both regex libs are available. regex should be # found outside the loop and only wx${LIB}${_UCD}${_DBG}. # Find wxWidgets common libraries. - foreach(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla) + foreach(LIB ${wxWidgets_COMMON_LIBRARIES} ${wxWidgets_STC_LIBRARIES}) find_library(WX_${LIB}${_DBG} NAMES wx${LIB}${_UCD}${_DBG} # for regex @@ -371,7 +388,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") # Clear all debug or release library paths (arguments are "d" or ""). macro(WX_CLEAR_ALL_LIBS _DBG) # Clear wxWidgets common libraries. - foreach(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla) + foreach(LIB ${wxWidgets_COMMON_LIBRARIES} ${wxWidgets_STC_LIBRARIES}) WX_CLEAR_LIB(WX_${LIB}${_DBG}) endforeach() @@ -441,12 +458,15 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") endif() DBG_MSG_V("OpenGL") - list(FIND ${_LIBS} gl WX_USE_GL) - if(NOT WX_USE_GL EQUAL -1) + if(gl IN_LIST ${_LIBS}) DBG_MSG_V("- is required.") list(APPEND wxWidgets_LIBRARIES opengl32 glu32) endif() + if(stc IN_LIST ${_LIBS}) + list(APPEND wxWidgets_LIBRARIES imm32) + endif() + list(APPEND wxWidgets_LIBRARIES winmm comctl32 uuid oleacc uxtheme rpcrt4 shlwapi version wsock32) endmacro() @@ -458,6 +478,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") foreach(version ${wx_versions}) foreach(patch RANGE 15 0 -1) list(APPEND wx_paths "wxWidgets-${version}.${patch}") + foreach(tweak RANGE 3 1 -1) + list(APPEND wx_paths "wxWidgets-${version}.${patch}.${tweak}") + endforeach() endforeach() endforeach() @@ -937,35 +960,38 @@ if(wxWidgets_FIND_STYLE STREQUAL "unix") endif() unset(_cygpath_exe CACHE) endif() -endif() -# Check that all libraries are present, as wx-config does not check it -set(_wx_lib_missing "") -foreach(_wx_lib_ ${wxWidgets_LIBRARIES}) - if("${_wx_lib_}" MATCHES "^-l(.*)") - set(_wx_lib_name "${CMAKE_MATCH_1}") - unset(_wx_lib_found CACHE) - find_library(_wx_lib_found NAMES ${_wx_lib_name} HINTS ${wxWidgets_LIBRARY_DIRS}) - if(_wx_lib_found STREQUAL _wx_lib_found-NOTFOUND) - list(APPEND _wx_lib_missing ${_wx_lib_name}) - endif() - unset(_wx_lib_found CACHE) - endif() -endforeach() + # Check that all libraries are present, as wx-config does not check it + set(_wx_lib_missing "") + foreach(_wx_lib_ ${wxWidgets_LIBRARIES}) + if("${_wx_lib_}" MATCHES "^-l(.*)") + set(_wx_lib_name "${CMAKE_MATCH_1}") + unset(_wx_lib_found CACHE) + find_library(_wx_lib_found NAMES ${_wx_lib_name} HINTS ${wxWidgets_LIBRARY_DIRS}) + if(_wx_lib_found STREQUAL _wx_lib_found-NOTFOUND) + list(APPEND _wx_lib_missing ${_wx_lib_name}) + endif() + unset(_wx_lib_found CACHE) + endif() + endforeach() -if (_wx_lib_missing) - string(REPLACE ";" " " _wx_lib_missing "${_wx_lib_missing}") - DBG_MSG_V("wxWidgets not found due to following missing libraries: ${_wx_lib_missing}") - set(wxWidgets_FOUND FALSE) - unset(wxWidgets_LIBRARIES) + if (_wx_lib_missing) + string(REPLACE ";" " " _wx_lib_missing "${_wx_lib_missing}") + DBG_MSG_V("wxWidgets not found due to following missing libraries: ${_wx_lib_missing}") + set(wxWidgets_FOUND FALSE) + unset(wxWidgets_LIBRARIES) + endif() + unset(_wx_lib_missing) endif() -unset(_wx_lib_missing) # Check if a specific version was requested by find_package(). if(wxWidgets_FOUND) wx_extract_version() endif() +file(TO_CMAKE_PATH "${wxWidgets_INCLUDE_DIRS}" wxWidgets_INCLUDE_DIRS) +file(TO_CMAKE_PATH "${wxWidgets_LIBRARY_DIRS}" wxWidgets_LIBRARY_DIRS) + # Debug output: DBG_MSG("wxWidgets_FOUND : ${wxWidgets_FOUND}") DBG_MSG("wxWidgets_INCLUDE_DIRS : ${wxWidgets_INCLUDE_DIRS}") @@ -1215,3 +1241,5 @@ function(WXWIDGETS_ADD_RESOURCES _outfiles) set(${_outfiles} ${${_outfiles}} PARENT_SCOPE) endfunction() + +cmake_policy(POP) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 0cd49ab..0ba35b6 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -730,7 +730,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if(gp_tool MATCHES "ldd$") set(gp_cmd_args "") - set(gp_regex "^[\t ]*[^\t ]+ =>[\t ]+(/[^\t\(]+)( \(.+\))?${eol_char}$") + set(gp_regex "^[\t ]*[^\t ]+ =>[\t ]+([^\t\(]+)( \(.+\))?${eol_char}$") set(gp_regex_error "not found${eol_char}$") set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$") set(gp_regex_cmp_count 1) diff --git a/Modules/Internal/CMakeDetermineLinkerId.cmake b/Modules/Internal/CMakeDetermineLinkerId.cmake new file mode 100644 index 0000000..ab851d7 --- /dev/null +++ b/Modules/Internal/CMakeDetermineLinkerId.cmake @@ -0,0 +1,92 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt 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 + unset(CMAKE_${lang}_COMPILER_LINKER_ID PARENT_SCOPE) + unset(CMAKE_${lang}_COMPILER_LINKER_VERSION PARENT_SCOPE) + unset(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT PARENT_SCOPE) + return() + endif() + + if (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR linker MATCHES "lld$") + set(flags "--version") + else() + set(flags "-v") + endif() + execute_process(COMMAND "${linker}" ${flags} + OUTPUT_VARIABLE linker_desc + ERROR_VARIABLE linker_desc + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE) + + set(linker_frontend) + set(linker_version) + + # Compute the linker ID + if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND linker_desc MATCHES "@\\(#\\)PROGRAM:ld") + set(linker_id "AppleClang") + set(linker_frontend "GNU") + elseif (linker_desc MATCHES "mold \\(sold\\)") + set(linker_id "MOLD") + set(linker_frontend "GNU") + elseif (linker_desc MATCHES "mold") + set(linker_id "MOLD") + set(linker_frontend "GNU") + elseif (linker_desc MATCHES "LLD") + set(linker_id "LLD") + set(linker_frontend "GNU") + if (WIN32 AND NOT linker_desc MATCHES "compatible with GNU") + set (linker_frontend "MSVC") + endif() + elseif (linker_desc MATCHES "GNU ld") + set(linker_id "GNU") + set(linker_frontend "GNU") + elseif (linker_desc MATCHES "GNU gold") + set(linker_id "GNUgold") + set(linker_frontend "GNU") + elseif (linker_desc MATCHES "Microsoft \\(R\\) Incremental Linker") + set(linker_id "MSVC") + set(linker_frontend "MSVC") + else() + # unknown linker + set(linker_id "UNKNOWN") + endif() + + # Get linker version + if (linker_id STREQUAL "AppleClang") + string(REGEX REPLACE ".+PROJECT:[a-z0-9]+-([0-9.]+).+" "\\1" linker_version "${linker_desc}") + elseif (linker_id MATCHES "MOLD|SOLD") + string(REGEX REPLACE "^mold (\\(sold\\) )?([0-9.]+).+" "\\2" linker_version "${linker_desc}") + elseif (linker_id STREQUAL "LLD") + string(REGEX REPLACE ".*LLD ([0-9.]+).*" "\\1" linker_version "${linker_desc}") + elseif (linker_id MATCHES "(GNU|GOLD)") + string(REGEX REPLACE "^GNU [^ ]+ \\([^)]+\\) ([0-9.]+).*" "\\1" linker_version "${linker_desc}") + elseif (linker_id STREQUAL "MSVC") + string(REGEX REPLACE ".+Linker Version ([0-9.]+).+" "\\1" linker_version "${linker_desc}") + endif() + + set(CMAKE_${lang}_COMPILER_LINKER_ID "${linker_id}" PARENT_SCOPE) + if (linker_frontend) + set(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT "${linker_frontend}" PARENT_SCOPE) + else() + unset(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT PARENT_SCOPE) + endif() + if (linker_version) + set(CMAKE_${lang}_COMPILER_LINKER_VERSION "${linker_version}" PARENT_SCOPE) + else() + unset(CMAKE_${lang}_COMPILER_LINKER_VERSION PARENT_SCOPE) + endif() +endfunction() + +cmake_policy(POP) diff --git a/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake b/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake index 32ff28a..3aa10a2 100644 --- a/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake +++ b/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake @@ -52,6 +52,9 @@ macro(cmake_nvcc_parse_implicit_info lang lang_var_) string(APPEND _nvcc_log " considering line: [${_nvcc_output_line}]\n") if("${_nvcc_output_line}" MATCHES "^ *nvlink") string(APPEND _nvcc_log " ignoring nvlink line\n") + elseif("${_nvcc_output_line}" MATCHES "(link\\.exe .*CompilerId${lang}\\.exe.*)$") + set(_nvcc_link_line "${CMAKE_MATCH_1}") + string(APPEND _nvcc_log " extracted link line: [${_nvcc_link_line}]\n") elseif(_nvcc_libraries) if("${_nvcc_output_line}" MATCHES "(@\"?((tmp/)?a\\.exe\\.res)\"?)") set(_nvcc_link_res_arg "${CMAKE_MATCH_1}") diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index ef64012..070b24d 100644 --- a/Modules/Platform/CYGWIN-GNU.cmake +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -52,6 +52,8 @@ macro(__cygwin_compiler_gnu lang) "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") set(CMAKE_${lang}_CREATE_WIN32_EXE "-mwindows") + set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v") + # No -fPIC on cygwin set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "") set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "") diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index d614182..533b9ce 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -125,17 +125,17 @@ set(CMAKE_LINK_LIBRARY_USING_WEAK_FRAMEWORK "LINKER:-weak_framework,<LIBRARY>") set(CMAKE_LINK_LIBRARY_USING_WEAK_FRAMEWORK_SUPPORTED TRUE) # Defines LINK_LIBRARY features for libraries -set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY "PATH{LINKER:-needed_library <LIBRARY>}NAME{LINKER:-needed-l<LIBRARY>}") +set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY "PATH{LINKER:-needed_library,<LIBRARY>}NAME{LINKER:-needed-l<LIBRARY>}") set(CMAKE_LINK_LIBRARY_USING_NEEDED_LIBRARY_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY "PATH{LINKER:-reexport_library <LIBRARY>}NAME{LINKER:-reexport-l<LIBRARY>}") +set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY "PATH{LINKER:-reexport_library,<LIBRARY>}NAME{LINKER:-reexport-l<LIBRARY>}") set(CMAKE_LINK_LIBRARY_USING_REEXPORT_LIBRARY_SUPPORTED TRUE) -set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY "PATH{LINKER:-weak_library <LIBRARY>}NAME{LINKER:-weak-l<LIBRARY>}") +set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY "PATH{LINKER:-weak_library,<LIBRARY>}NAME{LINKER:-weak-l<LIBRARY>}") set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY_SUPPORTED TRUE) # Defines LINK_LIBRARY feature to Force loading of all members of an archive -set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-force_load <LIB_ITEM>") +set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-force_load,<LIB_ITEM>") set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE) # default to searching for frameworks first diff --git a/Modules/Platform/Linux-GNU.cmake b/Modules/Platform/Linux-GNU.cmake index b8ce521..c3878eb 100644 --- a/Modules/Platform/Linux-GNU.cmake +++ b/Modules/Platform/Linux-GNU.cmake @@ -13,6 +13,8 @@ macro(__linux_compiler_gnu lang) # 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") diff --git a/Modules/Platform/Linux-NVIDIA-CUDA.cmake b/Modules/Platform/Linux-NVIDIA-CUDA.cmake index 4b416de..f383720 100644 --- a/Modules/Platform/Linux-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Linux-NVIDIA-CUDA.cmake @@ -1,4 +1,6 @@ +set(CMAKE_CUDA_VERBOSE_LINK_FLAG "-Wl,-v") + # linker selection set(CMAKE_CUDA_USING_LINKER_SYSTEM "") set(CMAKE_CUDA_USING_LINKER_LLD "-fuse-ld=lld") diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index a03fc9e..a58c2d6 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -45,6 +45,7 @@ macro(__windows_compiler_clang_gnu lang) math(EXPR MSVC_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") endif() + set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-v") # No -fPIC on Windows set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "") set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "") diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index ac990d5..9f81882 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -112,6 +112,8 @@ macro(__windows_compiler_gnu lang) set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") endforeach() + set(CMAKE_${lang}_VERBOSE_LINK_FLAG "-Wl,-v") + # linker selection set(CMAKE_${lang}_USING_LINKER_SYSTEM "") set(CMAKE_${lang}_USING_LINKER_BFD "-fuse-ld=bfd") diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake index 83c9b20..5e6f606 100644 --- a/Modules/UseEcos.cmake +++ b/Modules/UseEcos.cmake @@ -8,21 +8,31 @@ UseEcos This module defines variables and macros required to build eCos application. This file contains the following macros: -ECOS_ADD_INCLUDE_DIRECTORIES() - add the eCos include dirs -ECOS_ADD_EXECUTABLE(name source1 ... sourceN ) - create an eCos -executable ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN ) - adjusts -the path of the source files and puts the result into VAR - -Macros for selecting the toolchain: ECOS_USE_ARM_ELF_TOOLS() - enable -the ARM ELF toolchain for the directory where it is called -ECOS_USE_I386_ELF_TOOLS() - enable the i386 ELF toolchain for the -directory where it is called ECOS_USE_PPC_EABI_TOOLS() - enable the -PowerPC toolchain for the directory where it is called - -It contains the following variables: ECOS_DEFINITIONS -ECOSCONFIG_EXECUTABLE ECOS_CONFIG_FILE - defaults to ecos.ecc, if your -eCos configuration file has a different name, adjust this variable for -internal use only: + +``ECOS_ADD_INCLUDE_DIRECTORIES()`` + add the eCos include dirs +``ECOS_ADD_EXECUTABLE(name source1 ... sourceN )`` + create an eCos executable +``ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN )`` + adjusts the path of the source files and puts the result into ``VAR`` + +Macros for selecting the toolchain: + +``ECOS_USE_ARM_ELF_TOOLS()`` + enable the ARM ELF toolchain for the directory where it is called +``ECOS_USE_I386_ELF_TOOLS()`` + enable the i386 ELF toolchain for the directory where it is called +``ECOS_USE_PPC_EABI_TOOLS()`` + enable the PowerPC toolchain for the directory where it is called + +It contains the following variables: + +``ECOS_DEFINITIONS`` + +``ECOSCONFIG_EXECUTABLE`` + +``ECOS_CONFIG_FILE`` + defaults to ecos.ecc, if your eCos configuration file has a different name, adjust this variable for internal use only: :: diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e427beb..8cb8ed9 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 28) -set(CMake_VERSION_PATCH 20231023) +set(CMake_VERSION_PATCH 20231107) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index c9c069c..b7b6785 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -5,6 +5,8 @@ #include <cstring> #include <map> #include <ostream> +#include <unordered_map> +#include <unordered_set> #include <utility> #include <vector> @@ -17,6 +19,121 @@ #include "cmValue.h" #include "cmWorkingDirectory.h" +enum class DeduplicateStatus +{ + Skip, + Add, + Error +}; + +/** + * @class cmCPackArchiveGenerator::Deduplicator + * @brief A utility class for deduplicating files, folders, and symlinks. + * + * This class is responsible for identifying duplicate files, folders, and + * symlinks when generating an archive. It keeps track of the paths that have + * been processed and helps in deciding whether a new path should be added, + * skipped, or flagged as an error. + */ +class cmCPackArchiveGenerator::Deduplicator +{ +private: + /** + * @brief Compares a file with already processed files. + * + * @param path The path of the file to compare. + * @param localTopLevel The top-level directory for the file. + * @return DeduplicateStatus indicating whether to add, skip, or flag an + * error for the file. + */ + DeduplicateStatus CompareFile(const std::string& path, + const std::string& localTopLevel) + { + auto fileItr = this->Files.find(path); + if (fileItr != this->Files.end()) { + return cmSystemTools::FilesDiffer(path, fileItr->second) + ? DeduplicateStatus::Error + : DeduplicateStatus::Skip; + } + + this->Files[path] = cmStrCat(localTopLevel, "/", path); + return DeduplicateStatus::Add; + } + + /** + * @brief Compares a folder with already processed folders. + * + * @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) + { + if (this->Folders.find(path) != this->Folders.end()) { + return DeduplicateStatus::Skip; + } + + this->Folders.emplace(path); + return DeduplicateStatus::Add; + } + + /** + * @brief Compares a symlink with already processed symlinks. + * + * @param path The path of the symlink to compare. + * @return DeduplicateStatus indicating whether to add, skip, or flag an + * error for the symlink. + */ + DeduplicateStatus CompareSymlink(const std::string& path) + { + auto symlinkItr = this->Symlink.find(path); + std::string symlinkValue; + auto status = cmSystemTools::ReadSymlink(path, symlinkValue); + if (!status.IsSuccess()) { + return DeduplicateStatus::Error; + } + + if (symlinkItr != this->Symlink.end()) { + return symlinkValue == symlinkItr->second ? DeduplicateStatus::Skip + : DeduplicateStatus::Error; + } + + this->Symlink[path] = symlinkValue; + return DeduplicateStatus::Add; + } + +public: + /** + * @brief Determines the deduplication status of a given path. + * + * This method identifies whether the given path is a file, folder, or + * symlink and then delegates to the appropriate comparison method. + * + * @param path The path to check for deduplication. + * @param localTopLevel The top-level directory for the path. + * @return DeduplicateStatus indicating the action to take for the given + * path. + */ + DeduplicateStatus IsDeduplicate(const std::string& path, + const std::string& localTopLevel) + { + DeduplicateStatus status; + if (cmSystemTools::FileIsDirectory(path)) { + status = this->CompareFolder(path); + } else if (cmSystemTools::FileIsSymlink(path)) { + status = this->CompareSymlink(path); + } else { + status = this->CompareFile(path, localTopLevel); + } + + return status; + } + +private: + std::unordered_map<std::string, std::string> Symlink; + std::unordered_set<std::string> Folders; + std::unordered_map<std::string, std::string> Files; +}; + cmCPackGenerator* cmCPackArchiveGenerator::Create7ZGenerator() { return new cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "7zip", @@ -110,7 +227,8 @@ int cmCPackArchiveGenerator::InitializeInternal() } int cmCPackArchiveGenerator::addOneComponentToArchive( - cmArchiveWrite& archive, cmCPackComponent* component) + cmArchiveWrite& archive, cmCPackComponent* component, + Deduplicator* deduplicator) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, " - packaging component: " << component->Name << std::endl); @@ -139,8 +257,25 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( } for (std::string const& file : component->Files) { std::string rp = filePrefix + file; - cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file: " << rp << std::endl); - archive.Add(rp, 0, nullptr, false); + + DeduplicateStatus status = DeduplicateStatus::Add; + if (deduplicator != nullptr) { + status = deduplicator->IsDeduplicate(rp, localToplevel); + } + + if (deduplicator == nullptr || status == DeduplicateStatus::Add) { + cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file: " << rp << std::endl); + archive.Add(rp, 0, nullptr, false); + } else if (status == DeduplicateStatus::Error) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "ERROR The data in files with the " + "same filename is different."); + return 0; + } else { + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Passing file: " << rp << std::endl); + } + if (!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: " << archive.GetError() @@ -197,6 +332,8 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) std::string packageFileName = std::string(this->toplevel) + "/" + this->GetArchiveComponentFileName(compG.first, true); + Deduplicator deduplicator; + // open a block in order to automatically close archive // at the end of the block { @@ -204,7 +341,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) // now iterate over the component of this group for (cmCPackComponent* comp : (compG.second).Components) { // Add the files of this component to the archive - this->addOneComponentToArchive(archive, comp); + this->addOneComponentToArchive(archive, comp, &deduplicator); } } // add the generated package to package file names list @@ -231,7 +368,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) { DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive); // Add the files of this component to the archive - this->addOneComponentToArchive(archive, &(comp.second)); + this->addOneComponentToArchive(archive, &(comp.second), nullptr); } // add the generated package to package file names list this->packageFileNames.push_back(std::move(packageFileName)); @@ -252,7 +389,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) { DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive); // Add the files of this component to the archive - this->addOneComponentToArchive(archive, &(comp.second)); + this->addOneComponentToArchive(archive, &(comp.second), nullptr); } // add the generated package to package file names list this->packageFileNames.push_back(std::move(packageFileName)); @@ -282,10 +419,12 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne() << std::endl); DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0], archive); + Deduplicator deduplicator; + // The ALL COMPONENTS in ONE package case for (auto& comp : this->Components) { // Add the files of this component to the archive - this->addOneComponentToArchive(archive, &(comp.second)); + this->addOneComponentToArchive(archive, &(comp.second), &deduplicator); } // archive goes out of scope so it will finalized and closed. diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index 8a9bbc6..b8a1afa 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -47,6 +47,8 @@ private: std::string GetArchiveComponentFileName(const std::string& component, bool isGroupName); + class Deduplicator; + protected: int InitializeInternal() override; /** @@ -54,9 +56,11 @@ protected: * to the provided (already opened) archive. * @param[in,out] archive the archive object * @param[in] component the component whose file will be added to archive + * @param[in] deduplicator file deduplicator utility. */ int addOneComponentToArchive(cmArchiveWrite& archive, - cmCPackComponent* component); + cmCPackComponent* component, + Deduplicator* deduplicator); /** * The main package file method. diff --git a/Source/CPack/cmCPackInnoSetupGenerator.cxx b/Source/CPack/cmCPackInnoSetupGenerator.cxx index b8bf070..bf90b06 100644 --- a/Source/CPack/cmCPackInnoSetupGenerator.cxx +++ b/Source/CPack/cmCPackInnoSetupGenerator.cxx @@ -579,8 +579,9 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() bool cmCPackInnoSetupGenerator::ProcessComponents() { - codeIncludes.push_back("{ The following lines are required by CPack because " - "this script uses components }"); + codeIncludes.emplace_back( + "{ The following lines are required by CPack because " + "this script uses components }"); // Installation types std::vector<cmCPackInstallationType*> types(InstallationTypes.size()); @@ -607,7 +608,7 @@ bool cmCPackInnoSetupGenerator::ProcessComponents() "\"{code:CPackGetCustomInstallationMessage}\""; customTypeParams["Flags"] = "iscustom"; - allTypes.push_back("custom"); + allTypes.emplace_back("custom"); typeInstructions.push_back(ISKeyValueLine(customTypeParams)); // Components @@ -633,6 +634,7 @@ bool cmCPackInnoSetupGenerator::ProcessComponents() } else if (!component->InstallationTypes.empty()) { std::vector<std::string> installationTypes; + installationTypes.reserve(component->InstallationTypes.size()); for (cmCPackInstallationType* j : component->InstallationTypes) { installationTypes.push_back(j->Name); } diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h index 2ab2f8e..347b0f7 100644 --- a/Source/CPack/cmCPackLog.h +++ b/Source/CPack/cmCPackLog.h @@ -29,7 +29,7 @@ public: cmCPackLog(const cmCPackLog&) = delete; cmCPackLog& operator=(const cmCPackLog&) = delete; - enum __log_tags + enum cm_log_tags { NOTAG = 0, LOG_OUTPUT = 0x1, diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 36df344..87081f0 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -374,7 +374,7 @@ bool cmCTestBZR::UpdateImpl() // Use "bzr pull" to update the working tree. std::vector<std::string> bzr_update; bzr_update.push_back(this->CommandLineTool); - bzr_update.push_back("pull"); + bzr_update.emplace_back("pull"); cm::append(bzr_update, args); diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index ef95b25..badd43e 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -92,8 +92,8 @@ bool cmCTestCVS::UpdateImpl() // Run "cvs update" to update the work tree. std::vector<std::string> cvs_update; cvs_update.push_back(this->CommandLineTool); - cvs_update.push_back("-z3"); - cvs_update.push_back("update"); + cvs_update.emplace_back("-z3"); + cvs_update.emplace_back("update"); cm::append(cvs_update, args); UpdateParser out(this, "up-out> "); diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index ca8659e..984c837 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -159,7 +159,7 @@ bool cmCTestGIT::UpdateByFetchAndReset() // Use "git fetch" to get remote commits. std::vector<std::string> git_fetch; git_fetch.push_back(git); - git_fetch.push_back("fetch"); + git_fetch.emplace_back("fetch"); // Add user-specified update options. std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions"); diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index e1a945d..3d56be0 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -137,9 +137,9 @@ bool cmCTestHG::UpdateImpl() // TODO: if(this->CTest->GetTestModel() == cmCTest::NIGHTLY) std::vector<std::string> hg_update; - hg_update.push_back(this->CommandLineTool.c_str()); - hg_update.push_back("update"); - hg_update.push_back("-v"); + hg_update.emplace_back(this->CommandLineTool); + hg_update.emplace_back("update"); + hg_update.emplace_back("-v"); // Add user-specified update options. std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions"); diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 5d71b84..20bd0ec 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -151,9 +151,9 @@ cmCTestP4::User cmCTestP4::GetUserData(const std::string& username) if (it == this->Users.end()) { std::vector<std::string> p4_users; this->SetP4Options(p4_users); - p4_users.push_back("users"); - p4_users.push_back("-m"); - p4_users.push_back("1"); + p4_users.emplace_back("users"); + p4_users.emplace_back("-m"); + p4_users.emplace_back("1"); p4_users.push_back(username); UserParser out(this, "users-out> "); @@ -335,10 +335,10 @@ std::string cmCTestP4::GetWorkingRevision() std::vector<std::string> p4_identify; this->SetP4Options(p4_identify); - p4_identify.push_back("changes"); - p4_identify.push_back("-m"); - p4_identify.push_back("1"); - p4_identify.push_back("-t"); + p4_identify.emplace_back("changes"); + p4_identify.emplace_back("-m"); + p4_identify.emplace_back("1"); + p4_identify.emplace_back("-t"); std::string source = this->SourceDirectory + "/...#have"; p4_identify.push_back(source); @@ -403,7 +403,7 @@ bool cmCTestP4::LoadRevisions() .append(",") .append(this->NewRevision); - p4_changes.push_back("changes"); + p4_changes.emplace_back("changes"); p4_changes.push_back(range); ChangesParser out(this, "p4_changes-out> "); @@ -420,8 +420,8 @@ bool cmCTestP4::LoadRevisions() std::vector<std::string> p4_describe; for (std::string const& i : cmReverseRange(this->ChangeLists)) { this->SetP4Options(p4_describe); - p4_describe.push_back("describe"); - p4_describe.push_back("-s"); + p4_describe.emplace_back("describe"); + p4_describe.emplace_back("-s"); p4_describe.push_back(i); DescribeParser outDescribe(this, "p4_describe-out> "); @@ -436,10 +436,10 @@ bool cmCTestP4::LoadModifications() std::vector<std::string> p4_diff; this->SetP4Options(p4_diff); - p4_diff.push_back("diff"); + p4_diff.emplace_back("diff"); // Ideally we would use -Od but not all clients support it - p4_diff.push_back("-dn"); + p4_diff.emplace_back("-dn"); std::string source = this->SourceDirectory + "/..."; p4_diff.push_back(source); @@ -480,7 +480,7 @@ bool cmCTestP4::UpdateImpl() std::vector<std::string> p4_sync; this->SetP4Options(p4_sync); - p4_sync.push_back("sync"); + p4_sync.emplace_back("sync"); // Get user-specified update options. std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions"); diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 14bc510..fc7051c 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -34,7 +34,7 @@ cmCTestSVN::~cmCTestSVN() = default; void cmCTestSVN::CleanupImpl() { std::vector<std::string> svn_cleanup; - svn_cleanup.push_back("cleanup"); + svn_cleanup.emplace_back("cleanup"); OutputLogger out(this->Log, "cleanup-out> "); OutputLogger err(this->Log, "cleanup-err> "); this->RunSVNCommand(svn_cleanup, &out, &err); @@ -89,7 +89,7 @@ std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo) { // Run "svn info" to get the repository info from the work tree. std::vector<std::string> svn_info; - svn_info.push_back("info"); + svn_info.emplace_back("info"); svn_info.push_back(svninfo.LocalPath); std::string rev; InfoParser out(this, "info-out> ", rev, svninfo); @@ -252,7 +252,7 @@ bool cmCTestSVN::UpdateImpl() } std::vector<std::string> svn_update; - svn_update.push_back("update"); + svn_update.emplace_back("update"); cm::append(svn_update, args); UpdateParser out(this, "up-out> "); @@ -270,7 +270,7 @@ bool cmCTestSVN::RunSVNCommand(std::vector<std::string> const& parameters, std::vector<std::string> args; args.push_back(this->CommandLineTool); cm::append(args, parameters); - args.push_back("--non-interactive"); + args.emplace_back("--non-interactive"); std::string userOptions = this->CTest->GetCTestConfiguration("SVNOptions"); @@ -388,11 +388,11 @@ bool cmCTestSVN::LoadRevisions(SVNInfo& svninfo) // Run "svn log" to get all global revisions of interest. std::vector<std::string> svn_log; - svn_log.push_back("log"); - svn_log.push_back("--xml"); - svn_log.push_back("-v"); - svn_log.push_back(revs.c_str()); - svn_log.push_back(svninfo.LocalPath.c_str()); + svn_log.emplace_back("log"); + svn_log.emplace_back("--xml"); + svn_log.emplace_back("-v"); + svn_log.emplace_back(revs); + svn_log.emplace_back(svninfo.LocalPath); LogParser out(this, "log-out> ", svninfo); OutputLogger err(this->Log, "log-err> "); return this->RunSVNCommand(svn_log, &out, &err); @@ -467,7 +467,7 @@ bool cmCTestSVN::LoadModifications() { // Run "svn status" which reports local modifications. std::vector<std::string> svn_status; - svn_status.push_back("status"); + svn_status.emplace_back("status"); StatusParser out(this, "status-out> "); OutputLogger err(this->Log, "status-err> "); this->RunSVNCommand(svn_status, &out, &err); @@ -529,7 +529,7 @@ bool cmCTestSVN::LoadRepositories() // Run "svn status" to get the list of external repositories std::vector<std::string> svn_status; - svn_status.push_back("status"); + svn_status.emplace_back("status"); ExternalParser out(this, "external-out> "); OutputLogger err(this->Log, "external-err> "); return this->RunSVNCommand(svn_status, &out, &err); diff --git a/Source/Checks/Curses/CheckCurses.c b/Source/Checks/Curses/CheckCurses.c index 7d827e6..3264fa0 100644 --- a/Source/Checks/Curses/CheckCurses.c +++ b/Source/Checks/Curses/CheckCurses.c @@ -8,7 +8,7 @@ # include <curses.h> #endif -int main() +int main(void) { curses_version(); return 0; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index b7232f3..6e684a3 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2257,11 +2257,6 @@ bool cmCTest::ProgressOutputSupportedByConsole() bool cmCTest::ColoredOutputSupportedByConsole() { -#if defined(_WIN32) - // Not supported on Windows - return false; -#else - // On UNIX we need a non-dumb tty. std::string clicolor_force; if (cmSystemTools::GetEnv("CLICOLOR_FORCE", clicolor_force) && !clicolor_force.empty() && clicolor_force != "0") { @@ -2271,6 +2266,11 @@ bool cmCTest::ColoredOutputSupportedByConsole() if (cmSystemTools::GetEnv("CLICOLOR", clicolor) && clicolor == "0") { return false; } +#if defined(_WIN32) + // Not supported on Windows + return false; +#else + // On UNIX we need a non-dumb tty. return ConsoleIsNotDumb(); #endif } @@ -3736,12 +3736,7 @@ void cmCTest::Log(int logType, const char* file, int line, const char* msg, std::string cmCTest::GetColorCode(Color color) const { if (this->Impl->OutputColorCode) { -#if defined(_WIN32) - // Not supported on Windows - static_cast<void>(color); -#else return "\033[0;" + std::to_string(static_cast<int>(color)) + "m"; -#endif } return ""; diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 2ee4f47..91f7691 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -219,9 +219,11 @@ void GetScriptingCommands(cmState* state) state->AddDisallowedCommand( "use_mangled_mesa", cmUseMangledMesaCommand, cmPolicies::CMP0030, "The use_mangled_mesa command should not be called; see CMP0030."); - state->AddDisallowedCommand( - "exec_program", cmExecProgramCommand, cmPolicies::CMP0153, - "The exec_program command should not be called; see CMP0153."); + state->AddDisallowedCommand("exec_program", cmExecProgramCommand, + cmPolicies::CMP0153, + "The exec_program command should not be called; " + "see CMP0153. Use execute_process() instead.", + "Use execute_process() instead."); #endif } diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 7394d86..596572b 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -27,6 +27,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmRange.h" +#include "cmSourceFile.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmTarget.h" @@ -320,6 +321,9 @@ cmComputeLinkDepends::Compute() // Follow the link dependencies of the target to be linked. this->AddDirectLinkEntries(); + // Add dependencies on targets named by $<TARGET_OBJECTS:...> sources. + this->AddTargetObjectEntries(); + // Complete the breadth-first search of dependencies. while (!this->BFSQueue.empty()) { // Get the next entry. @@ -513,6 +517,7 @@ void cmComputeLinkDepends::AddLinkObject(cmLinkItem const& item) LinkEntry& entry = this->EntryList[index]; entry.Item = BT<std::string>(item.AsStr(), item.Backtrace); entry.Kind = LinkEntry::Object; + entry.Target = item.Target; // Record explicitly linked object files separately. this->ObjectEntries.emplace_back(index); @@ -701,6 +706,21 @@ void cmComputeLinkDepends::AddDirectLinkEntries() } } +void cmComputeLinkDepends::AddTargetObjectEntries() +{ + std::vector<cmSourceFile const*> externalObjects; + this->Target->GetExternalObjects(externalObjects, this->Config); + for (auto const* externalObject : externalObjects) { + std::string const& objLib = externalObject->GetObjectLibrary(); + if (objLib.empty()) { + continue; + } + cmLinkItem const& objItem = + this->Target->ResolveLinkItem(BT<std::string>(objLib)); + this->AddLinkObject(objItem); + } +} + template <typename T> void cmComputeLinkDepends::AddLinkEntries(size_t depender_index, std::vector<T> const& libs) diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 22c4e2a..63c289c 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -100,6 +100,7 @@ private: void AddLinkObject(cmLinkItem const& item); void AddVarLinkEntries(size_t depender_index, const char* value); void AddDirectLinkEntries(); + void AddTargetObjectEntries(); template <typename T> void AddLinkEntries(size_t depender_index, std::vector<T> const& libs); void AddLinkObjects(std::vector<cmLinkItem> const& objs); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 4cf3042..bd7ebed 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1252,7 +1252,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) this->AddFullItem(entry); this->AddLibraryRuntimeInfo(item.Value); } - } else { + } else if (entry.Kind != cmComputeLinkDepends::LinkEntry::Object) { // This is a library or option specified by the user. this->AddUserItem(entry, true); } diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 6f9f541..eba4c57 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -33,6 +33,9 @@ auto const keyCOMMAND = "COMMAND"_s; auto const keyDEFINED = "DEFINED"_s; auto const keyEQUAL = "EQUAL"_s; auto const keyEXISTS = "EXISTS"_s; +auto const keyIS_READABLE = "IS_READABLE"_s; +auto const keyIS_WRITABLE = "IS_WRITABLE"_s; +auto const keyIS_EXECUTABLE = "IS_EXECUTABLE"_s; auto const keyGREATER = "GREATER"_s; auto const keyGREATER_EQUAL = "GREATER_EQUAL"_s; auto const keyIN_LIST = "IN_LIST"_s; @@ -568,6 +571,24 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&, newArgs.ReduceOneArg(cmSystemTools::FileExists(args.next->GetValue()), args); } + // check if a file is readable + else if (this->IsKeyword(keyIS_READABLE, *args.current)) { + newArgs.ReduceOneArg(cmSystemTools::TestFileAccess( + args.next->GetValue(), cmsys::TEST_FILE_READ), + args); + } + // check if a file is writable + else if (this->IsKeyword(keyIS_WRITABLE, *args.current)) { + newArgs.ReduceOneArg(cmSystemTools::TestFileAccess( + args.next->GetValue(), cmsys::TEST_FILE_WRITE), + args); + } + // check if a file is executable + else if (this->IsKeyword(keyIS_EXECUTABLE, *args.current)) { + newArgs.ReduceOneArg(cmSystemTools::TestFileAccess( + args.next->GetValue(), cmsys::TEST_FILE_EXECUTE), + args); + } // does a directory with this name exist else if (this->IsKeyword(keyIS_DIRECTORY, *args.current)) { newArgs.ReduceOneArg( diff --git a/Source/cmDebuggerStackFrame.h b/Source/cmDebuggerStackFrame.h index dc3b2ab..f4e6612 100644 --- a/Source/cmDebuggerStackFrame.h +++ b/Source/cmDebuggerStackFrame.h @@ -28,6 +28,10 @@ public: std::string const& GetFileName() const noexcept { return this->FileName; } int64_t GetLine() const noexcept; cmMakefile* GetMakefile() const noexcept { return this->Makefile; } + cmListFileFunction const& GetFunction() const noexcept + { + return this->Function; + } }; } // namespace cmDebugger diff --git a/Source/cmDebuggerThread.cxx b/Source/cmDebuggerThread.cxx index fd52f5a..f7a1778 100644 --- a/Source/cmDebuggerThread.cxx +++ b/Source/cmDebuggerThread.cxx @@ -13,6 +13,7 @@ #include "cmDebuggerVariables.h" #include "cmDebuggerVariablesHelper.h" #include "cmDebuggerVariablesManager.h" +#include "cmListFileCache.h" namespace cmDebugger { @@ -135,8 +136,7 @@ dap::StackTraceResponse GetStackTraceResponse( #endif stackFrame.line = thread->Frames[i]->GetLine(); stackFrame.column = 1; - stackFrame.name = thread->Frames[i]->GetFileName() + " Line " + - std::to_string(stackFrame.line); + stackFrame.name = thread->Frames[i]->GetFunction().OriginalName(); stackFrame.id = thread->Frames[i]->GetId(); stackFrame.source = source; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f7a6a4e..d24867f 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -9259,7 +9259,8 @@ void cmGeneratorTarget::CheckCxxModuleStatus(std::string const& config) const // If the generator doesn't support modules at all, error that we have // sources that require the support. - if (!this->GetGlobalGenerator()->CheckCxxModuleSupport()) { + if (!this->GetGlobalGenerator()->CheckCxxModuleSupport( + cmGlobalGenerator::CxxModuleSupportQuery::Expected)) { this->Makefile->IssueMessage( MessageType::FATAL_ERROR, cmStrCat( @@ -9317,7 +9318,8 @@ bool cmGeneratorTarget::NeedCxxModuleSupport(std::string const& lang, return false; } return this->HaveCxxModuleSupport(config) == Cxx20SupportLevel::Supported && - this->GetGlobalGenerator()->CheckCxxModuleSupport(); + this->GetGlobalGenerator()->CheckCxxModuleSupport( + cmGlobalGenerator::CxxModuleSupportQuery::Inspect); } bool cmGeneratorTarget::NeedDyndep(std::string const& lang, @@ -9361,14 +9363,20 @@ bool cmGeneratorTarget::NeedDyndepForSource(std::string const& lang, return true; } + bool haveRule = false; switch (this->HaveCxxModuleSupport(config)) { case Cxx20SupportLevel::MissingCxx: case Cxx20SupportLevel::NoCxx20: return false; case Cxx20SupportLevel::MissingRule: + break; case Cxx20SupportLevel::Supported: + haveRule = true; break; } + bool haveGeneratorSupport = + this->GetGlobalGenerator()->CheckCxxModuleSupport( + cmGlobalGenerator::CxxModuleSupportQuery::Inspect); auto const sfProp = sf->GetProperty("CXX_SCAN_FOR_MODULES"); if (sfProp.IsSet()) { return sfProp.IsOn(); @@ -9388,8 +9396,9 @@ bool cmGeneratorTarget::NeedDyndepForSource(std::string const& lang, case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_IF_USED: case cmPolicies::NEW: - // The NEW behavior is to scan the source. - policyAnswer = true; + // The NEW behavior is to scan the source if the compiler supports + // scanning and the generator supports it. + policyAnswer = haveRule && haveGeneratorSupport; break; } return policyAnswer; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index e798d3e..ef0f40f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -874,7 +874,11 @@ void cmGlobalGenerator::EnableLanguage( noCompiler << "The " << compilerName << ":\n" " " << *compilerFile << "\n" - "is not a full path and was not found in the PATH.\n" + "is not a full path and was not found in the PATH." +#ifdef _WIN32 + " Perhaps the extension is missing?" +#endif + "\n" ; /* clang-format on */ } else if (!cmSystemTools::FileExists(*compilerFile)) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 6d29dc1..aa54f69 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -156,7 +156,17 @@ public: virtual bool InspectConfigTypeVariables() { return true; } - virtual bool CheckCxxModuleSupport() { return false; } + enum class CxxModuleSupportQuery + { + // Support is expected at the call site. + Expected, + // The call site is querying for support and handles problems by itself. + Inspect, + }; + virtual bool CheckCxxModuleSupport(CxxModuleSupportQuery /*query*/) + { + return false; + } virtual bool IsGNUMakeJobServerAware() const { return false; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 02f900c..9fac513 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -897,13 +897,14 @@ bool cmGlobalNinjaGenerator::CheckLanguages( return true; } -bool cmGlobalNinjaGenerator::CheckCxxModuleSupport() +bool cmGlobalNinjaGenerator::CheckCxxModuleSupport(CxxModuleSupportQuery query) { if (this->NinjaSupportsDyndepsCxx) { return true; } bool const diagnose = !this->DiagnosedCxxModuleNinjaSupport && - !this->CMakeInstance->GetIsInTryCompile(); + !this->CMakeInstance->GetIsInTryCompile() && + query == CxxModuleSupportQuery::Expected; if (diagnose) { std::ostringstream e; /* clang-format off */ diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index d731b16..8f6c808 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -475,7 +475,7 @@ public: bool IsSingleConfigUtility(cmGeneratorTarget const* target) const; - bool CheckCxxModuleSupport() override; + bool CheckCxxModuleSupport(CxxModuleSupportQuery query) override; protected: void Generate() override; diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index 8f0345f..49643ea 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -48,7 +48,7 @@ public: const char* GetAndroidApplicationTypeRevision() const override; - bool CheckCxxModuleSupport() override + bool CheckCxxModuleSupport(CxxModuleSupportQuery /*query*/) override { return this->SupportsCxxModuleDyndep(); } diff --git a/Source/cmJSONState.cxx b/Source/cmJSONState.cxx index 1abdaa6..5c44fba 100644 --- a/Source/cmJSONState.cxx +++ b/Source/cmJSONState.cxx @@ -45,7 +45,7 @@ cmJSONState::cmJSONState(const std::string& filename, Json::Value* root) void cmJSONState::AddError(std::string const& errMsg) { - this->errors.push_back(Error(errMsg)); + this->errors.emplace_back(errMsg); } void cmJSONState::AddErrorAtValue(std::string const& errMsg, @@ -65,7 +65,7 @@ void cmJSONState::AddErrorAtOffset(std::string const& errMsg, this->AddError(errMsg); } else { Location loc = LocateInDocument(offset); - this->errors.push_back(Error(loc, errMsg)); + this->errors.emplace_back(loc, errMsg); } } @@ -118,7 +118,7 @@ const Json::Value* cmJSONState::value_after(std::string const& k) void cmJSONState::push_stack(std::string const& k, const Json::Value* value) { - this->parseStack.push_back(JsonPair(k, value)); + this->parseStack.emplace_back(k, value); } void cmJSONState::pop_stack() diff --git a/Source/cmLinkItemGraphVisitor.cxx b/Source/cmLinkItemGraphVisitor.cxx index 0ad846b..a63b794 100644 --- a/Source/cmLinkItemGraphVisitor.cxx +++ b/Source/cmLinkItemGraphVisitor.cxx @@ -82,7 +82,7 @@ bool cmLinkItemGraphVisitor::ItemVisited(cmLinkItem const& item) bool cmLinkItemGraphVisitor::LinkVisited(cmLinkItem const& depender, cmLinkItem const& dependee) { - auto const link = std::make_pair<>(depender.AsStr(), dependee.AsStr()); + auto const link = std::make_pair(depender.AsStr(), dependee.AsStr()); bool const linkVisited = this->VisitedLinks.find(link) != this->VisitedLinks.cend(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 76e36ab..be18c29 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3063,8 +3063,17 @@ cmLocalGenerator::AddUnityFilesModeAuto( chunk = std::min(itemsLeft, batchSize); - std::string filename = cmStrCat(filename_base, "unity_", batch, - (lang == "C") ? "_c.c" : "_cxx.cxx"); + std::string extension; + if (lang == "C") { + extension = "_c.c"; + } else if (lang == "CXX") { + extension = "_cxx.cxx"; + } else if (lang == "OBJC") { + extension = "_m.m"; + } else if (lang == "OBJCXX") { + extension = "_mm.mm"; + } + std::string filename = cmStrCat(filename_base, "unity_", batch, extension); auto const begin = filtered_sources.begin() + batch * batchSize; auto const end = begin + chunk; unity_files.emplace_back(this->WriteUnitySource( @@ -3155,7 +3164,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target) cmValue afterInclude = target->GetProperty("UNITY_BUILD_CODE_AFTER_INCLUDE"); cmValue unityMode = target->GetProperty("UNITY_BUILD_MODE"); - for (std::string lang : { "C", "CXX" }) { + for (std::string lang : { "C", "CXX", "OBJC", "OBJCXX" }) { std::vector<UnityBatchedSource> filtered_sources; std::copy_if(unitySources.begin(), unitySources.end(), std::back_inserter(filtered_sources), diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 40d769d..9ed422d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1215,8 +1215,8 @@ cmTarget* cmMakefile::AddCustomCommandToTarget( // Dispatch command creation to allow generator expressions in outputs. this->AddGeneratorAction( std::move(cc), - [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, - std::unique_ptr<cmCustomCommand> tcc) { + [this, t, type](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, + std::unique_ptr<cmCustomCommand> tcc) { BacktraceGuard guard(this->Backtrace, lfbt); tcc->SetBacktrace(lfbt); detail::AddCustomCommandToTarget(lg, cmCommandOrigin::Project, t, type, @@ -1254,8 +1254,9 @@ void cmMakefile::AddCustomCommandToOutput( // Dispatch command creation to allow generator expressions in outputs. this->AddGeneratorAction( std::move(cc), - [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, - std::unique_ptr<cmCustomCommand> tcc) { + [this, replace, callback](cmLocalGenerator& lg, + const cmListFileBacktrace& lfbt, + std::unique_ptr<cmCustomCommand> tcc) { BacktraceGuard guard(this->Backtrace, lfbt); tcc->SetBacktrace(lfbt); cmSourceFile* sf = detail::AddCustomCommandToOutput( @@ -1341,7 +1342,8 @@ void cmMakefile::AppendCustomCommandToOutput( if (this->ValidateCustomCommand(commandLines)) { // Dispatch command creation to allow generator expressions in outputs. this->AddGeneratorAction( - [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) { + [this, output, depends, implicit_depends, + commandLines](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) { BacktraceGuard guard(this->Backtrace, lfbt); detail::AppendCustomCommandToOutput(lg, lfbt, output, depends, implicit_depends, commandLines); @@ -1372,8 +1374,8 @@ cmTarget* cmMakefile::AddUtilityCommand(const std::string& utilityName, // Dispatch command creation to allow generator expressions in outputs. this->AddGeneratorAction( std::move(cc), - [=](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, - std::unique_ptr<cmCustomCommand> tcc) { + [this, target](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, + std::unique_ptr<cmCustomCommand> tcc) { BacktraceGuard guard(this->Backtrace, lfbt); tcc->SetBacktrace(lfbt); detail::AddUtilityCommand(lg, cmCommandOrigin::Project, target, diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 3f76cf4..5a674e7 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1257,8 +1257,6 @@ cmNinjaBuild GetScanBuildStatement(const std::string& ruleName, { cmNinjaBuild scanBuild(ruleName); - scanBuild.RspFile = "$out.rsp"; - if (compilePP) { // Move compilation dependencies to the scan/preprocessing build statement. std::swap(scanBuild.ExplicitDeps, objBuild.ExplicitDeps); @@ -1299,6 +1297,7 @@ cmNinjaBuild GetScanBuildStatement(const std::string& ruleName, // Tell dependency scanner where to store dyndep intermediate results. std::string ddiFileName = cmStrCat(objectFileName, ".ddi"); scanBuild.Variables["DYNDEP_INTERMEDIATE_FILE"] = ddiFileName; + scanBuild.RspFile = cmStrCat(ddiFileName, ".rsp"); // Outputs of the scan/preprocessor build statement. if (compilePP) { diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 1ea2ce2..8838de4 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -470,10 +470,10 @@ class cmMakefile; POLICY, CMP0154, \ "Generated files are private by default in targets using file sets.", 3, \ 28, 0, cmPolicies::WARN) \ - SELECT( \ - POLICY, CMP0155, \ - "C++ sources in targets with at least C++20 are scanned for imports", 3, \ - 28, 0, cmPolicies::WARN) + SELECT(POLICY, CMP0155, \ + "C++ sources in targets with at least C++20 are scanned for " \ + "imports when supported.", \ + 3, 28, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index ece657d..50110ed 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -190,7 +190,7 @@ public: { public: // -- Parse Cache - std::atomic<bool> ParseCacheChanged = ATOMIC_VAR_INIT(false); + std::atomic<bool> ParseCacheChanged{ false }; cmFileTime ParseCacheTime; ParseCacheT ParseCache; @@ -583,7 +583,7 @@ private: std::string SettingsStringMoc_; std::string SettingsStringUic_; // -- Worker thread pool - std::atomic<bool> JobError_ = ATOMIC_VAR_INIT(false); + std::atomic<bool> JobError_{ false }; cmWorkerPool WorkerPool_; // -- Concurrent processing mutable std::mutex CMakeLibMutex_; diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 4b1685f..bb92856 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -280,8 +280,11 @@ static bool processTree(cmMakefile& mf, ParsedArguments& parsedArguments, ? "" : parsedArguments[kPrefixOptionName].front(); - std::vector<std::string> files = parsedArguments[kFilesOptionName]; - if (files.empty()) { + std::vector<std::string> files; + auto filesArgIt = parsedArguments.find(kFilesOptionName); + if (filesArgIt != parsedArguments.end()) { + files = filesArgIt->second; + } else { const std::vector<std::unique_ptr<cmSourceFile>>& srcFiles = mf.GetSourceFiles(); for (const auto& srcFile : srcFiles) { diff --git a/Source/cmState.cxx b/Source/cmState.cxx index d41e8e5..8ae2166 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -447,17 +447,23 @@ void cmState::AddFlowControlCommand(std::string const& name, void cmState::AddDisallowedCommand(std::string const& name, BuiltinCommand command, cmPolicies::PolicyID policy, - const char* message) + const char* message, + const char* additionalWarning) { this->AddBuiltinCommand( name, - [command, policy, message](const std::vector<cmListFileArgument>& args, - cmExecutionStatus& status) -> bool { + [command, policy, message, + additionalWarning](const std::vector<cmListFileArgument>& args, + cmExecutionStatus& status) -> bool { cmMakefile& mf = status.GetMakefile(); switch (mf.GetPolicyStatus(policy)) { - case cmPolicies::WARN: - mf.IssueMessage(MessageType::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(policy)); + case cmPolicies::WARN: { + std::string warning = cmPolicies::GetPolicyWarning(policy); + if (additionalWarning) { + warning = cmStrCat(warning, '\n', additionalWarning); + } + mf.IssueMessage(MessageType::AUTHOR_WARNING, warning); + } CM_FALLTHROUGH; case cmPolicies::OLD: break; diff --git a/Source/cmState.h b/Source/cmState.h index b79f3e6..702b06f 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -183,7 +183,8 @@ public: 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); + cmPolicies::PolicyID policy, const char* message, + const char* additionalWarning = nullptr); void AddUnexpectedCommand(std::string const& name, const char* error); void AddUnexpectedFlowControlCommand(std::string const& name, const char* error); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index fe421ba..f606c22 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -576,7 +576,9 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command, cmDuration timeout, Encoding encoding) { cmUVProcessChainBuilder builder; - builder.AddCommand(command); + builder + .SetExternalStream(cmUVProcessChainBuilder::Stream_INPUT, cm_fileno(stdin)) + .AddCommand(command); if (dir) { builder.SetWorkingDirectory(dir); } diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index 72805d3..5310166 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -285,7 +285,8 @@ int main() return exit_code; // compile rc file with rc.exe - return process(srcfilename, "", objfile, prefix, binpath + " " + rest, + std::string rc = cmStrCat('"', binpath, '"'); + return process(srcfilename, "", objfile, prefix, cmStrCat(rc, ' ', rest), std::string(), true); } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 43a945f..93b0086 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -203,11 +203,16 @@ bool cmTarFilesFrom(std::string const& file, std::vector<std::string>& files) void cmCatFile(const std::string& fileToAppend) { #ifdef _WIN32 + _setmode(fileno(stdin), _O_BINARY); _setmode(fileno(stdout), _O_BINARY); #endif - cmsys::ifstream source(fileToAppend.c_str(), - (std::ios::binary | std::ios::in)); - std::cout << source.rdbuf(); + std::streambuf* buf = std::cin.rdbuf(); + cmsys::ifstream source; + if (fileToAppend != "-") { + source.open(fileToAppend.c_str(), (std::ios::binary | std::ios::in)); + buf = source.rdbuf(); + } + std::cout << buf; } bool cmRemoveDirectory(const std::string& dir, bool recursive = true) @@ -1147,7 +1152,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, int return_value = 0; bool doing_options = true; for (auto const& arg : cmMakeRange(args).advance(2)) { - if (doing_options && cmHasLiteralPrefix(arg, "-")) { + if (arg == "-") { + doing_options = false; + // Destroy console buffers to drop cout/cerr encoding transform. + consoleBuf.reset(); + cmCatFile(arg); + } else if (doing_options && cmHasLiteralPrefix(arg, "-")) { if (arg == "--") { doing_options = false; } else { diff --git a/Tests/Architecture/bar.c b/Tests/Architecture/bar.c index 37946c7..18ddb78 100644 --- a/Tests/Architecture/bar.c +++ b/Tests/Architecture/bar.c @@ -1,5 +1,5 @@ extern int foo(void); -int main() +int main(void) { return foo(); } diff --git a/Tests/BuildDepends/Project/link_depends_no_shared_exe.c b/Tests/BuildDepends/Project/link_depends_no_shared_exe.c index cfaf051..8830776 100644 --- a/Tests/BuildDepends/Project/link_depends_no_shared_exe.c +++ b/Tests/BuildDepends/Project/link_depends_no_shared_exe.c @@ -3,7 +3,7 @@ __declspec(dllimport) #endif int link_depends_no_shared_lib(void); -int main() +int main(void) { return link_depends_no_shared_lib() + link_depends_no_shared_exe_value; } diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.c b/Tests/CMakeCommands/target_compile_definitions/consumer.c index bb65e01..08554f4 100644 --- a/Tests/CMakeCommands/target_compile_definitions/consumer.c +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.c @@ -39,6 +39,6 @@ # error Expected LANG_IS_C_OR_CXX #endif -void consumer_c() +void consumer_c(void) { } diff --git a/Tests/CMakeCommands/target_compile_features/main.c b/Tests/CMakeCommands/target_compile_features/main.c index 76e98c4..60f0f9e 100644 --- a/Tests/CMakeCommands/target_compile_features/main.c +++ b/Tests/CMakeCommands/target_compile_features/main.c @@ -6,7 +6,7 @@ int foo(int* restrict a, int* restrict b) return 0; } -int main() +int main(void) { return 0; } diff --git a/Tests/CMakeCommands/target_compile_features/restrict_user.c b/Tests/CMakeCommands/target_compile_features/restrict_user.c index 76c956f..42e3efb 100644 --- a/Tests/CMakeCommands/target_compile_features/restrict_user.c +++ b/Tests/CMakeCommands/target_compile_features/restrict_user.c @@ -8,7 +8,7 @@ int bar(int* restrict a, int* restrict b) return foo(a, b); } -int main() +int main(void) { return 0; } diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c index f9b6654..0984166 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.c +++ b/Tests/CMakeCommands/target_compile_options/consumer.c @@ -35,6 +35,6 @@ # endif #endif -void consumer_c() +void consumer_c(void) { } diff --git a/Tests/CMakeCommands/target_include_directories/consumer.c b/Tests/CMakeCommands/target_include_directories/consumer.c index 7fd694b..1975050 100644 --- a/Tests/CMakeCommands/target_include_directories/consumer.c +++ b/Tests/CMakeCommands/target_include_directories/consumer.c @@ -15,7 +15,7 @@ # endif #endif -int consumer_c() +int consumer_c(void) { return 0; } diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index b44c8dd..0e71cea 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -42,6 +42,7 @@ if(CMake_ENABLE_DEBUGGER) testDebuggerVariables.cxx testDebuggerVariablesHelper.cxx testDebuggerVariablesManager.cxx + testDebuggerThread.cxx ) endif() if (CMake_TEST_FILESYSTEM_PATH OR NOT CMake_HAVE_CXX_FILESYSTEM) diff --git a/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt b/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt index e47b9db..f3de7e1 100644 --- a/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt +++ b/Tests/CMakeLib/PseudoMemcheck/NoLog/CMakeLists.txt @@ -1,7 +1,7 @@ # A dummy checker implementation that does not write the requested output file # so it triggers an error for every checker. -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" "int main(){return 0;}\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" "int main(void){return 0;}\n") configure_file( "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" diff --git a/Tests/CMakeLib/testDebuggerThread.cxx b/Tests/CMakeLib/testDebuggerThread.cxx new file mode 100644 index 0000000..0ea95b6 --- /dev/null +++ b/Tests/CMakeLib/testDebuggerThread.cxx @@ -0,0 +1,33 @@ +#include <functional> +#include <memory> +#include <string> +#include <vector> + +#include <cm3p/cppdap/protocol.h> +#include <cm3p/cppdap/types.h> + +#include "cmDebuggerThread.h" +#include "cmListFileCache.h" + +#include "testCommon.h" + +static bool testStackFrameFunctionName() +{ + auto thread = std::make_shared<cmDebugger::cmDebuggerThread>(0, "name"); + const auto* functionName = "function_name"; + auto arguments = std::vector<cmListFileArgument>{}; + cmListFileFunction func(functionName, 10, 20, arguments); + thread->PushStackFrame(nullptr, "CMakeLists.txt", func); + + auto stackTrace = GetStackTraceResponse(thread); + + ASSERT_TRUE(stackTrace.stackFrames[0].name == functionName); + return true; +} + +int testDebuggerThread(int, char*[]) +{ + return runTests(std::vector<std::function<bool()>>{ + testStackFrameFunctionName, + }); +} diff --git a/Tests/COnly/conly.c b/Tests/COnly/conly.c index 2ae8a1a..c5f18ad 100644 --- a/Tests/COnly/conly.c +++ b/Tests/COnly/conly.c @@ -4,7 +4,7 @@ #include "libc1.h" #include "libc2.h" -int main() +int main(void) { int class = 0; if (LibC1Func() != 2.0) { diff --git a/Tests/COnly/libc1.c b/Tests/COnly/libc1.c index b01e1e1..e1f7e27 100644 --- a/Tests/COnly/libc1.c +++ b/Tests/COnly/libc1.c @@ -1,4 +1,4 @@ -float LibC1Func() +float LibC1Func(void) { return 2.0; } diff --git a/Tests/COnly/libc2.c b/Tests/COnly/libc2.c index 0fd8956..28d46f3 100644 --- a/Tests/COnly/libc2.c +++ b/Tests/COnly/libc2.c @@ -1,6 +1,6 @@ #include "libc2.h" -float LibC2Func() +float LibC2Func(void) { return 1.0; } diff --git a/Tests/CPackInnoSetupGenerator/main.c b/Tests/CPackInnoSetupGenerator/main.c index 413899c..9165c97 100644 --- a/Tests/CPackInnoSetupGenerator/main.c +++ b/Tests/CPackInnoSetupGenerator/main.c @@ -1,6 +1,6 @@ #include <stdio.h> -int main() +int main(void) { printf("Hello, World!\n"); return 42; diff --git a/Tests/CTestTestVerboseOutput/nop.c b/Tests/CTestTestVerboseOutput/nop.c index f8b643a..8488f4e 100644 --- a/Tests/CTestTestVerboseOutput/nop.c +++ b/Tests/CTestTestVerboseOutput/nop.c @@ -1,4 +1,4 @@ -int main() +int main(void) { return 0; } diff --git a/Tests/CommandLength/test.c b/Tests/CommandLength/test.c index f8b643a..8488f4e 100644 --- a/Tests/CommandLength/test.c +++ b/Tests/CommandLength/test.c @@ -1,4 +1,4 @@ -int main() +int main(void) { return 0; } diff --git a/Tests/CompileDefinitions/runtest.c b/Tests/CompileDefinitions/runtest.c index c6dac4d..37317b8 100644 --- a/Tests/CompileDefinitions/runtest.c +++ b/Tests/CompileDefinitions/runtest.c @@ -6,7 +6,7 @@ # error "BUILD_CONFIG_NAME not defined!" #endif -int main() +int main(void) { char build_config_name[] = BUILD_CONFIG_NAME; char* c; diff --git a/Tests/CompileFeatures/c_variadic_macros.c b/Tests/CompileFeatures/c_variadic_macros.c index 4da111e..7a21902 100644 --- a/Tests/CompileFeatures/c_variadic_macros.c +++ b/Tests/CompileFeatures/c_variadic_macros.c @@ -9,7 +9,7 @@ int someFunc(int i1, char c, int i2) #define FUNC_WRAPPER(...) someFunc(__VA_ARGS__) -void otherFunc() +void otherFunc(void) { FUNC_WRAPPER(42, 'a', 7); } diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c index c696c83..cae107b 100644 --- a/Tests/CompileFeatures/default_dialect.c +++ b/Tests/CompileFeatures/default_dialect.c @@ -26,7 +26,7 @@ # endif #endif -int main() +int main(void) { return 0; } diff --git a/Tests/CompileFeatures/genex_test.c b/Tests/CompileFeatures/genex_test.c index de408ce..8ccad35 100644 --- a/Tests/CompileFeatures/genex_test.c +++ b/Tests/CompileFeatures/genex_test.c @@ -38,6 +38,6 @@ # endif #endif -int main() +int main(void) { } diff --git a/Tests/Complex/Executable/Sub1/NameConflictTest.c b/Tests/Complex/Executable/Sub1/NameConflictTest.c index 8720386..740c236 100644 --- a/Tests/Complex/Executable/Sub1/NameConflictTest.c +++ b/Tests/Complex/Executable/Sub1/NameConflictTest.c @@ -1,4 +1,4 @@ -int NameConflictTest1() +int NameConflictTest1(void) { return 0; } diff --git a/Tests/Complex/Executable/Sub2/NameConflictTest.c b/Tests/Complex/Executable/Sub2/NameConflictTest.c index 4a32572..cee9f6f 100644 --- a/Tests/Complex/Executable/Sub2/NameConflictTest.c +++ b/Tests/Complex/Executable/Sub2/NameConflictTest.c @@ -1,4 +1,4 @@ -int NameConflictTest2() +int NameConflictTest2(void) { return 0; } diff --git a/Tests/Complex/Library/TestLink.c b/Tests/Complex/Library/TestLink.c index 25dee08..f4bc255 100644 --- a/Tests/Complex/Library/TestLink.c +++ b/Tests/Complex/Library/TestLink.c @@ -1,4 +1,4 @@ -int TestLinkGetType() +int TestLinkGetType(void) { #ifdef CMakeTestLinkShared_EXPORTS return 0; diff --git a/Tests/Complex/Library/testConly.c b/Tests/Complex/Library/testConly.c index eb933a2..05ecc18 100644 --- a/Tests/Complex/Library/testConly.c +++ b/Tests/Complex/Library/testConly.c @@ -2,7 +2,7 @@ #include <stdio.h> -int CsharedFunction() +int CsharedFunction(void) { #ifndef TEST_C_FLAGS printf("TEST_C_FLAGS failed\n"); diff --git a/Tests/ComplexOneConfig/Executable/Sub1/NameConflictTest.c b/Tests/ComplexOneConfig/Executable/Sub1/NameConflictTest.c index 8720386..740c236 100644 --- a/Tests/ComplexOneConfig/Executable/Sub1/NameConflictTest.c +++ b/Tests/ComplexOneConfig/Executable/Sub1/NameConflictTest.c @@ -1,4 +1,4 @@ -int NameConflictTest1() +int NameConflictTest1(void) { return 0; } diff --git a/Tests/ComplexOneConfig/Executable/Sub2/NameConflictTest.c b/Tests/ComplexOneConfig/Executable/Sub2/NameConflictTest.c index 4a32572..cee9f6f 100644 --- a/Tests/ComplexOneConfig/Executable/Sub2/NameConflictTest.c +++ b/Tests/ComplexOneConfig/Executable/Sub2/NameConflictTest.c @@ -1,4 +1,4 @@ -int NameConflictTest2() +int NameConflictTest2(void) { return 0; } diff --git a/Tests/ComplexOneConfig/Library/TestLink.c b/Tests/ComplexOneConfig/Library/TestLink.c index 25dee08..f4bc255 100644 --- a/Tests/ComplexOneConfig/Library/TestLink.c +++ b/Tests/ComplexOneConfig/Library/TestLink.c @@ -1,4 +1,4 @@ -int TestLinkGetType() +int TestLinkGetType(void) { #ifdef CMakeTestLinkShared_EXPORTS return 0; diff --git a/Tests/ComplexOneConfig/Library/testConly.c b/Tests/ComplexOneConfig/Library/testConly.c index eb933a2..05ecc18 100644 --- a/Tests/ComplexOneConfig/Library/testConly.c +++ b/Tests/ComplexOneConfig/Library/testConly.c @@ -2,7 +2,7 @@ #include <stdio.h> -int CsharedFunction() +int CsharedFunction(void) { #ifndef TEST_C_FLAGS printf("TEST_C_FLAGS failed\n"); diff --git a/Tests/Cuda/WithC/main.c b/Tests/Cuda/WithC/main.c index 5f3c781..ed64427 100644 --- a/Tests/Cuda/WithC/main.c +++ b/Tests/Cuda/WithC/main.c @@ -4,7 +4,7 @@ extern int use_cuda(void); # include <windows.h> #endif -int main() +int main(void) { #ifdef _WIN32 /* Use an API that requires CMake's "standard" C libraries. */ diff --git a/Tests/CustomCommand/gen_redirect_in.c b/Tests/CustomCommand/gen_redirect_in.c index 6af364b..c71123a 100644 --- a/Tests/CustomCommand/gen_redirect_in.c +++ b/Tests/CustomCommand/gen_redirect_in.c @@ -1,6 +1,6 @@ #if 1 -int gen_redirect() +int gen_redirect(void) { return 3; } diff --git a/Tests/CustomCommandWorkingDirectory/customTarget.c b/Tests/CustomCommandWorkingDirectory/customTarget.c index 8dbf0d4..9735287 100644 --- a/Tests/CustomCommandWorkingDirectory/customTarget.c +++ b/Tests/CustomCommandWorkingDirectory/customTarget.c @@ -1,4 +1,4 @@ -int customTarget() +int customTarget(void) { return 0; } diff --git a/Tests/Dependency/1/OneSrc.c b/Tests/Dependency/1/OneSrc.c index 9801c25..7f527f4 100644 --- a/Tests/Dependency/1/OneSrc.c +++ b/Tests/Dependency/1/OneSrc.c @@ -1,3 +1,3 @@ -void OneFunction() +void OneFunction(void) { } diff --git a/Tests/Dependency/Case1/a.c b/Tests/Dependency/Case1/a.c index 262f523..bf1c773 100644 --- a/Tests/Dependency/Case1/a.c +++ b/Tests/Dependency/Case1/a.c @@ -1,4 +1,4 @@ -int a() +int a(void) { return 5; } diff --git a/Tests/Dependency/Case1/b.c b/Tests/Dependency/Case1/b.c index deda685..f4ef707 100644 --- a/Tests/Dependency/Case1/b.c +++ b/Tests/Dependency/Case1/b.c @@ -1,6 +1,6 @@ -extern int a(); +extern int a(void); -int b() +int b(void) { return a() + 17; } diff --git a/Tests/Dependency/Case1/b2.c b/Tests/Dependency/Case1/b2.c index f341da7..108e76a 100644 --- a/Tests/Dependency/Case1/b2.c +++ b/Tests/Dependency/Case1/b2.c @@ -1,4 +1,4 @@ -int b2() +int b2(void) { return 3; } diff --git a/Tests/Dependency/Case1/c.c b/Tests/Dependency/Case1/c.c index a3ec162..ddda855 100644 --- a/Tests/Dependency/Case1/c.c +++ b/Tests/Dependency/Case1/c.c @@ -1,6 +1,6 @@ -extern int b(); +extern int b(void); -int c() +int c(void) { return b() + 42; } diff --git a/Tests/Dependency/Case1/c2.c b/Tests/Dependency/Case1/c2.c index 317bb0f..826c746 100644 --- a/Tests/Dependency/Case1/c2.c +++ b/Tests/Dependency/Case1/c2.c @@ -1,6 +1,6 @@ -extern int b2(); +extern int b2(void); -int c2() +int c2(void) { return b2() + 1; } diff --git a/Tests/Dependency/Case1/d.c b/Tests/Dependency/Case1/d.c index f67aef7..fdeb2bf 100644 --- a/Tests/Dependency/Case1/d.c +++ b/Tests/Dependency/Case1/d.c @@ -1,6 +1,6 @@ -extern int c2(); +extern int c2(void); -int d() +int d(void) { return c2() + 2; } diff --git a/Tests/Dependency/Case1/main.c b/Tests/Dependency/Case1/main.c index 07191cc..6847f7d 100644 --- a/Tests/Dependency/Case1/main.c +++ b/Tests/Dependency/Case1/main.c @@ -2,7 +2,7 @@ extern int b(); extern int c(); extern int d(); -int main() +int main(void) { c(); b(); diff --git a/Tests/Dependency/Case4/bar.c b/Tests/Dependency/Case4/bar.c index 08092f9..18ddb78 100644 --- a/Tests/Dependency/Case4/bar.c +++ b/Tests/Dependency/Case4/bar.c @@ -1,5 +1,5 @@ -extern int foo(); -int main() +extern int foo(void); +int main(void) { return foo(); } diff --git a/Tests/Dependency/Case4/foo.c b/Tests/Dependency/Case4/foo.c index e05eb7e..c83d856 100644 --- a/Tests/Dependency/Case4/foo.c +++ b/Tests/Dependency/Case4/foo.c @@ -1,4 +1,4 @@ -int foo() +int foo(void) { return 0; } diff --git a/Tests/Dependency/Eight/EightSrc.c b/Tests/Dependency/Eight/EightSrc.c index 7bfa481..16605ce 100644 --- a/Tests/Dependency/Eight/EightSrc.c +++ b/Tests/Dependency/Eight/EightSrc.c @@ -1,6 +1,6 @@ -void SevenFunction(); +void SevenFunction(void); -void EightFunction() +void EightFunction(void) { SevenFunction(); } diff --git a/Tests/Dependency/Exec/ExecMain.c b/Tests/Dependency/Exec/ExecMain.c index 9572afd..793bc18 100644 --- a/Tests/Dependency/Exec/ExecMain.c +++ b/Tests/Dependency/Exec/ExecMain.c @@ -5,7 +5,7 @@ void NoDepCFunction(); void SixAFunction(); void SixBFunction(); -int main() +int main(void) { SixAFunction(); SixBFunction(); diff --git a/Tests/Dependency/Exec2/ExecMain.c b/Tests/Dependency/Exec2/ExecMain.c index 385cce1..085f30f 100644 --- a/Tests/Dependency/Exec2/ExecMain.c +++ b/Tests/Dependency/Exec2/ExecMain.c @@ -3,7 +3,7 @@ void FiveFunction(); void EightFunction(); -int main() +int main(void) { FiveFunction(); EightFunction(); diff --git a/Tests/Dependency/Exec3/ExecMain.c b/Tests/Dependency/Exec3/ExecMain.c index 385cce1..085f30f 100644 --- a/Tests/Dependency/Exec3/ExecMain.c +++ b/Tests/Dependency/Exec3/ExecMain.c @@ -3,7 +3,7 @@ void FiveFunction(); void EightFunction(); -int main() +int main(void) { FiveFunction(); EightFunction(); diff --git a/Tests/Dependency/Exec4/ExecMain.c b/Tests/Dependency/Exec4/ExecMain.c index 0cfcce9..48552d3 100644 --- a/Tests/Dependency/Exec4/ExecMain.c +++ b/Tests/Dependency/Exec4/ExecMain.c @@ -3,7 +3,7 @@ void FiveFunction(); void TwoFunction(); -int main() +int main(void) { FiveFunction(); TwoFunction(); diff --git a/Tests/Dependency/Five/FiveSrc.c b/Tests/Dependency/Five/FiveSrc.c index 33d8ad7..b35b05b 100644 --- a/Tests/Dependency/Five/FiveSrc.c +++ b/Tests/Dependency/Five/FiveSrc.c @@ -1,6 +1,6 @@ -void TwoFunction(); +void TwoFunction(void); -void FiveFunction() +void FiveFunction(void) { TwoFunction(); } diff --git a/Tests/Dependency/Four/FourSrc.c b/Tests/Dependency/Four/FourSrc.c index 4ea996d..b91c5fd 100644 --- a/Tests/Dependency/Four/FourSrc.c +++ b/Tests/Dependency/Four/FourSrc.c @@ -1,9 +1,9 @@ #include <two-test.h> /* Requires TwoCustom to be built first. */ -void NoDepAFunction(); -void OneFunction(); -void TwoFunction(); +void NoDepAFunction(void); +void OneFunction(void); +void TwoFunction(void); -void FourFunction() +void FourFunction(void) { static int count = 0; if (count == 0) { diff --git a/Tests/Dependency/NoDepA/NoDepASrc.c b/Tests/Dependency/NoDepA/NoDepASrc.c index 8c4072b..e972df2 100644 --- a/Tests/Dependency/NoDepA/NoDepASrc.c +++ b/Tests/Dependency/NoDepA/NoDepASrc.c @@ -1,3 +1,3 @@ -void NoDepAFunction() +void NoDepAFunction(void) { } diff --git a/Tests/Dependency/NoDepB/NoDepBSrc.c b/Tests/Dependency/NoDepB/NoDepBSrc.c index ddc71c5..81dc5ed 100644 --- a/Tests/Dependency/NoDepB/NoDepBSrc.c +++ b/Tests/Dependency/NoDepB/NoDepBSrc.c @@ -1,6 +1,6 @@ -void NoDepAFunction(); +void NoDepAFunction(void); -void NoDepBFunction() +void NoDepBFunction(void) { NoDepAFunction(); } diff --git a/Tests/Dependency/NoDepC/NoDepCSrc.c b/Tests/Dependency/NoDepC/NoDepCSrc.c index b478c59..d90007e 100644 --- a/Tests/Dependency/NoDepC/NoDepCSrc.c +++ b/Tests/Dependency/NoDepC/NoDepCSrc.c @@ -1,6 +1,6 @@ -void NoDepAFunction(); +void NoDepAFunction(void); -void NoDepCFunction() +void NoDepCFunction(void) { NoDepAFunction(); } diff --git a/Tests/Dependency/Seven/SevenSrc.c b/Tests/Dependency/Seven/SevenSrc.c index e1f3329..9c74ec8 100644 --- a/Tests/Dependency/Seven/SevenSrc.c +++ b/Tests/Dependency/Seven/SevenSrc.c @@ -1,6 +1,6 @@ -void TwoFunction(); +void TwoFunction(void); -void SevenFunction() +void SevenFunction(void) { TwoFunction(); } diff --git a/Tests/Dependency/Six/SixASrc.c b/Tests/Dependency/Six/SixASrc.c index 7ea3711..ddd2d7d 100644 --- a/Tests/Dependency/Six/SixASrc.c +++ b/Tests/Dependency/Six/SixASrc.c @@ -1,7 +1,7 @@ -void FiveFunction(); -void TwoFunction(); +void FiveFunction(void); +void TwoFunction(void); -void SixAFunction() +void SixAFunction(void) { FiveFunction(); TwoFunction(); diff --git a/Tests/Dependency/Six/SixBSrc.c b/Tests/Dependency/Six/SixBSrc.c index 92f9607..42f2de6 100644 --- a/Tests/Dependency/Six/SixBSrc.c +++ b/Tests/Dependency/Six/SixBSrc.c @@ -1,8 +1,8 @@ -void TwoFunction(); -void FiveFunction(); -void FourFunction(); +void TwoFunction(void); +void FiveFunction(void); +void FourFunction(void); -void SixBFunction() +void SixBFunction(void) { TwoFunction(); FiveFunction(); diff --git a/Tests/Dependency/Three/ThreeSrc.c b/Tests/Dependency/Three/ThreeSrc.c index 3e814f3..85c51fc 100644 --- a/Tests/Dependency/Three/ThreeSrc.c +++ b/Tests/Dependency/Three/ThreeSrc.c @@ -1,7 +1,7 @@ -void OneFunction(); -void FourFunction(); +void OneFunction(void); +void FourFunction(void); -void ThreeFunction() +void ThreeFunction(void) { static int count = 0; if (count == 0) { diff --git a/Tests/Dependency/Two/TwoCustomSrc.c b/Tests/Dependency/Two/TwoCustomSrc.c index ac31dcf..432dca1 100644 --- a/Tests/Dependency/Two/TwoCustomSrc.c +++ b/Tests/Dependency/Two/TwoCustomSrc.c @@ -1,10 +1,10 @@ -extern void NoFunction(); +extern void NoFunction(void); /* Provide a function that is supposed to be found in the Three library. If Two links to TwoCustom then TwoCustom will come before Three and this symbol will be used. Since NoFunction is not defined, that will cause a link failure. */ -void ThreeFunction() +void ThreeFunction(void) { NoFunction(); } diff --git a/Tests/Dependency/Two/TwoSrc.c b/Tests/Dependency/Two/TwoSrc.c index dbdf524..dadac22 100644 --- a/Tests/Dependency/Two/TwoSrc.c +++ b/Tests/Dependency/Two/TwoSrc.c @@ -1,6 +1,6 @@ #include <two-test.h> -void TwoFunction() +void TwoFunction(void) { static int count = 0; if (count == 0) { diff --git a/Tests/DoubleProject/silly.c b/Tests/DoubleProject/silly.c index f8b643a..8488f4e 100644 --- a/Tests/DoubleProject/silly.c +++ b/Tests/DoubleProject/silly.c @@ -1,4 +1,4 @@ -int main() +int main(void) { return 0; } diff --git a/Tests/ExportImport/Export/testExe2.c b/Tests/ExportImport/Export/testExe2.c index 958e4d2..8e6ee44 100644 --- a/Tests/ExportImport/Export/testExe2.c +++ b/Tests/ExportImport/Export/testExe2.c @@ -9,7 +9,7 @@ testExe2_EXPORT int testExe2Func(void) return 123; } -int main() +int main(void) { return 0; } diff --git a/Tests/ExportImport/Import/A/deps_iface.c b/Tests/ExportImport/Import/A/deps_iface.c index afb1af0..fd2c47f 100644 --- a/Tests/ExportImport/Import/A/deps_iface.c +++ b/Tests/ExportImport/Import/A/deps_iface.c @@ -26,7 +26,7 @@ extern int testLibDepends(void); -int main() +int main(void) { return testLibDepends(); } diff --git a/Tests/ExportImport/Import/A/imp_mod1.c b/Tests/ExportImport/Import/A/imp_mod1.c index 9385d55..138962e 100644 --- a/Tests/ExportImport/Import/A/imp_mod1.c +++ b/Tests/ExportImport/Import/A/imp_mod1.c @@ -7,7 +7,7 @@ testExe2_IMPORT int testExe2Func(void); testExe2_IMPORT int testExe2lib(void); -int imp_mod1() +int imp_mod1(void) { return testExe2Func() + testExe2lib(); } diff --git a/Tests/ExportImport/Import/A/imp_testExe1.c b/Tests/ExportImport/Import/A/imp_testExe1.c index d3b0e9e..e409b1c 100644 --- a/Tests/ExportImport/Import/A/imp_testExe1.c +++ b/Tests/ExportImport/Import/A/imp_testExe1.c @@ -21,7 +21,7 @@ extern int testStaticLibPlugin(void); #endif extern int testLib4libcfg(void); -int main() +int main(void) { return (testLib2() + generated_by_testExe1() + testLib3() + testLib4() + testLib5() + testLib6() + testLib7() + testLibCycleA1() + diff --git a/Tests/ExportImport/Import/A/imp_testExeAbs1.c b/Tests/ExportImport/Import/A/imp_testExeAbs1.c index fd05242..07d33a5 100644 --- a/Tests/ExportImport/Import/A/imp_testExeAbs1.c +++ b/Tests/ExportImport/Import/A/imp_testExeAbs1.c @@ -7,7 +7,7 @@ #ifndef testLibAbs1b # error "testLibAbs1b not defined" #endif -int main() +int main(void) { return 0 + testLibAbs1(); } diff --git a/Tests/ExportImport/Import/A/imp_testLib8.c b/Tests/ExportImport/Import/A/imp_testLib8.c index 2749b17..ef97dbe 100644 --- a/Tests/ExportImport/Import/A/imp_testLib8.c +++ b/Tests/ExportImport/Import/A/imp_testLib8.c @@ -2,7 +2,7 @@ int testLib8A(void); int testLib8B(void); -int main() +int main(void) { return (testLib8A() + testLib8B()); } diff --git a/Tests/ExportImport/Import/A/imp_testLib9.c b/Tests/ExportImport/Import/A/imp_testLib9.c index e014857..2a8d8d5 100644 --- a/Tests/ExportImport/Import/A/imp_testLib9.c +++ b/Tests/ExportImport/Import/A/imp_testLib9.c @@ -10,7 +10,7 @@ int testLib9(void); -int main() +int main(void) { return testLib9(); } diff --git a/Tests/ExportImport/Import/imp_testTransExe1.c b/Tests/ExportImport/Import/imp_testTransExe1.c index 360a112..579c992 100644 --- a/Tests/ExportImport/Import/imp_testTransExe1.c +++ b/Tests/ExportImport/Import/imp_testTransExe1.c @@ -1,6 +1,6 @@ extern int imp_lib1(void); -int main() +int main(void) { return imp_lib1(); } diff --git a/Tests/ExportImport/main.c b/Tests/ExportImport/main.c index f8b643a..8488f4e 100644 --- a/Tests/ExportImport/main.c +++ b/Tests/ExportImport/main.c @@ -1,4 +1,4 @@ -int main() +int main(void) { return 0; } diff --git a/Tests/FindALSA/Test/main.c b/Tests/FindALSA/Test/main.c index d3303d0..53831a9 100644 --- a/Tests/FindALSA/Test/main.c +++ b/Tests/FindALSA/Test/main.c @@ -2,7 +2,7 @@ #include <stdio.h> #include <string.h> -int main() +int main(void) { printf("Found ALSA version %s, expected version %s\n", snd_asoundlib_version(), CMAKE_EXPECTED_ALSA_VERSION); diff --git a/Tests/FindBLAS/Test/main.c b/Tests/FindBLAS/Test/main.c index 4fc9fe4..4ce1efb 100644 --- a/Tests/FindBLAS/Test/main.c +++ b/Tests/FindBLAS/Test/main.c @@ -13,7 +13,7 @@ typedef int64_t blas_int; // declare what parts of the blas C-API we need void dswap_(blas_int* N, double* X, blas_int* incX, double* Y, blas_int* incY); -int main() +int main(void) { double x[4] = { 1, 2, 3, 4 }; double y[4] = { 8, 7, 7, 6 }; diff --git a/Tests/FindBZip2/Test/main.c b/Tests/FindBZip2/Test/main.c index 8e24c94..b3cf34b 100644 --- a/Tests/FindBZip2/Test/main.c +++ b/Tests/FindBZip2/Test/main.c @@ -2,7 +2,7 @@ #include <stdio.h> #include <stdlib.h> -int main() +int main(void) { int chunksize = 1024; FILE* file = fopen("test.bzip2", "wb"); diff --git a/Tests/FindCURL/Test/main.c b/Tests/FindCURL/Test/main.c index 263775f..82075f1 100644 --- a/Tests/FindCURL/Test/main.c +++ b/Tests/FindCURL/Test/main.c @@ -2,7 +2,7 @@ #include <stdio.h> #include <stdlib.h> -int main() +int main(void) { struct curl_slist* slist; diff --git a/Tests/FindCups/Test/main.c b/Tests/FindCups/Test/main.c index b69d621..86952db 100644 --- a/Tests/FindCups/Test/main.c +++ b/Tests/FindCups/Test/main.c @@ -1,6 +1,6 @@ #include <cups/cups.h> -int main() +int main(void) { int num_options = 0; cups_option_t* options = NULL; diff --git a/Tests/FindDevIL/Test/main.c b/Tests/FindDevIL/Test/main.c index 4a07087..dfb2f63 100644 --- a/Tests/FindDevIL/Test/main.c +++ b/Tests/FindDevIL/Test/main.c @@ -1,6 +1,6 @@ #include <IL/il.h> -int main() +int main(void) { // Test 1 requires to link to the library. ilInit(); diff --git a/Tests/FindDevIL/Test/main_ilu.c b/Tests/FindDevIL/Test/main_ilu.c index a9e7819..ac7237a 100644 --- a/Tests/FindDevIL/Test/main_ilu.c +++ b/Tests/FindDevIL/Test/main_ilu.c @@ -1,6 +1,6 @@ #include <IL/ilu.h> -int main() +int main(void) { // IL Utilities requires only initialization. // Unlike main DevIL there are no shutdown function. diff --git a/Tests/FindEXPAT/Test/main.c b/Tests/FindEXPAT/Test/main.c index 94ee3ef..703aaf9 100644 --- a/Tests/FindEXPAT/Test/main.c +++ b/Tests/FindEXPAT/Test/main.c @@ -3,7 +3,7 @@ #include <stdlib.h> #include <string.h> -int main() +int main(void) { XML_Expat_Version expat_version; char expat_version_string[16]; diff --git a/Tests/FindFontconfig/Test/main.c b/Tests/FindFontconfig/Test/main.c index c5b5963..96b0af1 100644 --- a/Tests/FindFontconfig/Test/main.c +++ b/Tests/FindFontconfig/Test/main.c @@ -3,7 +3,7 @@ #include <stdio.h> #include <string.h> -int main() +int main(void) { FcInit(); printf("Found Fontconfig.\n"); diff --git a/Tests/FindFreetype/Test/main.c b/Tests/FindFreetype/Test/main.c index bb838a5..315a6cb 100644 --- a/Tests/FindFreetype/Test/main.c +++ b/Tests/FindFreetype/Test/main.c @@ -3,7 +3,7 @@ #include FT_FREETYPE_H #include <string.h> -int main() +int main(void) { FT_Library library; FT_Error error; diff --git a/Tests/FindGDAL/Test/main.c b/Tests/FindGDAL/Test/main.c index 7b31a13..2e19843 100644 --- a/Tests/FindGDAL/Test/main.c +++ b/Tests/FindGDAL/Test/main.c @@ -2,7 +2,7 @@ #include <stdio.h> #include <string.h> -int main() +int main(void) { printf("Found GDAL version %s, expected version %s\n", GDAL_RELEASE_NAME, CMAKE_EXPECTED_GDAL_VERSION); diff --git a/Tests/FindGIF/Test/main.c b/Tests/FindGIF/Test/main.c index 656a99c..fa2c224 100644 --- a/Tests/FindGIF/Test/main.c +++ b/Tests/FindGIF/Test/main.c @@ -8,7 +8,7 @@ # define GIFLIB_MAJOR 4 #endif -int main() +int main(void) { // because of the API changes we have to test different functions depending // on the version of GIFLIB diff --git a/Tests/FindGLUT/Test/main.c b/Tests/FindGLUT/Test/main.c index 1c8569c..02ac34f 100644 --- a/Tests/FindGLUT/Test/main.c +++ b/Tests/FindGLUT/Test/main.c @@ -1,7 +1,7 @@ #include <GL/glut.h> #include <stdio.h> -int main() +int main(void) { /* The following should call exit(1) and print freeglut ERROR: Function <glutCreateWindow> called diff --git a/Tests/FindGnuTLS/Test/main.c b/Tests/FindGnuTLS/Test/main.c index 1105358..c379cc2 100644 --- a/Tests/FindGnuTLS/Test/main.c +++ b/Tests/FindGnuTLS/Test/main.c @@ -3,7 +3,7 @@ #include <stdio.h> #include <string.h> -int main() +int main(void) { // test the linker gnutls_session_t session; diff --git a/Tests/FindImageMagick/Test/main_magick_wand.c b/Tests/FindImageMagick/Test/main_magick_wand.c index fa6d170..52d179d 100644 --- a/Tests/FindImageMagick/Test/main_magick_wand.c +++ b/Tests/FindImageMagick/Test/main_magick_wand.c @@ -1,6 +1,6 @@ #include <wand/MagickWand.h> -int main() +int main(void) { MagickWand* wand = NewMagickWand(); wand = DestroyMagickWand(wand); diff --git a/Tests/FindJPEG/Test/main.c b/Tests/FindJPEG/Test/main.c index 5a67faa..0116cb6 100644 --- a/Tests/FindJPEG/Test/main.c +++ b/Tests/FindJPEG/Test/main.c @@ -4,7 +4,7 @@ #include <jpeglib.h> // clang-format on -int main() +int main(void) { /* Without any JPEG file to open, test that the call fails as expected. This tests that linking worked. */ diff --git a/Tests/FindJasper/Test/main.c b/Tests/FindJasper/Test/main.c index 771344d..242ff7d 100644 --- a/Tests/FindJasper/Test/main.c +++ b/Tests/FindJasper/Test/main.c @@ -4,7 +4,7 @@ #include <jasper/jasper.h> // clang-format on -int main() +int main(void) { /* Without any JPEG file to open, test that the call fails as expected. This tests that linking worked. */ diff --git a/Tests/FindLAPACK/Test/main.c b/Tests/FindLAPACK/Test/main.c index dd33fb3..3c7ad9f 100644 --- a/Tests/FindLAPACK/Test/main.c +++ b/Tests/FindLAPACK/Test/main.c @@ -14,7 +14,7 @@ typedef int64_t blas_int; void dgesv_(blas_int*, blas_int*, double*, blas_int*, blas_int*, double*, blas_int*, blas_int*); -int main() +int main(void) { double A[8] = { 0, 1, 2, 3, 4, 5, 6, 7, diff --git a/Tests/FindLibLZMA/Test/main.c b/Tests/FindLibLZMA/Test/main.c index 06e8065..0b3de31 100644 --- a/Tests/FindLibLZMA/Test/main.c +++ b/Tests/FindLibLZMA/Test/main.c @@ -4,7 +4,7 @@ static const uint8_t test_string[9] = "123456789"; -int main() +int main(void) { static const uint32_t test_vector = 0xCBF43926; diff --git a/Tests/FindLibRHash/Test/main.c b/Tests/FindLibRHash/Test/main.c index 201dced..4cc6394 100644 --- a/Tests/FindLibRHash/Test/main.c +++ b/Tests/FindLibRHash/Test/main.c @@ -1,6 +1,6 @@ #include <rhash.h> -int main() +int main(void) { rhash_library_init(); return 0; diff --git a/Tests/FindLibUV/Test/main.c b/Tests/FindLibUV/Test/main.c index cbd0db3..a14adbb 100644 --- a/Tests/FindLibUV/Test/main.c +++ b/Tests/FindLibUV/Test/main.c @@ -1,6 +1,6 @@ #include <uv.h> -int main() +int main(void) { uv_loop_close(uv_default_loop()); return 0; diff --git a/Tests/FindLibXml2/Test/main.c b/Tests/FindLibXml2/Test/main.c index 264f07d..4ded2f7 100644 --- a/Tests/FindLibXml2/Test/main.c +++ b/Tests/FindLibXml2/Test/main.c @@ -2,7 +2,7 @@ #include <libxml/tree.h> #include <string.h> -int main() +int main(void) { xmlDoc* doc; diff --git a/Tests/FindLibXslt/Test/libexslt.c b/Tests/FindLibXslt/Test/libexslt.c index ea6eb3d..5916024 100644 --- a/Tests/FindLibXslt/Test/libexslt.c +++ b/Tests/FindLibXslt/Test/libexslt.c @@ -2,7 +2,7 @@ #include <libxslt/xslt.h> #include <libxslt/xsltInternals.h> -int main() +int main(void) { xsltInit(); diff --git a/Tests/FindLibXslt/Test/libxslt.c b/Tests/FindLibXslt/Test/libxslt.c index 5b3d766..4a149c1 100644 --- a/Tests/FindLibXslt/Test/libxslt.c +++ b/Tests/FindLibXslt/Test/libxslt.c @@ -4,7 +4,7 @@ #include <stdio.h> #include <string.h> -int main() +int main(void) { xsltInit(); diff --git a/Tests/FindLibinput/Test/main.c b/Tests/FindLibinput/Test/main.c index 3919962..a6b1aa4 100644 --- a/Tests/FindLibinput/Test/main.c +++ b/Tests/FindLibinput/Test/main.c @@ -1,7 +1,7 @@ #include <libinput.h> #include <stdio.h> -int main() +int main(void) { struct libinput_interface interface; interface.open_restricted = 0; diff --git a/Tests/FindODBC/Test/main.c b/Tests/FindODBC/Test/main.c index 34f279c..6c4318b 100644 --- a/Tests/FindODBC/Test/main.c +++ b/Tests/FindODBC/Test/main.c @@ -3,7 +3,7 @@ #endif #include <sql.h> -int main() +int main(void) { SQLHENV env; SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); diff --git a/Tests/FindOpenACC/CTest/main.c b/Tests/FindOpenACC/CTest/main.c index 53b6cae..6c005c1 100644 --- a/Tests/FindOpenACC/CTest/main.c +++ b/Tests/FindOpenACC/CTest/main.c @@ -8,7 +8,7 @@ void vecaddgpu(float* r, float* a, float* b, int n) r[i] = a[i] + b[i]; } -int main() +int main(void) { int n = 100000; /* vector length */ float* a; /* input vector 1 */ diff --git a/Tests/FindOpenCL/Test/main.c b/Tests/FindOpenCL/Test/main.c index 2fe949b..d3d0cfb 100644 --- a/Tests/FindOpenCL/Test/main.c +++ b/Tests/FindOpenCL/Test/main.c @@ -4,7 +4,7 @@ # include <CL/cl.h> #endif -int main() +int main(void) { cl_uint platformIdCount; diff --git a/Tests/FindOpenGL/Test/main.c b/Tests/FindOpenGL/Test/main.c index e1f25c6..88a4a8a 100644 --- a/Tests/FindOpenGL/Test/main.c +++ b/Tests/FindOpenGL/Test/main.c @@ -9,7 +9,7 @@ #include <stdio.h> -int main() +int main(void) { /* Reference a GL symbol without requiring a context at runtime. */ printf("&glGetString = %p\n", &glGetString); diff --git a/Tests/FindOpenGL/Test/main_gles2.c b/Tests/FindOpenGL/Test/main_gles2.c index 52f5936..355795b 100644 --- a/Tests/FindOpenGL/Test/main_gles2.c +++ b/Tests/FindOpenGL/Test/main_gles2.c @@ -9,7 +9,7 @@ #include <stdio.h> -int main() +int main(void) { /* Reference a GL symbol without requiring a context at runtime. */ printf("&glGetString = %p\n", &glGetString); diff --git a/Tests/FindOpenGL/Test/main_gles3.c b/Tests/FindOpenGL/Test/main_gles3.c index 875f73c..383954f7 100644 --- a/Tests/FindOpenGL/Test/main_gles3.c +++ b/Tests/FindOpenGL/Test/main_gles3.c @@ -9,7 +9,7 @@ #include <stdio.h> -int main() +int main(void) { /* Reference a GL symbol without requiring a context at runtime. */ printf("&glGetString = %p\n", &glGetString); diff --git a/Tests/FindOpenMP/Test/main.c b/Tests/FindOpenMP/Test/main.c index 4f0e874..9fb67e4 100644 --- a/Tests/FindOpenMP/Test/main.c +++ b/Tests/FindOpenMP/Test/main.c @@ -1,5 +1,5 @@ #include <omp.h> -int main() +int main(void) { #ifndef _OPENMP breaks_on_purpose diff --git a/Tests/FindOpenMP/Test/scaltest.c b/Tests/FindOpenMP/Test/scaltest.c index 4678b87..be48827 100644 --- a/Tests/FindOpenMP/Test/scaltest.c +++ b/Tests/FindOpenMP/Test/scaltest.c @@ -6,7 +6,7 @@ extern "C" #endif int scalprod(int n, double* x, double* y, double* res); -int main() +int main(void) { double a[5] = { 1., 2., 3., 4., 5. }; double b[5] = { 2., 3., 4., 5., 6. }; diff --git a/Tests/FindPNG/Test/main.c b/Tests/FindPNG/Test/main.c index b33b28e..05b55c0 100644 --- a/Tests/FindPNG/Test/main.c +++ b/Tests/FindPNG/Test/main.c @@ -2,7 +2,7 @@ #include <png.h> #include <string.h> -int main() +int main(void) { png_uint_32 png_version; char png_version_string[16]; diff --git a/Tests/FindPackageTest/Exporter/dummy.c b/Tests/FindPackageTest/Exporter/dummy.c index f8b643a..8488f4e 100644 --- a/Tests/FindPackageTest/Exporter/dummy.c +++ b/Tests/FindPackageTest/Exporter/dummy.c @@ -1,4 +1,4 @@ -int main() +int main(void) { return 0; } diff --git a/Tests/FindPostgreSQL/Test/main.c b/Tests/FindPostgreSQL/Test/main.c index a63377a..b5fcf64 100644 --- a/Tests/FindPostgreSQL/Test/main.c +++ b/Tests/FindPostgreSQL/Test/main.c @@ -2,7 +2,7 @@ #include <stdio.h> #include <string.h> -int main() +int main(void) { int version = PQlibVersion(); char version_string[100]; diff --git a/Tests/FindPython/display_time.c b/Tests/FindPython/display_time.c index 0e78434..568d510 100644 --- a/Tests/FindPython/display_time.c +++ b/Tests/FindPython/display_time.c @@ -6,7 +6,7 @@ #include "display_time.h" -void display_time() +void display_time(void) { #if defined(PYTHON3) wchar_t* program = Py_DecodeLocale("display_time", NULL); diff --git a/Tests/FindPython/main.c b/Tests/FindPython/main.c index 0acba29..0119ce0 100644 --- a/Tests/FindPython/main.c +++ b/Tests/FindPython/main.c @@ -1,7 +1,7 @@ #include "display_time.h" -int main() +int main(void) { display_time(); } diff --git a/Tests/FindSDL/Test/main.c b/Tests/FindSDL/Test/main.c index 057289c..3b774f5 100644 --- a/Tests/FindSDL/Test/main.c +++ b/Tests/FindSDL/Test/main.c @@ -1,6 +1,6 @@ #include <SDL.h> -int main() +int main(void) { // Test 1 requires headers only. SDL_version compiled; diff --git a/Tests/FindSQLite3/Test/main.c b/Tests/FindSQLite3/Test/main.c index fb17c67..f812034 100644 --- a/Tests/FindSQLite3/Test/main.c +++ b/Tests/FindSQLite3/Test/main.c @@ -1,7 +1,7 @@ #include <sqlite3.h> #include <string.h> -int main() +int main(void) { char sqlite3_version[] = SQLITE_VERSION; diff --git a/Tests/FindTIFF/Test/main.c b/Tests/FindTIFF/Test/main.c index 9182652..bce4a3e 100644 --- a/Tests/FindTIFF/Test/main.c +++ b/Tests/FindTIFF/Test/main.c @@ -1,7 +1,7 @@ #include <assert.h> #include <tiffio.h> -int main() +int main(void) { /* Without any TIFF file to open, test that the call fails as expected. This tests that linking worked. */ diff --git a/Tests/FindVulkan/Test/main-SPIRV-Tools.c b/Tests/FindVulkan/Test/main-SPIRV-Tools.c index 097198d..c38f38d 100644 --- a/Tests/FindVulkan/Test/main-SPIRV-Tools.c +++ b/Tests/FindVulkan/Test/main-SPIRV-Tools.c @@ -2,7 +2,7 @@ #include <spirv-tools/libspirv.h> #include <stdio.h> -int main() +int main(void) { const char* spv_version = spvSoftwareVersionString(); const char* spv_details = spvSoftwareVersionDetailsString(); diff --git a/Tests/FindVulkan/Test/main.c b/Tests/FindVulkan/Test/main.c index 1bff651..78eaa4d 100644 --- a/Tests/FindVulkan/Test/main.c +++ b/Tests/FindVulkan/Test/main.c @@ -1,6 +1,6 @@ #include <vulkan/vulkan.h> -int main() +int main(void) { VkInstanceCreateInfo instanceCreateInfo = { 0 }; instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; diff --git a/Tests/Fortran/mainc.c b/Tests/Fortran/mainc.c index 9efafc5..607b9fd 100644 --- a/Tests/Fortran/mainc.c +++ b/Tests/Fortran/mainc.c @@ -1,5 +1,5 @@ extern int myc(void); -int main() +int main(void) { return myc(); } diff --git a/Tests/Fortran/maincxx.c b/Tests/Fortran/maincxx.c index d35ea7e..3056d96 100644 --- a/Tests/Fortran/maincxx.c +++ b/Tests/Fortran/maincxx.c @@ -1,6 +1,6 @@ extern int myc(void); extern int mycxx(void); -int main() +int main(void) { return myc() + mycxx(); } diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt index 00f3e57..16ea0d4 100644 --- a/Tests/FortranModules/CMakeLists.txt +++ b/Tests/FortranModules/CMakeLists.txt @@ -134,3 +134,6 @@ if( # Intel Fortran VS Integration breaks on custom targets with Fortran sources add_subdirectory(Issue25252-iface-target) endif() add_subdirectory(Issue25252-iface-sources) + +add_subdirectory(Issue25365-target-objects) +add_subdirectory(Issue25365-target-objects-iface) diff --git a/Tests/FortranModules/Issue25252-iface-sources/lib.c b/Tests/FortranModules/Issue25252-iface-sources/lib.c index 6ccdb8d..894540c 100644 --- a/Tests/FortranModules/Issue25252-iface-sources/lib.c +++ b/Tests/FortranModules/Issue25252-iface-sources/lib.c @@ -1,4 +1,4 @@ -int f() +int f(void) { return 0; } diff --git a/Tests/FortranModules/Issue25365-target-objects-iface/CMakeLists.txt b/Tests/FortranModules/Issue25365-target-objects-iface/CMakeLists.txt new file mode 100644 index 0000000..819ac05 --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects-iface/CMakeLists.txt @@ -0,0 +1,11 @@ +enable_language(C) + +add_library(fortran_target_objects_sources_iface STATIC "${CMAKE_CURRENT_SOURCE_DIR}/iface.f90") + +add_library(fortran_target_objects_sources_iface_bridge INTERFACE) +target_sources(fortran_target_objects_sources_iface_bridge + INTERFACE + "$<TARGET_OBJECTS:fortran_target_objects_sources_iface>") + +add_library(lib25365-target-objects-iface lib.f90) +target_link_libraries(lib25365-target-objects-iface PRIVATE fortran_target_objects_sources_iface_bridge) diff --git a/Tests/FortranModules/Issue25365-target-objects-iface/iface.f90 b/Tests/FortranModules/Issue25365-target-objects-iface/iface.f90 new file mode 100644 index 0000000..6b5ddd5 --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects-iface/iface.f90 @@ -0,0 +1,11 @@ +module m1 + +implicit none + +contains + +pure real function pi() +pi = 4*atan(1.) +end function + +end module m1 diff --git a/Tests/FortranModules/Issue25365-target-objects-iface/lib.f90 b/Tests/FortranModules/Issue25365-target-objects-iface/lib.f90 new file mode 100644 index 0000000..f971909 --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects-iface/lib.f90 @@ -0,0 +1,13 @@ +module lib + +use m1, only : pi + +implicit none + +contains + +pure real function func() +func = pi() +end function + +end module diff --git a/Tests/FortranModules/Issue25365-target-objects/CMakeLists.txt b/Tests/FortranModules/Issue25365-target-objects/CMakeLists.txt new file mode 100644 index 0000000..64e36cb --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects/CMakeLists.txt @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(fortran_target_objects_sources STATIC "${CMAKE_CURRENT_SOURCE_DIR}/iface.f90") + +add_library(lib25365-target-objects lib.f90 "$<TARGET_OBJECTS:fortran_target_objects_sources>") diff --git a/Tests/FortranModules/Issue25365-target-objects/iface.f90 b/Tests/FortranModules/Issue25365-target-objects/iface.f90 new file mode 100644 index 0000000..6b5ddd5 --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects/iface.f90 @@ -0,0 +1,11 @@ +module m1 + +implicit none + +contains + +pure real function pi() +pi = 4*atan(1.) +end function + +end module m1 diff --git a/Tests/FortranModules/Issue25365-target-objects/lib.f90 b/Tests/FortranModules/Issue25365-target-objects/lib.f90 new file mode 100644 index 0000000..f971909 --- /dev/null +++ b/Tests/FortranModules/Issue25365-target-objects/lib.f90 @@ -0,0 +1,13 @@ +module lib + +use m1, only : pi + +implicit none + +contains + +pure real function func() +func = pi() +end function + +end module diff --git a/Tests/GeneratorExpression/objlib1.c b/Tests/GeneratorExpression/objlib1.c index 98a95a4..b33aa48 100644 --- a/Tests/GeneratorExpression/objlib1.c +++ b/Tests/GeneratorExpression/objlib1.c @@ -1,4 +1,4 @@ -void objlib1() +void objlib1(void) { } diff --git a/Tests/GeneratorExpression/objlib2.c b/Tests/GeneratorExpression/objlib2.c index b2c1050..5543f75 100644 --- a/Tests/GeneratorExpression/objlib2.c +++ b/Tests/GeneratorExpression/objlib2.c @@ -1,4 +1,4 @@ -void objlib2() +void objlib2(void) { } diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c index 5d857dd..ef922a3 100644 --- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/test.c @@ -1,4 +1,4 @@ -int test_b() +int test_b(void) { return 2; } diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c index 66ee6f3..1df9613 100644 --- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder/testcase.c @@ -1,4 +1,4 @@ -int test_f() +int test_f(void) { return 1; } diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c index 83589ba..8bcb13a 100644 --- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test.c @@ -1,4 +1,4 @@ -int test_c() +int test_c(void) { return 1; } diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c index 82f9a52..24e2d75 100644 --- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c @@ -1,4 +1,4 @@ -int test_d() +int test_d(void) { return 1; } diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c index feba80e..5dd1214 100644 --- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/test.c @@ -1,4 +1,4 @@ -int test_a() +int test_a(void) { return 1; } diff --git a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c index 943c19d..658f5ab 100644 --- a/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c +++ b/Tests/GhsMulti/GhsMultiDuplicateSourceFilenames/testCase.c @@ -1,4 +1,4 @@ -int test_e() +int test_e(void) { return 1; } diff --git a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c index d1bce33..9282163 100644 --- a/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c +++ b/Tests/GhsMulti/GhsMultiIntegrity/GhsMultiIntegrityMonolith/kernel.c @@ -1,7 +1,7 @@ #include "INTEGRITY.h" #include "boottable.h" -void main() +void main(void) { Exit(0); } diff --git a/Tests/IncludeDirectories/StandardIncludeDirectories/main.c b/Tests/IncludeDirectories/StandardIncludeDirectories/main.c index edfe9ce..29a2ee1 100644 --- a/Tests/IncludeDirectories/StandardIncludeDirectories/main.c +++ b/Tests/IncludeDirectories/StandardIncludeDirectories/main.c @@ -1,5 +1,5 @@ #include "StdIncDir.h" -int main() +int main(void) { return 0; } diff --git a/Tests/IncludeDirectories/SystemIncludeDirectoriesPerLang/main.c b/Tests/IncludeDirectories/SystemIncludeDirectoriesPerLang/main.c index f8b643a..8488f4e 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectoriesPerLang/main.c +++ b/Tests/IncludeDirectories/SystemIncludeDirectoriesPerLang/main.c @@ -1,4 +1,4 @@ -int main() +int main(void) { return 0; } diff --git a/Tests/JavaExportImport/main.c b/Tests/JavaExportImport/main.c index f8b643a..8488f4e 100644 --- a/Tests/JavaExportImport/main.c +++ b/Tests/JavaExportImport/main.c @@ -1,4 +1,4 @@ -int main() +int main(void) { return 0; } diff --git a/Tests/LibName/bar.c b/Tests/LibName/bar.c index c6c1e66..b1c5cf2 100644 --- a/Tests/LibName/bar.c +++ b/Tests/LibName/bar.c @@ -2,6 +2,6 @@ __declspec(dllexport) #endif - extern void foo() + extern void foo(void) { } diff --git a/Tests/LibName/foo.c b/Tests/LibName/foo.c index 52e8d89..1bdb58b 100644 --- a/Tests/LibName/foo.c +++ b/Tests/LibName/foo.c @@ -1,11 +1,11 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void foo(); + extern void foo(void); #ifdef _WIN32 __declspec(dllexport) #endif - void bar() + void bar(void) { foo(); } diff --git a/Tests/LibName/foobar.c b/Tests/LibName/foobar.c index 2f28d30..fa7d3e9 100644 --- a/Tests/LibName/foobar.c +++ b/Tests/LibName/foobar.c @@ -3,7 +3,7 @@ __declspec(dllimport) #endif extern void bar(); -int main() +int main(void) { bar(); return 0; diff --git a/Tests/LinkLanguage/LinkLanguage.c b/Tests/LinkLanguage/LinkLanguage.c index 37946c7..18ddb78 100644 --- a/Tests/LinkLanguage/LinkLanguage.c +++ b/Tests/LinkLanguage/LinkLanguage.c @@ -1,5 +1,5 @@ extern int foo(void); -int main() +int main(void) { return foo(); } diff --git a/Tests/LinkLine/Exec.c b/Tests/LinkLine/Exec.c index 807a7a8..11b5650 100644 --- a/Tests/LinkLine/Exec.c +++ b/Tests/LinkLine/Exec.c @@ -1,7 +1,7 @@ void OneFunc(); void TwoFunc(); -int main() +int main(void) { OneFunc(); TwoFunc(); diff --git a/Tests/LinkLine/One.c b/Tests/LinkLine/One.c index 856d0d1..4f3ad63 100644 --- a/Tests/LinkLine/One.c +++ b/Tests/LinkLine/One.c @@ -1,6 +1,6 @@ -void TwoFunc(); +void TwoFunc(void); -void OneFunc() +void OneFunc(void) { static int i = 0; ++i; diff --git a/Tests/LinkLine/Two.c b/Tests/LinkLine/Two.c index 5fc212e..ac84367 100644 --- a/Tests/LinkLine/Two.c +++ b/Tests/LinkLine/Two.c @@ -1,6 +1,6 @@ -void OneFunc(); +void OneFunc(void); -void TwoFunc() +void TwoFunc(void) { static int i = 0; ++i; diff --git a/Tests/LinkLineOrder/Exec1.c b/Tests/LinkLineOrder/Exec1.c index 9bbf0f6..e47841d 100644 --- a/Tests/LinkLineOrder/Exec1.c +++ b/Tests/LinkLineOrder/Exec1.c @@ -1,7 +1,7 @@ /* Directly depends on One */ void OneFunc(); -int main() +int main(void) { OneFunc(); return 0; diff --git a/Tests/LinkLineOrder/Exec2.c b/Tests/LinkLineOrder/Exec2.c index 91b8575..d60c94e 100644 --- a/Tests/LinkLineOrder/Exec2.c +++ b/Tests/LinkLineOrder/Exec2.c @@ -1,7 +1,7 @@ /* Directly depends on Two */ void TwoFunc(); -int main() +int main(void) { TwoFunc(); return 0; diff --git a/Tests/LinkLineOrder/NoDepA.c b/Tests/LinkLineOrder/NoDepA.c index 76f97bc..72333bc 100644 --- a/Tests/LinkLineOrder/NoDepA.c +++ b/Tests/LinkLineOrder/NoDepA.c @@ -1,7 +1,7 @@ /* depends on NoDepB */ -void NoDepB_func(); +void NoDepB_func(void); -void NoDepA_func() +void NoDepA_func(void) { NoDepB_func(); } diff --git a/Tests/LinkLineOrder/NoDepB.c b/Tests/LinkLineOrder/NoDepB.c index fa89ae9..a5c30e5 100644 --- a/Tests/LinkLineOrder/NoDepB.c +++ b/Tests/LinkLineOrder/NoDepB.c @@ -1,4 +1,4 @@ /* No dependencies */ -void NoDepB_func() +void NoDepB_func(void) { } diff --git a/Tests/LinkLineOrder/NoDepC.c b/Tests/LinkLineOrder/NoDepC.c index f05d962..cafb3fd 100644 --- a/Tests/LinkLineOrder/NoDepC.c +++ b/Tests/LinkLineOrder/NoDepC.c @@ -1,7 +1,7 @@ /* depends on NoDepA */ -void NoDepA_func(); +void NoDepA_func(void); -void NoDepC_func() +void NoDepC_func(void) { NoDepA_func(); } diff --git a/Tests/LinkLineOrder/NoDepE.c b/Tests/LinkLineOrder/NoDepE.c index c47bb85..6e33c7b 100644 --- a/Tests/LinkLineOrder/NoDepE.c +++ b/Tests/LinkLineOrder/NoDepE.c @@ -1,7 +1,7 @@ /* depends on NoDepF */ -void NoDepF_func(); +void NoDepF_func(void); -void NoDepE_func() +void NoDepE_func(void) { static int firstcall = 1; if (firstcall) { diff --git a/Tests/LinkLineOrder/NoDepF.c b/Tests/LinkLineOrder/NoDepF.c index a814310..f4afcb5 100644 --- a/Tests/LinkLineOrder/NoDepF.c +++ b/Tests/LinkLineOrder/NoDepF.c @@ -1,7 +1,7 @@ /* depends on NoDepE */ -void NoDepE_func(); +void NoDepE_func(void); -void NoDepF_func() +void NoDepF_func(void) { static int firstcall = 1; if (firstcall) { diff --git a/Tests/LinkLineOrder/NoDepX.c b/Tests/LinkLineOrder/NoDepX.c index c895dd1..c8de222 100644 --- a/Tests/LinkLineOrder/NoDepX.c +++ b/Tests/LinkLineOrder/NoDepX.c @@ -1,7 +1,7 @@ /* depends on NoDepY*/ -void NoDepY_func(); +void NoDepY_func(void); -void NoDepX_func() +void NoDepX_func(void) { NoDepY_func(); } diff --git a/Tests/LinkLineOrder/NoDepY.c b/Tests/LinkLineOrder/NoDepY.c index 1e6a4ae..dc492d5 100644 --- a/Tests/LinkLineOrder/NoDepY.c +++ b/Tests/LinkLineOrder/NoDepY.c @@ -1,4 +1,4 @@ /* No dependencies */ -void NoDepY_func() +void NoDepY_func(void) { } diff --git a/Tests/LinkLineOrder/NoDepZ.c b/Tests/LinkLineOrder/NoDepZ.c index 045e570..c866667 100644 --- a/Tests/LinkLineOrder/NoDepZ.c +++ b/Tests/LinkLineOrder/NoDepZ.c @@ -1,7 +1,7 @@ /* depends on NoDepX */ -void NoDepX_func(); +void NoDepX_func(void); -void NoDepZ_func() +void NoDepZ_func(void) { NoDepX_func(); } diff --git a/Tests/LinkLineOrder/One.c b/Tests/LinkLineOrder/One.c index b23b1ec..b95fa6d 100644 --- a/Tests/LinkLineOrder/One.c +++ b/Tests/LinkLineOrder/One.c @@ -1,9 +1,9 @@ /* depends on NoDepC and NoDepE (and hence on NoDepA, NoDepB and */ /* NoDepF) */ -void NoDepC_func(); -void NoDepE_func(); +void NoDepC_func(void); +void NoDepE_func(void); -void OneFunc() +void OneFunc(void) { NoDepC_func(); NoDepE_func(); diff --git a/Tests/LinkLineOrder/Two.c b/Tests/LinkLineOrder/Two.c index 6bffaa8..9955d67 100644 --- a/Tests/LinkLineOrder/Two.c +++ b/Tests/LinkLineOrder/Two.c @@ -1,7 +1,7 @@ -void OneFunc(); -void NoDepZ_func(); +void OneFunc(void); +void NoDepZ_func(void); -void TwoFunc() +void TwoFunc(void) { OneFunc(); NoDepZ_func(); diff --git a/Tests/Module/CheckIPOSupported-C/bar.c b/Tests/Module/CheckIPOSupported-C/bar.c index 680f213..728d8fb 100644 --- a/Tests/Module/CheckIPOSupported-C/bar.c +++ b/Tests/Module/CheckIPOSupported-C/bar.c @@ -1,4 +1,4 @@ -int bar() +int bar(void) { return 0x42; } diff --git a/Tests/Module/CheckIPOSupported-C/foo.c b/Tests/Module/CheckIPOSupported-C/foo.c index 1e56597..6a64a99 100644 --- a/Tests/Module/CheckIPOSupported-C/foo.c +++ b/Tests/Module/CheckIPOSupported-C/foo.c @@ -1,4 +1,4 @@ -int foo() +int foo(void) { return 0x42; } diff --git a/Tests/Module/CheckIPOSupported-C/main.c b/Tests/Module/CheckIPOSupported-C/main.c index 28ab26f..7d8ad9a 100644 --- a/Tests/Module/CheckIPOSupported-C/main.c +++ b/Tests/Module/CheckIPOSupported-C/main.c @@ -1,7 +1,7 @@ int foo(); int bar(); -int main() +int main(void) { if (foo() != bar()) { return 1; diff --git a/Tests/Module/CheckTypeSize/CheckTypeSize.c b/Tests/Module/CheckTypeSize/CheckTypeSize.c index adfd2fc..eb1aa94 100644 --- a/Tests/Module/CheckTypeSize/CheckTypeSize.c +++ b/Tests/Module/CheckTypeSize/CheckTypeSize.c @@ -28,7 +28,7 @@ result = 1; \ } while (0) -int main() +int main(void) { int result = 0; struct somestruct x; diff --git a/Tests/Module/WriteCompilerDetectionHeader/c_undefined.c b/Tests/Module/WriteCompilerDetectionHeader/c_undefined.c index 487e66d..34c373c 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/c_undefined.c +++ b/Tests/Module/WriteCompilerDetectionHeader/c_undefined.c @@ -1,7 +1,7 @@ #include "test_compiler_detection.h" -int main() +int main(void) { return 0; } diff --git a/Tests/Module/WriteCompilerDetectionHeader/main.c b/Tests/Module/WriteCompilerDetectionHeader/main.c index 3420c67..1253563 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/main.c +++ b/Tests/Module/WriteCompilerDetectionHeader/main.c @@ -24,7 +24,7 @@ # error Expect no CXX features defined #endif -int main() +int main(void) { return 0; } diff --git a/Tests/Module/WriteCompilerDetectionHeader/main_multi.c b/Tests/Module/WriteCompilerDetectionHeader/main_multi.c index 28f9dae..3853671 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/main_multi.c +++ b/Tests/Module/WriteCompilerDetectionHeader/main_multi.c @@ -24,7 +24,7 @@ # error Expect no CXX features defined #endif -int main() +int main(void) { return 0; } diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 05a35bb..b57761b 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -68,7 +68,7 @@ add_library(UseCstaticObjs STATIC $<TARGET_OBJECTS:Cstatic> $<TARGET_OBJECTS:A> # Test a shared library with sources from a different shared library add_library(UseCsharedObjs SHARED $<TARGET_OBJECTS:Cshared> $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:Bexport>) -# Test a shared executable with sources from a different shared library +# Test a shared executable with sources from a different executable add_executable(UseABstaticObjs $<TARGET_OBJECTS:UseABstatic>) target_link_libraries(UseABstaticObjs ABstatic) diff --git a/Tests/OutOfBinary/outlib.c b/Tests/OutOfBinary/outlib.c index d309ebe..3eaedea 100644 --- a/Tests/OutOfBinary/outlib.c +++ b/Tests/OutOfBinary/outlib.c @@ -1,4 +1,4 @@ -int outlib() +int outlib(void) { return 456; } diff --git a/Tests/PDBDirectoryAndName/myexe.c b/Tests/PDBDirectoryAndName/myexe.c index fdb8b09..3d66794 100644 --- a/Tests/PDBDirectoryAndName/myexe.c +++ b/Tests/PDBDirectoryAndName/myexe.c @@ -1,8 +1,8 @@ -extern int mylibA(); -extern int mylibB(); -extern int mylibC(); -extern int mylibD(); -int main() +extern int mylibA(void); +extern int mylibB(void); +extern int mylibC(void); +extern int mylibD(void); +int main(void) { return mylibA() + mylibB() + mylibC() + mylibD(); } diff --git a/Tests/PDBDirectoryAndName/myexe2.c b/Tests/PDBDirectoryAndName/myexe2.c index 250d651..b32e0b1 100644 --- a/Tests/PDBDirectoryAndName/myexe2.c +++ b/Tests/PDBDirectoryAndName/myexe2.c @@ -1,6 +1,6 @@ -extern int mylibA(); -extern int mylibD(); -int main() +extern int mylibA(void); +extern int mylibD(void); +int main(void) { return mylibA() + mylibD(); } diff --git a/Tests/PDBDirectoryAndName/mylibA.c b/Tests/PDBDirectoryAndName/mylibA.c index 5bc279b..58ff123 100644 --- a/Tests/PDBDirectoryAndName/mylibA.c +++ b/Tests/PDBDirectoryAndName/mylibA.c @@ -1,4 +1,4 @@ -__declspec(dllexport) int mylibA() +__declspec(dllexport) int mylibA(void) { return 1; } diff --git a/Tests/PDBDirectoryAndName/mylibB.c b/Tests/PDBDirectoryAndName/mylibB.c index 3a95845..8be2aa0 100644 --- a/Tests/PDBDirectoryAndName/mylibB.c +++ b/Tests/PDBDirectoryAndName/mylibB.c @@ -1,4 +1,4 @@ -int mylibB() +int mylibB(void) { return -1; } diff --git a/Tests/PDBDirectoryAndName/mylibC.c b/Tests/PDBDirectoryAndName/mylibC.c index 8982849..64dde72 100644 --- a/Tests/PDBDirectoryAndName/mylibC.c +++ b/Tests/PDBDirectoryAndName/mylibC.c @@ -1,4 +1,4 @@ -__declspec(dllexport) int mylibC() +__declspec(dllexport) int mylibC(void) { return 1; } diff --git a/Tests/PDBDirectoryAndName/mylibD.c b/Tests/PDBDirectoryAndName/mylibD.c index a53b7a2..c9c04d8 100644 --- a/Tests/PDBDirectoryAndName/mylibD.c +++ b/Tests/PDBDirectoryAndName/mylibD.c @@ -1,4 +1,4 @@ -int mylibD() +int mylibD(void) { return -1; } diff --git a/Tests/PerConfig/perconfig.c b/Tests/PerConfig/perconfig.c index d942d45..5162ae0 100644 --- a/Tests/PerConfig/perconfig.c +++ b/Tests/PerConfig/perconfig.c @@ -1,6 +1,6 @@ #include "pcShared.h" extern const char* pcStatic(void); -int main() +int main(void) { pcStatic(); pcShared(); diff --git a/Tests/PolicyScope/main.c b/Tests/PolicyScope/main.c index f8b643a..8488f4e 100644 --- a/Tests/PolicyScope/main.c +++ b/Tests/PolicyScope/main.c @@ -1,4 +1,4 @@ -int main() +int main(void) { return 0; } diff --git a/Tests/PrecompiledHeader/foo1.c b/Tests/PrecompiledHeader/foo1.c index fef2586..e743f8b 100644 --- a/Tests/PrecompiledHeader/foo1.c +++ b/Tests/PrecompiledHeader/foo1.c @@ -2,7 +2,7 @@ # error "Precompiled header foo_precompiled.h has not been loaded." #endif -int main() +int main(void) { return foo(); } diff --git a/Tests/PrecompiledHeader/foo2.c b/Tests/PrecompiledHeader/foo2.c index 3ed04ed..5211f3e 100644 --- a/Tests/PrecompiledHeader/foo2.c +++ b/Tests/PrecompiledHeader/foo2.c @@ -3,7 +3,7 @@ # error "Precompiled header foo_precompiled.h has not been loaded." #endif -int foo() +int foo(void) { return 0; } diff --git a/Tests/RunCMake/AppleTextStubs/foo.c b/Tests/RunCMake/AppleTextStubs/foo.c index 7f39d71..f669327 100644 --- a/Tests/RunCMake/AppleTextStubs/foo.c +++ b/Tests/RunCMake/AppleTextStubs/foo.c @@ -1,5 +1,5 @@ -int foo() +int foo(void) { return 0; } diff --git a/Tests/RunCMake/AppleTextStubs/main.c b/Tests/RunCMake/AppleTextStubs/main.c index dc5ce3d..390f7d1 100644 --- a/Tests/RunCMake/AppleTextStubs/main.c +++ b/Tests/RunCMake/AppleTextStubs/main.c @@ -1,7 +1,7 @@ extern int foo(void); -int main() +int main(void) { return foo(); } diff --git a/Tests/RunCMake/AutoExportDll/foo.c b/Tests/RunCMake/AutoExportDll/foo.c index d13bc3e..b4f3ae0 100644 --- a/Tests/RunCMake/AutoExportDll/foo.c +++ b/Tests/RunCMake/AutoExportDll/foo.c @@ -4,12 +4,12 @@ # define WINAPI #endif -int WINAPI foo() +int WINAPI foo(void) { return 10; } -int bar() +int bar(void) { return 5; } diff --git a/Tests/RunCMake/AutoExportDll/hello2.c b/Tests/RunCMake/AutoExportDll/hello2.c index d4d6b72..66e7caf 100644 --- a/Tests/RunCMake/AutoExportDll/hello2.c +++ b/Tests/RunCMake/AutoExportDll/hello2.c @@ -2,7 +2,7 @@ extern int own_auto_export_function(int i); -void hello2() +void hello2(void) { printf("hello exec:%i", own_auto_export_function(41)); } diff --git a/Tests/RunCMake/AutoExportDll/objlib.c b/Tests/RunCMake/AutoExportDll/objlib.c index 54a9658..4e580c3 100644 --- a/Tests/RunCMake/AutoExportDll/objlib.c +++ b/Tests/RunCMake/AutoExportDll/objlib.c @@ -1,4 +1,4 @@ -int objlib() +int objlib(void) { return 7; } diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c index 0795aaa..bd54d76 100644 --- a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c +++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c @@ -1,5 +1,5 @@ #include <MakeInProjectOnly.h> -int main() +int main(void) { return MakeInProjectOnly(); } diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt b/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt index e24eee7..2b0a661 100644 --- a/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt @@ -1,3 +1,4 @@ ^CMake Error at [^ ]*/Tests/RunCMake/CMP0153/CMP0153-NEW\.cmake:[0-9]+ \(exec_program\): - The exec_program command should not be called; see CMP0153\.$ + The exec_program command should not be called; see CMP0153\. Use + execute_process\(\) instead\.$ diff --git a/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt b/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt index 8f22d4e..d0b9422 100644 --- a/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt @@ -3,4 +3,6 @@ Policy CMP0153 is not set: The exec_program command should not be called\. Run "cmake --help-policy CMP0153" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. + + Use execute_process\(\) instead\. This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5a23b8b..9902e0a 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -535,7 +535,7 @@ add_RunCMake_test(function) add_RunCMake_test(block) add_RunCMake_test(get_filename_component) add_RunCMake_test(get_property) -add_RunCMake_test(if) +add_RunCMake_test(if -DMSYS=${MSYS}) add_RunCMake_test(include) add_RunCMake_test(include_directories) add_RunCMake_test(include_guard) @@ -837,7 +837,8 @@ endif() add_executable(pseudo_llvm-rc pseudo_llvm-rc.c) add_RunCMake_test(CommandLine -DLLVM_RC=$<TARGET_FILE:pseudo_llvm-rc> -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DPython_EXECUTABLE=${Python_EXECUTABLE} - -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>) + -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code> + -DPRINT_STDIN_EXE=$<TARGET_FILE:print_stdin>) add_RunCMake_test(CommandLineTar) if(CMAKE_PLATFORM_NO_VERSIONED_SONAME OR (NOT CMAKE_SHARED_LIBRARY_SONAME_FLAG AND NOT CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)) @@ -1064,7 +1065,7 @@ add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMAKE_C_SIMULATE_ID=${CMAKE_C_SIMULATE_ID} -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}) -add_RunCMake_test("UnityBuild") +add_RunCMake_test(UnityBuild -DCMake_TEST_OBJC=${CMake_TEST_OBJC}) add_RunCMake_test(CMakePresets -DPython_EXECUTABLE=${Python_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA} @@ -1097,3 +1098,8 @@ endif() if(WIN32) add_RunCMake_test(Win32GenEx) endif() + +if(CMake_TEST_IAR_TOOLCHAINS) + add_RunCMake_test(IAR -DCMake_TEST_IAR_TOOLCHAINS=${CMake_TEST_IAR_TOOLCHAINS}) + set_property(TEST RunCMake.IAR APPEND PROPERTY LABELS "IAR") +endif() diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index ca02b76..5086a3b 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -69,3 +69,4 @@ run_cpack_test_subtests( ) run_cpack_test(PROJECT_META "RPM.PROJECT_META;DEB.PROJECT_META" false "MONOLITHIC;COMPONENT") 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") diff --git a/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/ExpectedFiles.cmake new file mode 100644 index 0000000..5341ecd --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/ExpectedFiles.cmake @@ -0,0 +1,16 @@ +if(RunCMake_SUBTEST_SUFFIX STREQUAL "success") + if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(EXPECTED_FILES_COUNT "1") + set(EXPECTED_FILE_CONTENT_1_LIST "/files;/files/1.txt;/files/2.txt;/files/3.txt;/files/4.txt;/files/5.txt;/files/6.txt;/files/7.txt;/files/8.txt;/files/symlink2") + elseif(PACKAGING_TYPE STREQUAL "GROUP") + set(EXPECTED_FILES_COUNT "3") + set(EXPECTED_FILE_1 "duplicate_file-0.1.1-*-g1.${cpack_archive_extension_}") + set(EXPECTED_FILE_CONTENT_1_LIST "/files;/files/1.txt;/files/2.txt;/files/3.txt;/files/4.txt;/files/5.txt;/files/6.txt;/files/symlink2") + set(EXPECTED_FILE_2 "duplicate_file-0.1.1-*-g2.${cpack_archive_extension_}") + set(EXPECTED_FILE_CONTENT_2_LIST "/files;/files/3.txt;/files/4.txt;/files/5.txt;/files/6.txt;/files/7.txt;/files/8.txt") + set(EXPECTED_FILE_3 "duplicate_file-0.1.1-*-c5.${cpack_archive_extension_}") + set(EXPECTED_FILE_CONTENT_3_LIST "/files;/files/5.txt;/files/6.txt;/files/7.txt;/files/8.txt;/files/9.txt") + endif () +else() + set(EXPECTED_FILES_COUNT "0") +endif () diff --git a/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_file-stderr.txt b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_file-stderr.txt new file mode 100644 index 0000000..5544885 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_file-stderr.txt @@ -0,0 +1 @@ +CPack Error: ERROR The data in files with the same filename is different.* diff --git a/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_symlink-stderr.txt b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_symlink-stderr.txt new file mode 100644 index 0000000..5544885 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/conflict_symlink-stderr.txt @@ -0,0 +1 @@ +CPack Error: ERROR The data in files with the same filename is different.* diff --git a/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/test.cmake b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/test.cmake new file mode 100644 index 0000000..89d6784 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DUPLICATE_FILE/test.cmake @@ -0,0 +1,74 @@ +# Create files named 1 to 9 +foreach(i RANGE 1 9) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${i}.txt" "This is file ${i}") +endforeach() + +set(COMPONENT_NAMES c1 c2 c3 c4 c5) +foreach(j RANGE 1 5) + # Select 4 file and install to the component + math(EXPR COMPONENT_IDX "${j} - 1") + list(GET COMPONENT_NAMES "${COMPONENT_IDX}" SELECTED_COMPONENT) + math(EXPR END_FILE "${j} + 4") + foreach(k RANGE ${j} ${END_FILE}) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${k}.txt" DESTINATION "files" COMPONENT ${SELECTED_COMPONENT}) + endforeach() +endforeach() + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "conflict_file") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conflict/1.txt" "This should create a conflict.") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/conflict/1.txt" DESTINATION "files" COMPONENT c2) +endif () + +# You cannot create symlink in Windows test environment. Instead mock the symlink. +if(NOT CMAKE_HOST_WIN32) + file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/2.txt" "${CMAKE_CURRENT_BINARY_DIR}/symlink2" SYMBOLIC) +else() + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/symlink2" "This is file 2") +endif() +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/symlink2" DESTINATION "files" COMPONENT c1) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "conflict_symlink" AND NOT CMAKE_HOST_WIN32) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/conflict) + file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/1.txt" "${CMAKE_CURRENT_BINARY_DIR}/conflict/symlink2" SYMBOLIC) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/conflict/symlink2" DESTINATION "files" COMPONENT c2) +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "conflict_symlink" AND CMAKE_HOST_WIN32) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conflict/symlink2" "This should create a conflict.") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/conflict/symlink2" DESTINATION "files" COMPONENT c2) +else() + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/symlink2" DESTINATION "files" COMPONENT c2) +endif () + + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) + set(CPACK_COMPONENTS_ALL "c1;c2;c3;c4") +elseif(PACKAGING_TYPE STREQUAL "GROUP") + set(CPACK_COMPONENTS_ONE_PACKAGE_PER_GROUP ON) + set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) + include(CPackComponent) + + cpack_add_component_group(g1 DISPLAY_NAME "Group 1") + cpack_add_component_group(g2 DISPLAY_NAME "Group 2") + cpack_add_component(c1 + DISPLAY_NAME "Group 1" + DESCRIPTION "Component for Group 1" + GROUP g1 + ) + cpack_add_component(c2 + DISPLAY_NAME "Group 1" + DESCRIPTION "Component for Group 1" + GROUP g1 + ) + cpack_add_component(c3 + DISPLAY_NAME "Group 2" + DESCRIPTION "Component for Group 2" + GROUP g2 + ) + cpack_add_component(c4 + DISPLAY_NAME "Group 2" + DESCRIPTION "Component for Group 2" + GROUP g2 + ) + + set(CPACK_${GENERATOR_TYPE}_PACKAGE_GROUP g1 g2) +endif () diff --git a/Tests/RunCMake/CXXModules/CMP0155-NEW-result.txt b/Tests/RunCMake/CXXModules/CMP0155-NEW-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/CXXModules/CMP0155-NEW-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/CXXModules/CMP0155-NEW-stderr.txt b/Tests/RunCMake/CXXModules/CMP0155-NEW-stderr.txt deleted file mode 100644 index 0843d0b..0000000 --- a/Tests/RunCMake/CXXModules/CMP0155-NEW-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -(CMake Error in CMakeLists.txt: - The target named "cmp0155-new" has C\+\+ sources that may use modules, but - the compiler does not provide a way to discover the import graph - dependencies\. See the cmake-cxxmodules\(7\) manual and the - CMAKE_CXX_SCAN_FOR_MODULES variable\. -|CMake Error in CMakeLists.txt: - The target named "cmp0155-new" has C\+\+ sources that may use modules, but - modules are not supported by this generator\. See the cmake-cxxmodules\(7\) - manual and the CMAKE_CXX_SCAN_FOR_MODULES variable\. -) diff --git a/Tests/RunCMake/CXXModules/CMP0155-NEW-with-rule.cmake b/Tests/RunCMake/CXXModules/CMP0155-NEW-with-rule.cmake new file mode 100644 index 0000000..9eda4df --- /dev/null +++ b/Tests/RunCMake/CXXModules/CMP0155-NEW-with-rule.cmake @@ -0,0 +1,11 @@ +enable_language(CXX) +set(CMAKE_CXX_SCANDEP_SOURCE "echo") + +cmake_policy(SET CMP0155 NEW) + +add_executable(cmp0155-new-with-rule + sources/module-use.cxx) +set_target_properties(cmp0155-new-with-rule + PROPERTIES + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON) diff --git a/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake b/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake index bea858b..d68775a 100644 --- a/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake +++ b/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake @@ -3,8 +3,8 @@ unset(CMAKE_CXX_SCANDEP_SOURCE) cmake_policy(SET CMP0155 NEW) -add_executable(cmp0155-new - sources/module-use.cxx) +add_library(cmp0155-new + sources/cxx-anchor.cxx) set_target_properties(cmp0155-new PROPERTIES CXX_STANDARD 20 diff --git a/Tests/RunCMake/CXXModules/NinjaForceResponseFile-check.cmake b/Tests/RunCMake/CXXModules/NinjaForceResponseFile-check.cmake new file mode 100644 index 0000000..b8863e7 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaForceResponseFile-check.cmake @@ -0,0 +1,23 @@ +if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(path "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/impl-Debug.ninja") +else () + set(path "${RunCMake_TEST_BINARY_DIR}/build.ninja") +endif () + +if (NOT EXISTS "${path}") + list(APPEND RunCMake_TEST_FAILED + "Failed to find `ninja` build file: '${path}'") +endif () + +file(READ "${path}" rspfiles + REGEX "^ *RSP_FILE =") + +if (rspfiles MATCHES "\\$out\\.rsp$") + message(FATAL_ERROR + "rspfiles for modules should be specified explicitly") +elseif (NOT rspfiles MATCHES "ddi\\.rsp") + message(FATAL_ERROR + "rspfiles for scanning rules should be specified according to scan output filenames") +endif () + +string(REPLACE ";" "\n " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/NinjaForceResponseFile.cmake b/Tests/RunCMake/CXXModules/NinjaForceResponseFile.cmake new file mode 100644 index 0000000..bac3263 --- /dev/null +++ b/Tests/RunCMake/CXXModules/NinjaForceResponseFile.cmake @@ -0,0 +1,27 @@ +# Fake out that we have dyndep; we only need to generate, not actually build +# here. +set(CMAKE_CXX_SCANDEP_SOURCE "") + +enable_language(CXX) + +if (NOT CMAKE_GENERATOR MATCHES "Ninja") + message(FATAL_ERROR + "This test requires a 'Ninja' generator to be used.") +endif () + +set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1) + +add_library(ninja-forced-response-file) +target_sources(ninja-forced-response-file + PRIVATE + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS + "${CMAKE_CURRENT_SOURCE_DIR}/sources" + FILES + sources/module.cxx + sources/module-part.cxx + FILE_SET internal_partitions TYPE CXX_MODULES FILES + sources/module-internal-part.cxx) +target_compile_features(ninja-forced-response-file + PRIVATE + cxx_std_20) diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake index e687e9f..781c708 100644 --- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake @@ -23,6 +23,7 @@ if ("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES) run_cmake(NoScanningVariable) run_cmake(CMP0155-OLD) run_cmake(CMP0155-NEW) + run_cmake(CMP0155-NEW-with-rule) endif () if (RunCMake_GENERATOR MATCHES "Ninja") @@ -94,6 +95,7 @@ if (RunCMake_GENERATOR MATCHES "Ninja") run_cmake(NinjaDependInfoFileSet) run_cmake(NinjaDependInfoExport) run_cmake(NinjaDependInfoBMIInstall) + run_cmake(NinjaForceResponseFile) # issue#25367 elseif (RunCMake_GENERATOR MATCHES "Visual Studio") run_cmake(VisualStudioNoSyntheticTargets) else () diff --git a/Tests/RunCMake/CXXModules/sources/c-anchor.c b/Tests/RunCMake/CXXModules/sources/c-anchor.c index c782188..8adfcbb 100644 --- a/Tests/RunCMake/CXXModules/sources/c-anchor.c +++ b/Tests/RunCMake/CXXModules/sources/c-anchor.c @@ -1,4 +1,4 @@ -int c_anchor() +int c_anchor(void) { return 0; } diff --git a/Tests/RunCMake/CommandLine/E_cat-stdin-stdout.txt b/Tests/RunCMake/CommandLine/E_cat-stdin-stdout.txt new file mode 100644 index 0000000..8210d59 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat-stdin-stdout.txt @@ -0,0 +1 @@ +^Hello world$ diff --git a/Tests/RunCMake/CommandLine/E_cat-stdin.cmake b/Tests/RunCMake/CommandLine/E_cat-stdin.cmake new file mode 100644 index 0000000..e83e619 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_cat-stdin.cmake @@ -0,0 +1,10 @@ +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ell.txt" "ell") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/rld.txt" "rld") +execute_process( + COMMAND ${CMAKE_COMMAND} -E echo_append "H" + COMMAND ${CMAKE_COMMAND} -E cat - + ) +execute_process( + COMMAND ${CMAKE_COMMAND} -E echo_append "o wo" + COMMAND ${CMAKE_COMMAND} -E cat "${CMAKE_CURRENT_BINARY_DIR}/ell.txt" - "${CMAKE_CURRENT_BINARY_DIR}/rld.txt" + ) diff --git a/Tests/RunCMake/CommandLine/E_env-stdin-stdout.txt b/Tests/RunCMake/CommandLine/E_env-stdin-stdout.txt new file mode 100644 index 0000000..8210d59 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-stdin-stdout.txt @@ -0,0 +1 @@ +^Hello world$ diff --git a/Tests/RunCMake/CommandLine/E_env-stdin.cmake b/Tests/RunCMake/CommandLine/E_env-stdin.cmake new file mode 100644 index 0000000..4ff0ad2 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_env-stdin.cmake @@ -0,0 +1,4 @@ +execute_process( + COMMAND ${CMAKE_COMMAND} -E echo "Hello world" + COMMAND ${CMAKE_COMMAND} -E env ${PRINT_STDIN_EXE} + ) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 52be1bb..03b9301 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -782,6 +782,8 @@ run_cmake_command(E_cat-without-double-dash ${CMAKE_COMMAND} -E cat "-file-start unset(RunCMake_TEST_COMMAND_WORKING_DIRECTORY) unset(out) +run_cmake_command(E_cat-stdin ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_cat-stdin.cmake) + # Unset environment variables that are used for testing cmake -E unset(ENV{TEST_ENV}) unset(ENV{TEST_ENV_EXPECTED}) @@ -791,6 +793,7 @@ run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) run_cmake_command(E_env-set ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-set.cmake) run_cmake_command(E_env-unset ${CMAKE_COMMAND} -E env TEST_ENV=1 ${CMAKE_COMMAND} -E env --unset=TEST_ENV ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_env-unset.cmake) +run_cmake_command(E_env-stdin ${CMAKE_COMMAND} -DPRINT_STDIN_EXE=${PRINT_STDIN_EXE} -P ${RunCMake_SOURCE_DIR}/E_env-stdin.cmake) # To test whether the double dash (--) works for the env command, we need a command that e.g. contains an equals sign (=) # and would normally be interpreted as an NAME=VALUE environment variable. diff --git a/Tests/RunCMake/CompileDefinitions/foo.c b/Tests/RunCMake/CompileDefinitions/foo.c index 74a86e1..7d75e37 100644 --- a/Tests/RunCMake/CompileDefinitions/foo.c +++ b/Tests/RunCMake/CompileDefinitions/foo.c @@ -1,4 +1,4 @@ -void foo() +void foo(void) { } diff --git a/Tests/RunCMake/CompileWarningAsError/warn.c b/Tests/RunCMake/CompileWarningAsError/warn.c index cd0c2ba..4041167 100644 --- a/Tests/RunCMake/CompileWarningAsError/warn.c +++ b/Tests/RunCMake/CompileWarningAsError/warn.c @@ -1,4 +1,4 @@ -static void unused_function(); +static void unused_function(void); #ifdef __SUNPRO_C KandR(x) int x; diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt index b7db7eb..bc5d9ea 100644 --- a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-JOM.txt @@ -3,7 +3,8 @@ CMake Error at BadCompilerC.cmake:2 \(enable_language\): no-C-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? To use the JOM generator with Visual C\+\+, cmake must be run from a shell that can use the compiler cl from the command line. This environment is diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt index 03c5933..80d8a21 100644 --- a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr-NMake.txt @@ -3,7 +3,8 @@ CMake Error at BadCompilerC.cmake:2 \(enable_language\): no-C-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? To use the NMake generator with Visual C\+\+, cmake must be run from a shell that can use the compiler cl from the command line. This environment is diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt index c98842d..96d02de 100644 --- a/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerC-stderr.txt @@ -3,7 +3,8 @@ CMake Error at BadCompilerC.cmake:2 \(enable_language\): no-C-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? Tell CMake where to find the compiler by setting either the environment variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt index 4b42ea6..d108787 100644 --- a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-JOM.txt @@ -3,7 +3,8 @@ CMake Error at BadCompilerCXX.cmake:2 \(enable_language\): no-CXX-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? To use the JOM generator with Visual C\+\+, cmake must be run from a shell that can use the compiler cl from the command line. This environment is diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt index 1bfcdcc..d3c0ccd 100644 --- a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr-NMake.txt @@ -3,7 +3,8 @@ CMake Error at BadCompilerCXX.cmake:2 \(enable_language\): no-CXX-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? To use the NMake generator with Visual C\+\+, cmake must be run from a shell that can use the compiler cl from the command line. This environment is diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt index 7ef4f5e..79db41d 100644 --- a/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCXX-stderr.txt @@ -3,7 +3,8 @@ CMake Error at BadCompilerCXX.cmake:2 \(enable_language\): no-CXX-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt index f25a267..360a8c2 100644 --- a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-JOM.txt @@ -3,7 +3,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\): no-C-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? To use the JOM generator with Visual C\+\+, cmake must be run from a shell that can use the compiler cl from the command line. This environment is @@ -21,7 +22,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\): no-CXX-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? To use the JOM generator with Visual C\+\+, cmake must be run from a shell that can use the compiler cl from the command line. This environment is diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt index ffcdce8..8438d0e 100644 --- a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr-NMake.txt @@ -3,7 +3,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\): no-C-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? To use the NMake generator with Visual C\+\+, cmake must be run from a shell that can use the compiler cl from the command line. This environment is @@ -21,7 +22,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\): no-CXX-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? To use the NMake generator with Visual C\+\+, cmake must be run from a shell that can use the compiler cl from the command line. This environment is diff --git a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt index eecff54..cba0db2 100644 --- a/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt +++ b/Tests/RunCMake/CompilerNotFound/BadCompilerCandCXX-stderr.txt @@ -3,7 +3,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\): no-C-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? Tell CMake where to find the compiler by setting either the environment variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to @@ -16,7 +17,8 @@ CMake Error at BadCompilerCandCXX.cmake:3 \(project\): no-CXX-compiler - is not a full path and was not found in the PATH. + is not a full path and was not found in the PATH.( Perhaps the extension is + missing\?)? Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path diff --git a/Tests/RunCMake/ExcludeFromAll/main.c b/Tests/RunCMake/ExcludeFromAll/main.c index f8b643a..8488f4e 100644 --- a/Tests/RunCMake/ExcludeFromAll/main.c +++ b/Tests/RunCMake/ExcludeFromAll/main.c @@ -1,4 +1,4 @@ -int main() +int main(void) { return 0; } diff --git a/Tests/RunCMake/File_Generate/empty.c b/Tests/RunCMake/File_Generate/empty.c index f097d0a..05ffe2d 100644 --- a/Tests/RunCMake/File_Generate/empty.c +++ b/Tests/RunCMake/File_Generate/empty.c @@ -2,7 +2,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif - int empty_c() + int empty_c(void) { return 0; } diff --git a/Tests/RunCMake/Framework/consumer.c b/Tests/RunCMake/Framework/consumer.c index a578976..4208a73 100644 --- a/Tests/RunCMake/Framework/consumer.c +++ b/Tests/RunCMake/Framework/consumer.c @@ -1,7 +1,7 @@ #include <Gui2/Gui.h> -int consumer() +int consumer(void) { foo(); diff --git a/Tests/RunCMake/Framework/foo.c b/Tests/RunCMake/Framework/foo.c index b85b60d..6c1d727 100644 --- a/Tests/RunCMake/Framework/foo.c +++ b/Tests/RunCMake/Framework/foo.c @@ -1,4 +1,4 @@ -int foo() +int foo(void) { return 42; } diff --git a/Tests/RunCMake/Framework/foo.h b/Tests/RunCMake/Framework/foo.h index 5d5f8f0..5a2ca62 100644 --- a/Tests/RunCMake/Framework/foo.h +++ b/Tests/RunCMake/Framework/foo.h @@ -1 +1 @@ -int foo(); +int foo(void); diff --git a/Tests/RunCMake/Framework/main.c b/Tests/RunCMake/Framework/main.c index fc09922..74ae236 100644 --- a/Tests/RunCMake/Framework/main.c +++ b/Tests/RunCMake/Framework/main.c @@ -1,7 +1,7 @@ #include <Gui/Gui.h> -int main() +int main(void) { foo(); diff --git a/Tests/RunCMake/Framework/main2.c b/Tests/RunCMake/Framework/main2.c index 11f4e4d..26908d7 100644 --- a/Tests/RunCMake/Framework/main2.c +++ b/Tests/RunCMake/Framework/main2.c @@ -1,7 +1,7 @@ #include <Gui2/Gui.h> -int main() +int main(void) { foo(); diff --git a/Tests/RunCMake/Graphviz/test_project/core_library.c b/Tests/RunCMake/Graphviz/test_project/core_library.c index e8a8844..ce390ce 100644 --- a/Tests/RunCMake/Graphviz/test_project/core_library.c +++ b/Tests/RunCMake/Graphviz/test_project/core_library.c @@ -1,3 +1,3 @@ -void log_something() +void log_something(void) { } diff --git a/Tests/RunCMake/Graphviz/test_project/graphic_library.c b/Tests/RunCMake/Graphviz/test_project/graphic_library.c index 958c8ab..7a31ad4 100644 --- a/Tests/RunCMake/Graphviz/test_project/graphic_library.c +++ b/Tests/RunCMake/Graphviz/test_project/graphic_library.c @@ -1,3 +1,3 @@ -void initialize_graphics() +void initialize_graphics(void) { } diff --git a/Tests/RunCMake/Graphviz/test_project/module.c b/Tests/RunCMake/Graphviz/test_project/module.c index a508b09..56e833d 100644 --- a/Tests/RunCMake/Graphviz/test_project/module.c +++ b/Tests/RunCMake/Graphviz/test_project/module.c @@ -1,3 +1,3 @@ -static void some_function() +static void some_function(void) { } diff --git a/Tests/RunCMake/Graphviz/test_project/system_library.c b/Tests/RunCMake/Graphviz/test_project/system_library.c index 5d67079..896bca4 100644 --- a/Tests/RunCMake/Graphviz/test_project/system_library.c +++ b/Tests/RunCMake/Graphviz/test_project/system_library.c @@ -1,3 +1,3 @@ -void initialize_system() +void initialize_system(void) { } diff --git a/Tests/RunCMake/IAR/CMakeLists.txt b/Tests/RunCMake/IAR/CMakeLists.txt new file mode 100644 index 0000000..6a9ce76 --- /dev/null +++ b/Tests/RunCMake/IAR/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.28) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/IAR/RunCMakeTest.cmake b/Tests/RunCMake/IAR/RunCMakeTest.cmake new file mode 100644 index 0000000..2049740 --- /dev/null +++ b/Tests/RunCMake/IAR/RunCMakeTest.cmake @@ -0,0 +1,64 @@ +include(RunCMake) + +if(RunCMake_GENERATOR MATCHES "Makefile|Ninja") + file(GLOB _iar_toolchains + "${CMake_TEST_IAR_TOOLCHAINS}/bx*-*/*/bin/icc*" ) + if(_iar_toolchains STREQUAL "") + message(FATAL_ERROR "Could not find any IAR toolchains at: ${CMake_TEST_IAR_TOOLCHAINS}.") + endif() +endif() + +foreach(_iar_toolchain IN LISTS _iar_toolchains) + message(STATUS "Found IAR toolchain: ${_iar_toolchain}") + cmake_path(GET _iar_toolchain PARENT_PATH BIN_DIR) + cmake_path(GET BIN_DIR PARENT_PATH TOOLKIT_DIR) + cmake_path(GET TOOLKIT_DIR FILENAME ARCH) + + # Sets the minimal requirements for linking each target architecture + if(ARCH STREQUAL rl78) + set(LINK_OPTS +"--config_def _STACK_SIZE=256 \ +--config_def _NEAR_HEAP_SIZE=0x400 \ +--config_def _FAR_HEAP_SIZE=4096 \ +--config_def _HUGE_HEAP_SIZE=0 \ +--config_def _NEAR_CONST_LOCATION_START=0x2000 \ +--config_def _NEAR_CONST_LOCATION_SIZE=0x6F00 \ +--define_symbol _NEAR_CONST_LOCATION=0 \ +--config ${TOOLKIT_DIR}/config/lnkrl78_s3.icf" ) + else() + set(LINK_OPTS "") + endif() + + # Set IAR Assembler (ILINK || XLINK) + find_program(IAR_ASSEMBLER + NAMES iasm${ARCH} a${ARCH} + PATHS ${BIN_DIR} + REQUIRED ) + + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Generic + -DCMAKE_C_COMPILER=${_iar_toolchain} + -DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS} + ) + run_cmake(iar-c) + + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Generic + -DCMAKE_CXX_COMPILER=${_iar_toolchain} + -DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS} + ) + run_cmake(iar-cxx) + + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Generic + -DCMAKE_ASM_COMPILER=${IAR_ASSEMBLER} + ) + run_cmake(iar-asm) + + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Generic + -DCMAKE_C_COMPILER=${_iar_toolchain} + -DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS} + ) + run_cmake(iar-lib) +endforeach() diff --git a/Tests/RunCMake/IAR/iar-asm.cmake b/Tests/RunCMake/IAR/iar-asm.cmake new file mode 100644 index 0000000..7ff64f6 --- /dev/null +++ b/Tests/RunCMake/IAR/iar-asm.cmake @@ -0,0 +1,5 @@ +enable_language(ASM) + +add_executable(exec-asm) +target_sources(exec-asm PRIVATE module.asm) +target_link_options(exec-asm PRIVATE ${LINKER_OPTS}) diff --git a/Tests/RunCMake/IAR/iar-c.cmake b/Tests/RunCMake/IAR/iar-c.cmake new file mode 100644 index 0000000..a36f096 --- /dev/null +++ b/Tests/RunCMake/IAR/iar-c.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_executable(exec-c) +target_sources(exec-c PRIVATE module.c) +target_link_options(exec-c PRIVATE ${LINKER_OPTS}) diff --git a/Tests/RunCMake/IAR/iar-cxx.cmake b/Tests/RunCMake/IAR/iar-cxx.cmake new file mode 100644 index 0000000..6b005b5 --- /dev/null +++ b/Tests/RunCMake/IAR/iar-cxx.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) + +add_executable(exec-cxx) +target_sources(exec-cxx PRIVATE module.cxx) +target_link_options(exec-cxx PRIVATE ${LINKER_OPTS}) diff --git a/Tests/RunCMake/IAR/iar-lib.cmake b/Tests/RunCMake/IAR/iar-lib.cmake new file mode 100644 index 0000000..78b3136 --- /dev/null +++ b/Tests/RunCMake/IAR/iar-lib.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +add_library(iar-test-lib) +target_sources(iar-test-lib PRIVATE libmod.c) + +add_executable(exec-lib-c) +target_sources(exec-lib-c PRIVATE module.c) +target_compile_definitions(exec-lib-c PRIVATE __USE_LIBFUN) +target_link_libraries(exec-lib-c LINK_PUBLIC iar-test-lib) +target_link_options(exec-lib-c PRIVATE ${LINKER_OPTS}) diff --git a/Tests/RunCMake/IAR/libmod.c b/Tests/RunCMake/IAR/libmod.c new file mode 100644 index 0000000..d6c3b73 --- /dev/null +++ b/Tests/RunCMake/IAR/libmod.c @@ -0,0 +1,4 @@ +int iar_libfun() +{ + return 42; +} diff --git a/Tests/RunCMake/IAR/module.asm b/Tests/RunCMake/IAR/module.asm new file mode 100644 index 0000000..1e08236 --- /dev/null +++ b/Tests/RunCMake/IAR/module.asm @@ -0,0 +1,41 @@ +#if defined(__IASM8051__) || defined(__IASM430__) + NAME main +#else + MODULE main +#endif + + PUBLIC main + PUBLIC __iar_program_start + PUBLIC __program_start + +#if defined(__IASMSTM8__) + EXTERN CSTACK$$Limit + SECTION `.near_func.text`:CODE:NOROOT(0) +#elif defined(__IASMAVR__) + ORG $0 + RJMP main + RSEG CODE +#elif defined(__IASM8051__) + ORG 0FFFEh + DC16 main + RSEG RCODE +?cmain: +#elif defined(__IASM430__) + ORG 0FFFEh + DC16 init + RSEG CSTACK + RSEG CODE +init: + MOV #SFE(CSTACK), SP +#else + EXTERN __iar_static_base$$GPREL + SECTION CSTACK:DATA:NOROOT(4) + SECTION `.cstartup`:CODE(2) + CODE +#endif + +__program_start: +__iar_program_start: +main: + NOP + END diff --git a/Tests/RunCMake/IAR/module.c b/Tests/RunCMake/IAR/module.c new file mode 100644 index 0000000..2f72a42 --- /dev/null +++ b/Tests/RunCMake/IAR/module.c @@ -0,0 +1,14 @@ +#include "module.h" +#if defined(__USE_LIBFUN) +extern int iar_libfun(); +#endif +__root int i; +__root int main() +{ +#if defined(__USE_LIBFUN) + i = iar_libfun(); +#else + i = INTERNAL; +#endif + return i; +} diff --git a/Tests/RunCMake/IAR/module.cxx b/Tests/RunCMake/IAR/module.cxx new file mode 100644 index 0000000..5604435 --- /dev/null +++ b/Tests/RunCMake/IAR/module.cxx @@ -0,0 +1,7 @@ +#include "module.h" +__root int i; +__root int main() +{ + i = INTERNAL; + return i; +} diff --git a/Tests/RunCMake/IAR/module.h b/Tests/RunCMake/IAR/module.h new file mode 100644 index 0000000..5f9c87b --- /dev/null +++ b/Tests/RunCMake/IAR/module.h @@ -0,0 +1,14 @@ +#ifndef __MODULE_H__ +#define __MODULE_H__ + +#if defined(__cplusplus) +# define INTERNAL 64 +#elif !defined(__cplusplus) && defined(__IAR_SYSTEMS_ICC__) +# define INTERNAL 32 +#elif defined(__IAR_SYSTEMS_ASM__) +# define INTERNAL 16 +#else +# error "Unable to determine INTERNAL symbol." +#endif /* __IAR_SYSTEMS_ICC */ + +#endif /* __MODULE_H__ */ diff --git a/Tests/RunCMake/Ninja/dep.c b/Tests/RunCMake/Ninja/dep.c index 728f031..a576b6e 100644 --- a/Tests/RunCMake/Ninja/dep.c +++ b/Tests/RunCMake/Ninja/dep.c @@ -1,4 +1,4 @@ -int dep() +int dep(void) { return 0; } diff --git a/Tests/RunCMake/Ninja/top.c b/Tests/RunCMake/Ninja/top.c index 4a88eb2..0358244 100644 --- a/Tests/RunCMake/Ninja/top.c +++ b/Tests/RunCMake/Ninja/top.c @@ -1,7 +1,7 @@ #include "command.h" #include "target.h" -int top() +int top(void) { return 0; } diff --git a/Tests/RunCMake/ObjectLibrary/exe.c b/Tests/RunCMake/ObjectLibrary/exe.c index 2e08700..25d7784 100644 --- a/Tests/RunCMake/ObjectLibrary/exe.c +++ b/Tests/RunCMake/ObjectLibrary/exe.c @@ -5,7 +5,7 @@ #endif extern IMPORT int b(void); -int main() +int main(void) { return b(); } diff --git a/Tests/RunCMake/PrecompileHeaders/foo.c b/Tests/RunCMake/PrecompileHeaders/foo.c index eb88726..a4710fd 100644 --- a/Tests/RunCMake/PrecompileHeaders/foo.c +++ b/Tests/RunCMake/PrecompileHeaders/foo.c @@ -2,12 +2,12 @@ #include "foo2.h" -int foo() +int foo(void) { return 0; } -int foo2() +int foo2(void) { return 0; } diff --git a/Tests/RunCMake/PrecompileHeaders/foobar.c b/Tests/RunCMake/PrecompileHeaders/foobar.c index 97d465c..71ebe37 100644 --- a/Tests/RunCMake/PrecompileHeaders/foobar.c +++ b/Tests/RunCMake/PrecompileHeaders/foobar.c @@ -2,7 +2,7 @@ #include "foo.h" #include "foo2.h" -int main() +int main(void) { int zeroSize = 0; diff --git a/Tests/RunCMake/PrecompileHeaders/include/bar.h b/Tests/RunCMake/PrecompileHeaders/include/bar.h index 5feb983..89a156c 100644 --- a/Tests/RunCMake/PrecompileHeaders/include/bar.h +++ b/Tests/RunCMake/PrecompileHeaders/include/bar.h @@ -1,7 +1,7 @@ #ifndef bar_h #define bar_h -static int bar() +static int bar(void) { return 0; } diff --git a/Tests/RunCMake/PrintHelpers/nothing.c b/Tests/RunCMake/PrintHelpers/nothing.c index 32b7b39..1d11f33 100644 --- a/Tests/RunCMake/PrintHelpers/nothing.c +++ b/Tests/RunCMake/PrintHelpers/nothing.c @@ -1,6 +1,6 @@ #include "nothing.h" -void nothing() +void nothing(void) { (void*)0; } diff --git a/Tests/RunCMake/PrintHelpers/something.c b/Tests/RunCMake/PrintHelpers/something.c index a2bc425..90482c9 100644 --- a/Tests/RunCMake/PrintHelpers/something.c +++ b/Tests/RunCMake/PrintHelpers/something.c @@ -1,6 +1,6 @@ #include "something.h" -int main() +int main(void) { nothing(); return 0; diff --git a/Tests/RunCMake/SourceProperties/empty.c b/Tests/RunCMake/SourceProperties/empty.c index a9ec102..768abc2 100644 --- a/Tests/RunCMake/SourceProperties/empty.c +++ b/Tests/RunCMake/SourceProperties/empty.c @@ -1,5 +1,5 @@ -int empty() +int empty(void) { return 0; } diff --git a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake index e3643c0..0ec8c42 100644 --- a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake +++ b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake @@ -14,6 +14,13 @@ run_cmake(unitybuild_cxx) run_cmake(unitybuild_cxx_group) run_cmake(unitybuild_c_and_cxx) run_cmake(unitybuild_c_and_cxx_group) +if(CMake_TEST_OBJC) + run_cmake(unitybuild_objc) + run_cmake(unitybuild_objc_group) + run_cmake(unitybuild_objcxx) + run_cmake(unitybuild_objcxx_group) + run_cmake(unitybuild_c_and_cxx_and_objc_and_objcxx) +endif() run_cmake(unitybuild_batchsize) run_cmake(unitybuild_default_batchsize) run_cmake(unitybuild_skip) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_and_objc_and_objcxx.cmake b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_and_objc_and_objcxx.cmake new file mode 100644 index 0000000..096a86b --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_c_and_cxx_and_objc_and_objcxx.cmake @@ -0,0 +1,25 @@ +project(unitybuild_c_and_cxx_and_objc_and_objcxx C CXX OBJC OBJCXX) + +set(srcs "") +foreach(s RANGE 1 8) + 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") + + set(src_objc "${CMAKE_CURRENT_BINARY_DIR}/s${s}.m") + file(WRITE "${src_objc}" "int s${s}(void) { return 0; }\n") + + set(src_objcxx "${CMAKE_CURRENT_BINARY_DIR}/s${s}.mm") + file(WRITE "${src_objcxx}" "int s${s}(void) { return 0; }\n") + + list(APPEND srcs "${src_c}") + list(APPEND srcs "${src_cxx}") + list(APPEND srcs "${src_objc}") + list(APPEND srcs "${src_objcxx}") +endforeach() + +add_library(tgt SHARED ${srcs}) + +set_target_properties(tgt PROPERTIES UNITY_BUILD ON) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_objc.cmake b/Tests/RunCMake/UnityBuild/unitybuild_objc.cmake new file mode 100644 index 0000000..cc88d98 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_objc.cmake @@ -0,0 +1,12 @@ +project(unitybuild_objc OBJC) + +set(srcs "") +foreach(s RANGE 1 8) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.m") + 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) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_objc_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_objc_group.cmake new file mode 100644 index 0000000..384c98a --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_objc_group.cmake @@ -0,0 +1,27 @@ +project(unitybuild_objc_group OBJC) + +set(srcs "") +foreach(s RANGE 1 4) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.m") + file(WRITE "${src}" "int s${s}(void) { return 0; }\n") + list(APPEND srcs "${src}") +endforeach() + +foreach(s RANGE 1 2) + set(src "${CMAKE_CURRENT_BINARY_DIR}/odr${s}.m") + file(WRITE "${src}" "namespace odr { 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_MODE GROUP + ) + +set_source_files_properties(s1.m s2.m odr1.m + PROPERTIES UNITY_GROUP "a" + ) +set_source_files_properties(s3.m s4.m odr2.m + PROPERTIES UNITY_GROUP "b" + ) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_objcxx.cmake b/Tests/RunCMake/UnityBuild/unitybuild_objcxx.cmake new file mode 100644 index 0000000..fd0f743 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_objcxx.cmake @@ -0,0 +1,12 @@ +project(unitybuild_objcxx OBJCXX) + +set(srcs "") +foreach(s RANGE 1 8) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.mm") + 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) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_objcxx_group.cmake b/Tests/RunCMake/UnityBuild/unitybuild_objcxx_group.cmake new file mode 100644 index 0000000..517703e --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_objcxx_group.cmake @@ -0,0 +1,27 @@ +project(unitybuild_objcxx_group OBJCXX) + +set(srcs "") +foreach(s RANGE 1 4) + set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.mm") + file(WRITE "${src}" "int s${s}(void) { return 0; }\n") + list(APPEND srcs "${src}") +endforeach() + +foreach(s RANGE 1 2) + set(src "${CMAKE_CURRENT_BINARY_DIR}/odr${s}.mm") + file(WRITE "${src}" "namespace odr { 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_MODE GROUP + ) + +set_source_files_properties(s1.mm s2.mm odr1.mm + PROPERTIES UNITY_GROUP "a" + ) +set_source_files_properties(s3.mm s4.mm odr2.mm + PROPERTIES UNITY_GROUP "b" + ) diff --git a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c index c00fce7..76ca54e 100644 --- a/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c +++ b/Tests/RunCMake/XcodeProject-Device/DeploymentTarget.c @@ -25,6 +25,6 @@ # error unknown OS #endif -void foo() +void foo(void) { } diff --git a/Tests/RunCMake/XcodeProject/XcodeXCConfig.c b/Tests/RunCMake/XcodeProject/XcodeXCConfig.c index ac59a6b..20aab00 100644 --- a/Tests/RunCMake/XcodeProject/XcodeXCConfig.c +++ b/Tests/RunCMake/XcodeProject/XcodeXCConfig.c @@ -15,6 +15,6 @@ # error TARGET_DEBUG does not match BUILD_DEBUG #endif -void some_symbol() +void some_symbol(void) { } diff --git a/Tests/RunCMake/add_compile_definitions/foo.c b/Tests/RunCMake/add_compile_definitions/foo.c index 74a86e1..7d75e37 100644 --- a/Tests/RunCMake/add_compile_definitions/foo.c +++ b/Tests/RunCMake/add_compile_definitions/foo.c @@ -1,4 +1,4 @@ -void foo() +void foo(void) { } diff --git a/Tests/RunCMake/add_custom_command/a.c b/Tests/RunCMake/add_custom_command/a.c index 707c1c3..4ef3698 100644 --- a/Tests/RunCMake/add_custom_command/a.c +++ b/Tests/RunCMake/add_custom_command/a.c @@ -1,3 +1,3 @@ -void a() +void a(void) { } diff --git a/Tests/RunCMake/add_dependencies/a.c b/Tests/RunCMake/add_dependencies/a.c index 707c1c3..4ef3698 100644 --- a/Tests/RunCMake/add_dependencies/a.c +++ b/Tests/RunCMake/add_dependencies/a.c @@ -1,3 +1,3 @@ -void a() +void a(void) { } diff --git a/Tests/RunCMake/add_dependencies/b.c b/Tests/RunCMake/add_dependencies/b.c index 57b2900..c7c7df4 100644 --- a/Tests/RunCMake/add_dependencies/b.c +++ b/Tests/RunCMake/add_dependencies/b.c @@ -1,3 +1,3 @@ -void b() +void b(void) { } diff --git a/Tests/RunCMake/add_dependencies/c.c b/Tests/RunCMake/add_dependencies/c.c index cbf94ca..e2fa6de 100644 --- a/Tests/RunCMake/add_dependencies/c.c +++ b/Tests/RunCMake/add_dependencies/c.c @@ -1,3 +1,3 @@ -void c() +void c(void) { } diff --git a/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c b/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c index babe82d..009162d 100644 --- a/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c +++ b/Tests/RunCMake/ctest_labels_for_subprojects/MyThirdPartyDependency/src/thirdparty.c @@ -7,7 +7,7 @@ int main(void) return 0; } -int notcalled() +int notcalled(void) { printf(This function doesn't get called.\n"); return 0; diff --git a/Tests/RunCMake/if/FilePermissions.cmake b/Tests/RunCMake/if/FilePermissions.cmake new file mode 100644 index 0000000..7881b5f --- /dev/null +++ b/Tests/RunCMake/if/FilePermissions.cmake @@ -0,0 +1,153 @@ + +file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt" + "${CMAKE_CURRENT_BINARY_DIR}/writable.txt" + "${CMAKE_CURRENT_BINARY_DIR}/executable.txt") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt" "foo") +file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/readable.txt" PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/writable.txt" "foo") +file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/writable.txt" PERMISSIONS OWNER_WRITE GROUP_WRITE WORLD_WRITE) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt" "foo") +file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/executable.txt" PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE) + +if(NOT WIN32) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/readable-dir" + "${CMAKE_CURRENT_BINARY_DIR}/writable-dir" + "${CMAKE_CURRENT_BINARY_DIR}/executable-dir") + + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/readable-dir") + file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/readable-dir" PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) + + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/writable-dir") + file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/writable-dir" PERMISSIONS OWNER_WRITE GROUP_WRITE WORLD_WRITE) + + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/executable-dir") + file(CHMOD "${CMAKE_CURRENT_BINARY_DIR}/executable-dir" PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE) +endif() + +if(WIN32) + # files are always readable and executable + # directories are always, readable, writable and executable + if(NOT IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt" + OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/readable.txt\" failed") + endif() + + if(NOT IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt" + OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/executable.txt\" failed") + endif() +else() + if(NOT IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt" + OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt" + OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/readable.txt") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/readable.txt\" failed") + endif() + + if(NOT IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/writable.txt" + OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/writable.txt" + OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/writable.txt") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/writable.txt\" failed") + endif() + + if(NOT IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt" + OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt" + OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/executable.txt") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/executable.txt\" failed") + endif() + + + if(NOT IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/readable-dir" + OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/readable-dir" + OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/readable-dir") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/readable-dir\" failed") + endif() + + if(NOT IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/writable-dir" + OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/writable-dir" + OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/writable-dir") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/writable-dir\" failed") + endif() + + if(NOT IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/executable-dir" + OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/executable-dir" + OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/executable-dir") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/executable.txt\" failed") + endif() +endif() + +if(UNIX) + # + # Check that file permissions are on the real file, not the symbolic link + # + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt" + "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt" + "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt" + "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir" + "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir" + "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir") + + file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/readable.txt" + "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt" + SYMBOLIC) + + file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/writable.txt" + "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt" + SYMBOLIC) + + file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/executable.txt" + "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt" + SYMBOLIC) + + + file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/readable-dir" + "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir" + SYMBOLIC) + + file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/writable-dir" + "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir" + SYMBOLIC) + + file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}/executable-dir" + "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir" + SYMBOLIC) + + if(NOT IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt" + OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt" + OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-readable.txt\" failed") + endif() + + if(NOT IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt" + OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt" + OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-writable.txt\" failed") + endif() + + if(NOT IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt" + OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt" + OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-executable.txt\" failed") + endif() + + + if(NOT IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir" + OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir" + OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-readable-dir\" failed") + endif() + + if(NOT IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir" + OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir" + OR IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-writable-dir\" failed") + endif() + + if(NOT IS_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir" + OR IS_READABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir" + OR IS_WRITABLE "${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir") + message(FATAL_ERROR "checks on \"${CMAKE_CURRENT_BINARY_DIR}/link-to-executable-dir\" failed") + endif() +endif() diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake index efee116..0bfff90 100644 --- a/Tests/RunCMake/if/RunCMakeTest.cmake +++ b/Tests/RunCMake/if/RunCMakeTest.cmake @@ -2,6 +2,23 @@ include(RunCMake) run_cmake(InvalidArgument1) run_cmake(exists) +if(NOT MSYS) + # permissions and symbolic links are broken on MSYS + unset(uid) + unset(status) + if(UNIX) + set(ID "id") + if (CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND EXISTS "/usr/xpg4/bin/id") + set (ID "/usr/xpg4/bin/id") + endif() + # if real user is root, tests are irrelevant + execute_process(COMMAND ${ID} -u $ENV{USER} OUTPUT_VARIABLE uid ERROR_QUIET + RESULT_VARIABLE status OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + if(NOT status AND NOT uid STREQUAL "0") + run_cmake(FilePermissions) + endif() +endif() run_cmake(IsDirectory) run_cmake(IsDirectoryLong) run_cmake(duplicate-deep-else) diff --git a/Tests/RunCMake/print_stdin.c b/Tests/RunCMake/print_stdin.c index e083e62..76b3a84 100644 --- a/Tests/RunCMake/print_stdin.c +++ b/Tests/RunCMake/print_stdin.c @@ -1,6 +1,6 @@ #include <stdio.h> -int main() +int main(void) { char buf[1024]; size_t nIn = sizeof(buf); diff --git a/Tests/RunCMake/showIncludes.c b/Tests/RunCMake/showIncludes.c index 7d467cf..5114965 100644 --- a/Tests/RunCMake/showIncludes.c +++ b/Tests/RunCMake/showIncludes.c @@ -10,7 +10,7 @@ #include <stdio.h> #include <stdlib.h> -int main() +int main(void) { /* 'cl /showIncludes' encodes output in the console output code page. */ unsigned int cp = GetConsoleOutputCP(); diff --git a/Tests/RunCMake/target_compile_definitions/foo.c b/Tests/RunCMake/target_compile_definitions/foo.c index 74a86e1..7d75e37 100644 --- a/Tests/RunCMake/target_compile_definitions/foo.c +++ b/Tests/RunCMake/target_compile_definitions/foo.c @@ -1,4 +1,4 @@ -void foo() +void foo(void) { } diff --git a/Tests/RunCMake/target_compile_features/empty.c b/Tests/RunCMake/target_compile_features/empty.c index 11ec041..8d91e77 100644 --- a/Tests/RunCMake/target_compile_features/empty.c +++ b/Tests/RunCMake/target_compile_features/empty.c @@ -1,7 +1,7 @@ #ifdef _WIN32 __declspec(dllexport) #endif - int empty() + int empty(void) { return 0; } diff --git a/Tests/RunCMake/target_compile_options/CMP0101.c b/Tests/RunCMake/target_compile_options/CMP0101.c index 250869a..7ef6117 100644 --- a/Tests/RunCMake/target_compile_options/CMP0101.c +++ b/Tests/RunCMake/target_compile_options/CMP0101.c @@ -3,7 +3,7 @@ # error "BEFORE not honored" #endif -int main() +int main(void) { return 0; } diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/func.c b/Tests/RunCMake/target_link_libraries-ALIAS/func.c index 415a9bf..ebc6a5f 100644 --- a/Tests/RunCMake/target_link_libraries-ALIAS/func.c +++ b/Tests/RunCMake/target_link_libraries-ALIAS/func.c @@ -2,6 +2,6 @@ #if defined(_WIN32) __declspec(dllexport) #endif - void func_c() + void func_c(void) { } diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/lib.c b/Tests/RunCMake/target_link_libraries-ALIAS/lib.c index b2d1b66..95c0e91 100644 --- a/Tests/RunCMake/target_link_libraries-ALIAS/lib.c +++ b/Tests/RunCMake/target_link_libraries-ALIAS/lib.c @@ -2,9 +2,9 @@ #if defined(_WIN32) __declspec(dllimport) #endif - void func_c(); + void func_c(void); -void lib() +void lib(void) { func_c(); } diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/main.c b/Tests/RunCMake/target_link_libraries-ALIAS/main.c index a908dea..72a3ddb 100644 --- a/Tests/RunCMake/target_link_libraries-ALIAS/main.c +++ b/Tests/RunCMake/target_link_libraries-ALIAS/main.c @@ -2,9 +2,9 @@ #if defined(_WIN32) __declspec(dllimport) #endif - void func_c(); + void func_c(void); -int main() +int main(void) { func_c(); diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/base.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/base.c index a5075d4..ed769a0 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/base.c +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/base.c @@ -4,6 +4,6 @@ __declspec(dllexport) # endif #endif - void base() + void base(void) { } diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func1.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func1.c index 3399e00..ef11bc2 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func1.c +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func1.c @@ -1,7 +1,7 @@ -extern void func2(); +extern void func2(void); -void func1() +void func1(void) { func2(); } diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func2.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func2.c index 0f9aa64..3eab38e 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func2.c +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func2.c @@ -1,7 +1,7 @@ -extern void func3(); +extern void func3(void); -void func2() +void func2(void) { func3(); } diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func3.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func3.c index 0b7df64..c109e09 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/func3.c +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/func3.c @@ -1,6 +1,6 @@ -extern void func3(); +extern void func3(void); -void func3() +void func3(void) { } diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/lib.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/lib.c index 35ab367..21f559c 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/lib.c +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/lib.c @@ -4,12 +4,12 @@ __declspec(dllimport) # endif #endif - void base(); + void base(void); #if defined(_WIN32) __declspec(dllexport) #endif - void lib() + void lib(void) { base(); } diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/main.c b/Tests/RunCMake/target_link_libraries-LINK_GROUP/main.c index 403583d..d78b0f6 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/main.c +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/main.c @@ -1,7 +1,7 @@ -extern void func1(); +extern void func1(void); -int main() +int main(void) { func1(); } diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c index 415a9bf..ebc6a5f 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c @@ -2,6 +2,6 @@ #if defined(_WIN32) __declspec(dllexport) #endif - void func_c() + void func_c(void) { } diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c index b2d1b66..95c0e91 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c @@ -2,9 +2,9 @@ #if defined(_WIN32) __declspec(dllimport) #endif - void func_c(); + void func_c(void); -void lib() +void lib(void) { func_c(); } diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c index 689dbd7..891c4ad 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c @@ -1,14 +1,14 @@ #if defined(C_USE_CXX) -void func_c_cxx(); +void func_c_cxx(void); #else # if defined(_WIN32) __declspec(dllimport) # endif - void func_c(); + void func_c(void); #endif -int main() +int main(void) { #if defined(C_USE_CXX) func_c_cxx(); diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c index 415a9bf..ebc6a5f 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c @@ -2,6 +2,6 @@ #if defined(_WIN32) __declspec(dllexport) #endif - void func_c() + void func_c(void) { } diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c index b2d1b66..95c0e91 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c @@ -2,9 +2,9 @@ #if defined(_WIN32) __declspec(dllimport) #endif - void func_c(); + void func_c(void); -void lib() +void lib(void) { func_c(); } diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c index a908dea..72a3ddb 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c @@ -2,9 +2,9 @@ #if defined(_WIN32) __declspec(dllimport) #endif - void func_c(); + void func_c(void); -int main() +int main(void) { func_c(); diff --git a/Tests/RunCMake/target_link_libraries/lib.c b/Tests/RunCMake/target_link_libraries/lib.c index b2d1b66..95c0e91 100644 --- a/Tests/RunCMake/target_link_libraries/lib.c +++ b/Tests/RunCMake/target_link_libraries/lib.c @@ -2,9 +2,9 @@ #if defined(_WIN32) __declspec(dllimport) #endif - void func_c(); + void func_c(void); -void lib() +void lib(void) { func_c(); } diff --git a/Tests/RunCMake/try_compile/lib.c b/Tests/RunCMake/try_compile/lib.c index b00c576..ce64a13 100644 --- a/Tests/RunCMake/try_compile/lib.c +++ b/Tests/RunCMake/try_compile/lib.c @@ -1,4 +1,4 @@ -void func() +void func(void) { } diff --git a/Tests/RunCMake/try_compile/main.c b/Tests/RunCMake/try_compile/main.c index 2128ead..6b1e682 100644 --- a/Tests/RunCMake/try_compile/main.c +++ b/Tests/RunCMake/try_compile/main.c @@ -1,4 +1,4 @@ -extern void func(); +extern void func(void); int main(void) { diff --git a/Tests/RunCMake/try_run/ConfigureLog-test.c b/Tests/RunCMake/try_run/ConfigureLog-test.c index 6a8f125..465069d 100644 --- a/Tests/RunCMake/try_run/ConfigureLog-test.c +++ b/Tests/RunCMake/try_run/ConfigureLog-test.c @@ -1,6 +1,6 @@ #include <stdio.h> -int main() +int main(void) { fprintf(stderr, "Output, with backslash '\\', on stderr!\n"); fflush(stderr); /* make output deterministic even if stderr is buffered */ diff --git a/Tests/RunCMake/try_run/lib.c b/Tests/RunCMake/try_run/lib.c index b00c576..ce64a13 100644 --- a/Tests/RunCMake/try_run/lib.c +++ b/Tests/RunCMake/try_run/lib.c @@ -1,4 +1,4 @@ -void func() +void func(void) { } diff --git a/Tests/RunCMake/try_run/main.c b/Tests/RunCMake/try_run/main.c index 2128ead..6b1e682 100644 --- a/Tests/RunCMake/try_run/main.c +++ b/Tests/RunCMake/try_run/main.c @@ -1,4 +1,4 @@ -extern void func(); +extern void func(void); int main(void) { diff --git a/Tests/RuntimePath/bar1.c b/Tests/RuntimePath/bar1.c index 5dc5ec9..11b3a74 100644 --- a/Tests/RuntimePath/bar1.c +++ b/Tests/RuntimePath/bar1.c @@ -1,5 +1,5 @@ -extern int foo1(); -int bar1() +extern int foo1(void); +int bar1(void) { return foo1(); } diff --git a/Tests/RuntimePath/bar2.c b/Tests/RuntimePath/bar2.c index 9035489..a117f6f 100644 --- a/Tests/RuntimePath/bar2.c +++ b/Tests/RuntimePath/bar2.c @@ -1,5 +1,5 @@ -extern int foo2(); -int bar2() +extern int foo2(void); +int bar2(void) { return foo2(); } diff --git a/Tests/RuntimePath/foo1.c b/Tests/RuntimePath/foo1.c index dfcb0b7..14370ac 100644 --- a/Tests/RuntimePath/foo1.c +++ b/Tests/RuntimePath/foo1.c @@ -1,4 +1,4 @@ -int foo1() +int foo1(void) { return 0; } diff --git a/Tests/RuntimePath/foo2.c b/Tests/RuntimePath/foo2.c index 12a3e77..a105df9 100644 --- a/Tests/RuntimePath/foo2.c +++ b/Tests/RuntimePath/foo2.c @@ -1,4 +1,4 @@ -int foo2() +int foo2(void) { return 0; } diff --git a/Tests/RuntimePath/main.c b/Tests/RuntimePath/main.c index c71ee06..f25b493 100644 --- a/Tests/RuntimePath/main.c +++ b/Tests/RuntimePath/main.c @@ -1,5 +1,5 @@ -extern int bar1(); -int main() +extern int bar1(void); +int main(void) { return bar1(); } diff --git a/Tests/SetLang/bar.c b/Tests/SetLang/bar.c index 515e8c2..3a299dc 100644 --- a/Tests/SetLang/bar.c +++ b/Tests/SetLang/bar.c @@ -20,7 +20,7 @@ public: int i; }; -int main() +int main(void) { A a; if (a.i == 21) { diff --git a/Tests/Simple/simpleCLib.c b/Tests/Simple/simpleCLib.c index 6509865..90c4440 100644 --- a/Tests/Simple/simpleCLib.c +++ b/Tests/Simple/simpleCLib.c @@ -1,6 +1,6 @@ #include <stdio.h> -int FooBar() +int FooBar(void) { int class; int private = 10; diff --git a/Tests/SimpleCOnly/bar.c b/Tests/SimpleCOnly/bar.c index 570fee9..6c7605a 100644 --- a/Tests/SimpleCOnly/bar.c +++ b/Tests/SimpleCOnly/bar.c @@ -1,4 +1,4 @@ -int bar() +int bar(void) { return 5; } diff --git a/Tests/SimpleCOnly/foo.c b/Tests/SimpleCOnly/foo.c index c61d212..c12b865 100644 --- a/Tests/SimpleCOnly/foo.c +++ b/Tests/SimpleCOnly/foo.c @@ -1,4 +1,4 @@ -int foo() +int foo(void) { return 12; } diff --git a/Tests/SimpleCOnly/main.c b/Tests/SimpleCOnly/main.c index 54a7312..ad4c75c 100644 --- a/Tests/SimpleCOnly/main.c +++ b/Tests/SimpleCOnly/main.c @@ -3,7 +3,7 @@ extern int foo(); extern int bar(); -int main() +int main(void) { int i = foo(); int k = bar(); diff --git a/Tests/SourceFileIncludeDirProperty/main.c b/Tests/SourceFileIncludeDirProperty/main.c index 36144ca..d32e2ad 100644 --- a/Tests/SourceFileIncludeDirProperty/main.c +++ b/Tests/SourceFileIncludeDirProperty/main.c @@ -1,7 +1,7 @@ #include "header.h" -int main() +int main(void) { return 0; } diff --git a/Tests/SourceFileProperty/ICaseTest.c b/Tests/SourceFileProperty/ICaseTest.c index 454c721..70ae53e 100644 --- a/Tests/SourceFileProperty/ICaseTest.c +++ b/Tests/SourceFileProperty/ICaseTest.c @@ -1,6 +1,6 @@ #ifdef NEEDED_TO_WORK -int icasetest() +int icasetest(void) { return 0; } diff --git a/Tests/SourceGroups/main.c b/Tests/SourceGroups/main.c index f646b49..85a6c8b 100644 --- a/Tests/SourceGroups/main.c +++ b/Tests/SourceGroups/main.c @@ -14,7 +14,7 @@ extern int tree_foobar(void); extern int tree_baz(void); extern int nested(void); -int main() +int main(void) { printf("foo: %d bar: %d foobar: %d barbar: %d baz: %d\n", foo(), bar(), foobar(), barbar(), baz()); diff --git a/Tests/SourceGroups/sub2/main.c b/Tests/SourceGroups/sub2/main.c index 4cd8ae0..6a195bc 100644 --- a/Tests/SourceGroups/sub2/main.c +++ b/Tests/SourceGroups/sub2/main.c @@ -3,7 +3,7 @@ extern int qax(void); extern int qux(void); -int main() +int main(void) { printf("qux: %d qax: %d\n", qux(), qax()); diff --git a/Tests/SubDir/AnotherSubdir/pair+int.int.c b/Tests/SubDir/AnotherSubdir/pair+int.int.c index b7a6237..6e719fe 100644 --- a/Tests/SubDir/AnotherSubdir/pair+int.int.c +++ b/Tests/SubDir/AnotherSubdir/pair+int.int.c @@ -1,6 +1,6 @@ #include <stdio.h> -void pair_stuff() +void pair_stuff(void) { printf("Placeholder for a strange file in subdirectory\n"); } diff --git a/Tests/SubDir/AnotherSubdir/pair_int.int.c b/Tests/SubDir/AnotherSubdir/pair_int.int.c index b7a6237..6e719fe 100644 --- a/Tests/SubDir/AnotherSubdir/pair_int.int.c +++ b/Tests/SubDir/AnotherSubdir/pair_int.int.c @@ -1,6 +1,6 @@ #include <stdio.h> -void pair_stuff() +void pair_stuff(void) { printf("Placeholder for a strange file in subdirectory\n"); } diff --git a/Tests/SubDir/AnotherSubdir/secondone.c b/Tests/SubDir/AnotherSubdir/secondone.c index 3e9e5af..0dd9c6b 100644 --- a/Tests/SubDir/AnotherSubdir/secondone.c +++ b/Tests/SubDir/AnotherSubdir/secondone.c @@ -1,6 +1,6 @@ #include <stdio.h> -void secondone() +void secondone(void) { printf("Hello again\n"); } diff --git a/Tests/SubDir/AnotherSubdir/testfromsubdir.c b/Tests/SubDir/AnotherSubdir/testfromsubdir.c index 34b6e7a..5e72140 100644 --- a/Tests/SubDir/AnotherSubdir/testfromsubdir.c +++ b/Tests/SubDir/AnotherSubdir/testfromsubdir.c @@ -4,7 +4,7 @@ void secondone(); void pair_stuff(); void vcl_stuff(); -int main() +int main(void) { printf("Hello from subdirectory\n"); secondone(); diff --git a/Tests/SubDir/ThirdSubDir/pair+int.int1.c b/Tests/SubDir/ThirdSubDir/pair+int.int1.c index b7a6237..6e719fe 100644 --- a/Tests/SubDir/ThirdSubDir/pair+int.int1.c +++ b/Tests/SubDir/ThirdSubDir/pair+int.int1.c @@ -1,6 +1,6 @@ #include <stdio.h> -void pair_stuff() +void pair_stuff(void) { printf("Placeholder for a strange file in subdirectory\n"); } diff --git a/Tests/SubDir/ThirdSubDir/pair_int.int1.c b/Tests/SubDir/ThirdSubDir/pair_int.int1.c index b7a6237..6e719fe 100644 --- a/Tests/SubDir/ThirdSubDir/pair_int.int1.c +++ b/Tests/SubDir/ThirdSubDir/pair_int.int1.c @@ -1,6 +1,6 @@ #include <stdio.h> -void pair_stuff() +void pair_stuff(void) { printf("Placeholder for a strange file in subdirectory\n"); } diff --git a/Tests/SubDir/ThirdSubDir/pair_p_int.int1.c b/Tests/SubDir/ThirdSubDir/pair_p_int.int1.c index 95a66ee..3cf9442 100644 --- a/Tests/SubDir/ThirdSubDir/pair_p_int.int1.c +++ b/Tests/SubDir/ThirdSubDir/pair_p_int.int1.c @@ -1,6 +1,6 @@ #include <stdio.h> -void pair_p_stuff() +void pair_p_stuff(void) { printf("Placeholder for another strange file in subdirectory\n"); } diff --git a/Tests/SubDir/ThirdSubDir/testfromauxsubdir.c b/Tests/SubDir/ThirdSubDir/testfromauxsubdir.c index d162084..448ef52 100644 --- a/Tests/SubDir/ThirdSubDir/testfromauxsubdir.c +++ b/Tests/SubDir/ThirdSubDir/testfromauxsubdir.c @@ -5,7 +5,7 @@ void pair_stuff(); void pair_p_stuff(); void vcl_stuff(); -int main() +int main(void) { printf("Hello from subdirectory\n"); secondone(); diff --git a/Tests/SubDir/ThirdSubDir/thirdone.c b/Tests/SubDir/ThirdSubDir/thirdone.c index 3e9e5af..0dd9c6b 100644 --- a/Tests/SubDir/ThirdSubDir/thirdone.c +++ b/Tests/SubDir/ThirdSubDir/thirdone.c @@ -1,6 +1,6 @@ #include <stdio.h> -void secondone() +void secondone(void) { printf("Hello again\n"); } diff --git a/Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c b/Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c index a0c60f7..689c827 100644 --- a/Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c +++ b/Tests/SubDir/vcl_algorithm+vcl_pair+double.foo.c @@ -1,6 +1,6 @@ #include <stdio.h> -void vcl_stuff() +void vcl_stuff(void) { printf("Placeholder for a file with strange name\n"); } diff --git a/Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c b/Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c index a0c60f7..689c827 100644 --- a/Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c +++ b/Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c @@ -1,6 +1,6 @@ #include <stdio.h> -void vcl_stuff() +void vcl_stuff(void) { printf("Placeholder for a file with strange name\n"); } diff --git a/Tests/SubDirSpaces/Another Subdir/pair+int.int.c b/Tests/SubDirSpaces/Another Subdir/pair+int.int.c index b7a6237..6e719fe 100644 --- a/Tests/SubDirSpaces/Another Subdir/pair+int.int.c +++ b/Tests/SubDirSpaces/Another Subdir/pair+int.int.c @@ -1,6 +1,6 @@ #include <stdio.h> -void pair_stuff() +void pair_stuff(void) { printf("Placeholder for a strange file in subdirectory\n"); } diff --git a/Tests/SubDirSpaces/Another Subdir/pair_int.int.c b/Tests/SubDirSpaces/Another Subdir/pair_int.int.c index b7a6237..6e719fe 100644 --- a/Tests/SubDirSpaces/Another Subdir/pair_int.int.c +++ b/Tests/SubDirSpaces/Another Subdir/pair_int.int.c @@ -1,6 +1,6 @@ #include <stdio.h> -void pair_stuff() +void pair_stuff(void) { printf("Placeholder for a strange file in subdirectory\n"); } diff --git a/Tests/SubDirSpaces/Another Subdir/secondone.c b/Tests/SubDirSpaces/Another Subdir/secondone.c index 3e9e5af..0dd9c6b 100644 --- a/Tests/SubDirSpaces/Another Subdir/secondone.c +++ b/Tests/SubDirSpaces/Another Subdir/secondone.c @@ -1,6 +1,6 @@ #include <stdio.h> -void secondone() +void secondone(void) { printf("Hello again\n"); } diff --git a/Tests/SubDirSpaces/Another Subdir/testfromsubdir.c b/Tests/SubDirSpaces/Another Subdir/testfromsubdir.c index 34b6e7a..5e72140 100644 --- a/Tests/SubDirSpaces/Another Subdir/testfromsubdir.c +++ b/Tests/SubDirSpaces/Another Subdir/testfromsubdir.c @@ -4,7 +4,7 @@ void secondone(); void pair_stuff(); void vcl_stuff(); -int main() +int main(void) { printf("Hello from subdirectory\n"); secondone(); diff --git a/Tests/SubDirSpaces/Some(x86) Sources/test.c b/Tests/SubDirSpaces/Some(x86) Sources/test.c index 66568d4..5baf240 100644 --- a/Tests/SubDirSpaces/Some(x86) Sources/test.c +++ b/Tests/SubDirSpaces/Some(x86) Sources/test.c @@ -1,3 +1,3 @@ -void testOdd() +void testOdd(void) { } diff --git a/Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c b/Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c index b7a6237..6e719fe 100644 --- a/Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c +++ b/Tests/SubDirSpaces/ThirdSubDir/pair+int.int1.c @@ -1,6 +1,6 @@ #include <stdio.h> -void pair_stuff() +void pair_stuff(void) { printf("Placeholder for a strange file in subdirectory\n"); } diff --git a/Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c b/Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c index b7a6237..6e719fe 100644 --- a/Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c +++ b/Tests/SubDirSpaces/ThirdSubDir/pair_int.int1.c @@ -1,6 +1,6 @@ #include <stdio.h> -void pair_stuff() +void pair_stuff(void) { printf("Placeholder for a strange file in subdirectory\n"); } diff --git a/Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c b/Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c index 95a66ee..3cf9442 100644 --- a/Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c +++ b/Tests/SubDirSpaces/ThirdSubDir/pair_p_int.int1.c @@ -1,6 +1,6 @@ #include <stdio.h> -void pair_p_stuff() +void pair_p_stuff(void) { printf("Placeholder for another strange file in subdirectory\n"); } diff --git a/Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c b/Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c index fa6c33c..2bff654 100644 --- a/Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c +++ b/Tests/SubDirSpaces/ThirdSubDir/testfromauxsubdir.c @@ -7,7 +7,7 @@ void vcl_stuff(); #ifdef CMAKE_PAREN void testOdd(); #endif -int main() +int main(void) { printf("Hello from subdirectory\n"); secondone(); diff --git a/Tests/SubDirSpaces/ThirdSubDir/thirdone.c b/Tests/SubDirSpaces/ThirdSubDir/thirdone.c index 3e9e5af..0dd9c6b 100644 --- a/Tests/SubDirSpaces/ThirdSubDir/thirdone.c +++ b/Tests/SubDirSpaces/ThirdSubDir/thirdone.c @@ -1,6 +1,6 @@ #include <stdio.h> -void secondone() +void secondone(void) { printf("Hello again\n"); } diff --git a/Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c b/Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c index a0c60f7..689c827 100644 --- a/Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c +++ b/Tests/SubDirSpaces/vcl_algorithm+vcl_pair+double.foo.c @@ -1,6 +1,6 @@ #include <stdio.h> -void vcl_stuff() +void vcl_stuff(void) { printf("Placeholder for a file with strange name\n"); } diff --git a/Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c b/Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c index a0c60f7..689c827 100644 --- a/Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c +++ b/Tests/SubDirSpaces/vcl_algorithm_vcl_pair_double.foo.c @@ -1,6 +1,6 @@ #include <stdio.h> -void vcl_stuff() +void vcl_stuff(void) { printf("Placeholder for a file with strange name\n"); } diff --git a/Tests/TryCompile/Inner/innerexe.c b/Tests/TryCompile/Inner/innerexe.c index e329c5f..6d1e3da 100644 --- a/Tests/TryCompile/Inner/innerexe.c +++ b/Tests/TryCompile/Inner/innerexe.c @@ -1,5 +1,5 @@ extern int innerlib(void); -int main() +int main(void) { return innerlib(); } diff --git a/Tests/TryCompile/check_a_b.c b/Tests/TryCompile/check_a_b.c index 05fba0f..65535ac 100644 --- a/Tests/TryCompile/check_a_b.c +++ b/Tests/TryCompile/check_a_b.c @@ -4,7 +4,7 @@ #ifndef DEF_B # error DEF_B not defined #endif -int main() +int main(void) { return 0; } diff --git a/Tests/TryCompile/exit_success.c b/Tests/TryCompile/exit_success.c index 82f5b5f..302d926 100644 --- a/Tests/TryCompile/exit_success.c +++ b/Tests/TryCompile/exit_success.c @@ -1,6 +1,6 @@ #include <stdio.h> -int main() +int main(void) { printf("hello world\n"); return 0; diff --git a/Tests/TryCompile/exit_with_error.c b/Tests/TryCompile/exit_with_error.c index dbddcf5..dfa36fc 100644 --- a/Tests/TryCompile/exit_with_error.c +++ b/Tests/TryCompile/exit_with_error.c @@ -1,6 +1,6 @@ #include <stdio.h> -int main() +int main(void) { printf("hello world\n"); return 1; diff --git a/Tests/TryCompile/pass.c b/Tests/TryCompile/pass.c index f8b643a..8488f4e 100644 --- a/Tests/TryCompile/pass.c +++ b/Tests/TryCompile/pass.c @@ -1,4 +1,4 @@ -int main() +int main(void) { return 0; } diff --git a/Tests/TryCompile/pass2a.c b/Tests/TryCompile/pass2a.c index 27c377b..8375a8e 100644 --- a/Tests/TryCompile/pass2a.c +++ b/Tests/TryCompile/pass2a.c @@ -1,5 +1,5 @@ extern int pass2b(void); -int main() +int main(void) { return pass2b(); } diff --git a/Tests/TryCompile/stdout_and_stderr.c b/Tests/TryCompile/stdout_and_stderr.c index 84ded1f..c25b7d9 100644 --- a/Tests/TryCompile/stdout_and_stderr.c +++ b/Tests/TryCompile/stdout_and_stderr.c @@ -1,6 +1,6 @@ #include <stdio.h> -int main() +int main(void) { fputs("error\n", stderr); puts("hello world\n"); diff --git a/Tests/Unset/unset.c b/Tests/Unset/unset.c index f8b643a..8488f4e 100644 --- a/Tests/Unset/unset.c +++ b/Tests/Unset/unset.c @@ -1,4 +1,4 @@ -int main() +int main(void) { return 0; } diff --git a/Tests/VSGNUFortran/c_code/main.c b/Tests/VSGNUFortran/c_code/main.c index 60c1120..be868c3 100644 --- a/Tests/VSGNUFortran/c_code/main.c +++ b/Tests/VSGNUFortran/c_code/main.c @@ -1,6 +1,6 @@ #include <HelloWorldFCMangle.h> /* created by FortranCInterface */ extern void FC_hello(void); -int main() +int main(void) { FC_hello(); return 0; diff --git a/Tests/Visibility/bar.c b/Tests/Visibility/bar.c index b72a1a5..e1f4df6 100644 --- a/Tests/Visibility/bar.c +++ b/Tests/Visibility/bar.c @@ -1,3 +1,3 @@ -void bar() +void bar(void) { } diff --git a/Tests/X11/X11.c b/Tests/X11/X11.c index 3a6f9f0..9f002f6 100644 --- a/Tests/X11/X11.c +++ b/Tests/X11/X11.c @@ -4,7 +4,7 @@ # include <X11/Xlib.h> # include <X11/Xutil.h> -int main() +int main(void) { printf("There is X on this computer\n"); return 0; @@ -12,7 +12,7 @@ int main() #else -int main() +int main(void) { printf("No X on this computer\n"); return 0; diff --git a/Tests/XCTest/FrameworkExample/FrameworkExample.c b/Tests/XCTest/FrameworkExample/FrameworkExample.c index 77361c8..9da1bf2 100644 --- a/Tests/XCTest/FrameworkExample/FrameworkExample.c +++ b/Tests/XCTest/FrameworkExample/FrameworkExample.c @@ -1,6 +1,6 @@ #include "FrameworkExample.h" -int FourtyTwo() +int FourtyTwo(void) { return 42; } diff --git a/Utilities/Sphinx/conf.py.in b/Utilities/Sphinx/conf.py.in index b8d8474..0d9ad91 100644 --- a/Utilities/Sphinx/conf.py.in +++ b/Utilities/Sphinx/conf.py.in @@ -88,7 +88,11 @@ html_favicon = '@conf_path@/static/cmake-favicon.ico' # qthelp_namespace = "org.cmake" # qthelp_qch_name = "CMake.qch" -linkcheck_ignore = [r'about:|https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack'] +linkcheck_ignore = [ + r'about:', + r'https://gitlab\.kitware\.com/cmake/community/-/wikis/doc/cpack', + r'https://www.intel.com/', +] linkcheck_allowed_redirects = { r'https://cdash\.org': r'https://www\.cdash\.org/', |