summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab/ci/docker/debian10/Dockerfile15
-rwxr-xr-x.gitlab/ci/docker/debian10/install_iwyu.sh2
-rw-r--r--.gitlab/ci/docker/fedora37/Dockerfile21
-rw-r--r--.gitlab/os-linux.yml4
-rw-r--r--Help/command/execute_process.rst74
-rw-r--r--Help/command/set_property.rst2
-rw-r--r--Help/manual/cmake-variables.7.rst2
-rw-r--r--Help/manual/cmake.1.rst4
-rw-r--r--Help/variable/CMAKE_KATE_FILES_MODE.rst20
-rw-r--r--Help/variable/CMAKE_KATE_MAKE_ARGUMENTS.rst11
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake2
-rw-r--r--Modules/CMakeFindKate.cmake8
-rw-r--r--Modules/CheckFortranSourceCompiles.cmake12
-rw-r--r--Modules/CheckFortranSourceRuns.cmake10
-rw-r--r--Modules/CheckSourceCompiles.cmake30
-rw-r--r--Modules/CheckSourceRuns.cmake30
-rw-r--r--Modules/Compiler/Clang.cmake2
-rw-r--r--Modules/FindCUDAToolkit.cmake2
-rw-r--r--Modules/FindOpenCL.cmake14
-rw-r--r--Modules/FindPNG.cmake26
-rw-r--r--Modules/Platform/Android.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmExtraKateGenerator.cxx58
-rw-r--r--Source/cmake.cxx4
-rw-r--r--Tests/COnly/CMakeLists.txt6
-rw-r--r--Tests/LinkFlags/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx2
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx2
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx2
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx2
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/importable.cxx2
-rw-r--r--Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/importable.cxx2
32 files changed, 273 insertions, 107 deletions
diff --git a/.gitlab/ci/docker/debian10/Dockerfile b/.gitlab/ci/docker/debian10/Dockerfile
index 34a4bf1..2d3ae3a 100644
--- a/.gitlab/ci/docker/debian10/Dockerfile
+++ b/.gitlab/ci/docker/debian10/Dockerfile
@@ -1,10 +1,10 @@
-FROM debian:10 as iwyu-build
+FROM debian:10 AS iwyu-build
MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
COPY install_iwyu.sh /root/install_iwyu.sh
RUN sh /root/install_iwyu.sh
-FROM debian:10 as rvm-build
+FROM debian:10 AS rvm-build
MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
COPY install_rvm.sh /root/install_rvm.sh
@@ -16,10 +16,9 @@ MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
COPY install_deps.sh /root/install_deps.sh
RUN sh /root/install_deps.sh
-COPY --from=iwyu-build /root/iwyu.tar.gz /root/iwyu.tar.gz
-RUN tar -C / -xf /root/iwyu.tar.gz
-RUN ln -s /usr/lib/llvm-6.0/bin/include-what-you-use /usr/bin/include-what-you-use-6.0
+RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \
+ tar -C / -xf /root/iwyu.tar \
+ && ln -s /usr/lib/llvm-6.0/bin/include-what-you-use /usr/bin/include-what-you-use-6.0
-COPY --from=rvm-build /root/rvm.tar /root/rvm.tar
-RUN tar -C /usr/local -xf /root/rvm.tar \
- && rm /root/rvm.tar
+RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \
+ tar -C /usr/local -xf /root/rvm.tar
diff --git a/.gitlab/ci/docker/debian10/install_iwyu.sh b/.gitlab/ci/docker/debian10/install_iwyu.sh
index 54d26ef..260570e 100755
--- a/.gitlab/ci/docker/debian10/install_iwyu.sh
+++ b/.gitlab/ci/docker/debian10/install_iwyu.sh
@@ -29,4 +29,4 @@ cmake -GNinja \
..
ninja
DESTDIR=/root/iwyu-destdir ninja install
-tar -C /root/iwyu-destdir -cf /root/iwyu.tar.gz .
+tar -C /root/iwyu-destdir -cf /root/iwyu.tar .
diff --git a/.gitlab/ci/docker/fedora37/Dockerfile b/.gitlab/ci/docker/fedora37/Dockerfile
index 13ef9aa..1ba9e37 100644
--- a/.gitlab/ci/docker/fedora37/Dockerfile
+++ b/.gitlab/ci/docker/fedora37/Dockerfile
@@ -1,4 +1,4 @@
-FROM fedora:37 as rvm-build
+FROM fedora:37 AS rvm-build
MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
COPY install_rvm.sh /root/install_rvm.sh
@@ -10,7 +10,7 @@ MAINTAINER Kyle Edwards <kyle.edwards@kitware.com>
COPY install_clang_tidy_headers.sh /root/install_clang_tidy_headers.sh
RUN sh /root/install_clang_tidy_headers.sh
-FROM fedora:37 AS iwyu
+FROM fedora:37 AS iwyu-build
MAINTAINER Kyle Edwards <kyle.edwards@kitware.com>
COPY install_iwyu.sh /root/install_iwyu.sh
@@ -22,12 +22,11 @@ MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
COPY install_deps.sh /root/install_deps.sh
RUN sh /root/install_deps.sh
-COPY --from=rvm-build /root/rvm.tar /root/rvm.tar
-RUN tar -C /usr/local -xf /root/rvm.tar \
- && rm /root/rvm.tar
-COPY --from=clang-tidy-headers /root/clang-tidy-headers.tar /root/clang-tidy-headers.tar
-RUN tar -C /usr/include -xf /root/clang-tidy-headers.tar \
- && rm /root/clang-tidy-headers.tar
-COPY --from=iwyu /root/iwyu.tar /root/iwyu.tar
-RUN tar -C / -xf /root/iwyu.tar \
- && rm /root/iwyu.tar
+RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \
+ tar -C /usr/local -xf /root/rvm.tar
+
+RUN --mount=type=bind,from=clang-tidy-headers,source=/root,target=/root \
+ tar -C /usr/include -xf /root/clang-tidy-headers.tar
+
+RUN --mount=type=bind,from=iwyu-build,source=/root,target=/root \
+ tar -C / -xf /root/iwyu.tar
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index c00c4aa..9d7be0e 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -45,7 +45,7 @@
### Debian
.debian10:
- image: "kitware/cmake:ci-debian10-x86_64-2023-01-26"
+ image: "kitware/cmake:ci-debian10-x86_64-2023-02-06"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
@@ -69,7 +69,7 @@
### Fedora
.fedora37:
- image: "kitware/cmake:ci-fedora37-x86_64-2023-01-26"
+ image: "kitware/cmake:ci-fedora37-x86_64-2023-02-06"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes"
diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst
index 5cfeeab..98430c5 100644
--- a/Help/command/execute_process.rst
+++ b/Help/command/execute_process.rst
@@ -32,6 +32,11 @@ Commands are executed concurrently as a pipeline, with the standard
output of each process piped to the standard input of the next.
A single standard error pipe is used for all processes.
+``execute_process`` runs commands while CMake is configuring the project,
+prior to build system generation. Use the :command:`add_custom_target` and
+:command:`add_custom_command` commands to create custom commands that run
+at build time.
+
Options:
``COMMAND``
@@ -51,8 +56,8 @@ Options:
(Use the ``INPUT_*``, ``OUTPUT_*``, and ``ERROR_*`` options to
redirect stdin, stdout, and stderr.)
- If a sequential execution of multiple commands is required, use multiple
- ``execute_process`` calls with a single ``COMMAND`` argument.
+ For **sequential execution** of multiple commands use multiple
+ ``execute_process`` calls each with a single ``COMMAND`` argument.
``WORKING_DIRECTORY``
The named directory will be set as the current working directory of
@@ -76,22 +81,46 @@ Options:
given ``COMMAND`` arguments. Each entry will be an integer return code
from the corresponding child or a string describing an error condition.
+``INPUT_FILE <file>``
+ ``<file>`` is attached to the standard input pipe of the *first* ``COMMAND``
+ process.
+
+``OUTPUT_FILE <file>``
+ ``<file>`` is attached to the standard output pipe of the *last* ``COMMAND``
+ process.
+
+``ERROR_FILE <file>``
+ ``<file>`` is attached to the standard error pipe of *all* ``COMMAND``
+ processes.
+
+.. versionadded:: 3.3
+ If the same ``<file>`` is named for both ``OUTPUT_FILE`` and ``ERROR_FILE``
+ then it will be used for both standard output and standard error pipes.
+
+``OUTPUT_QUIET``, ``ERROR_QUIET``
+ The standard output on ``OUTPUT_VARIABLE`` or standard error on
+ ``ERROR_VARIABLE`` are not connected (no variable content).
+ The ``*_FILE`` and ``ECHO_*_VARIABLE`` options are not affected.
+
``OUTPUT_VARIABLE``, ``ERROR_VARIABLE``
The variable named will be set with the contents of the standard output
and standard error pipes, respectively. If the same variable is named
for both pipes their output will be merged in the order produced.
-``INPUT_FILE, OUTPUT_FILE``, ``ERROR_FILE``
- The file named will be attached to the standard input of the first
- process, standard output of the last process, or standard error of
- all processes, respectively.
+``ECHO_OUTPUT_VARIABLE``, ``ECHO_ERROR_VARIABLE``
+ .. versionadded:: 3.18
+
+ The standard output or standard error will not be exclusively redirected to
+ the specified variables.
- .. versionadded:: 3.3
- If the same file is named for both output and error then it will be used
- for both.
+ The output will be duplicated into the specified variables and also onto
+ standard output or standard error analogous to the ``tee`` Unix command.
-``OUTPUT_QUIET``, ``ERROR_QUIET``
- The standard output or standard error results will be quietly ignored.
+.. note::
+ If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the
+ same pipe the precedence is *not specified*.
+ If no ``OUTPUT_*`` or ``ERROR_*`` options are given the output will
+ be shared with the corresponding pipes of the CMake process itself.
``COMMAND_ECHO <where>``
.. versionadded:: 3.15
@@ -126,17 +155,6 @@ Options:
Accept ``UTF-8`` spelling for consistency with the
`UTF-8 RFC <https://www.ietf.org/rfc/rfc3629>`_ naming convention.
-``ECHO_OUTPUT_VARIABLE``, ``ECHO_ERROR_VARIABLE``
- .. versionadded:: 3.18
-
- The standard output or standard error will not be exclusively redirected to
- the configured variables.
-
- The output will be duplicated, it will be sent into the configured variables
- and also on standard output or standard error.
-
- This is analogous to the ``tee`` Unix command.
-
``COMMAND_ERROR_IS_FATAL <ANY|LAST>``
.. versionadded:: 3.19
@@ -151,15 +169,3 @@ Options:
If the last command in the list of commands fails, the
``execute_process()`` command halts with an error. Commands earlier in the
list will not cause a fatal error.
-
-If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the
-same pipe the precedence is not specified.
-If no ``OUTPUT_*`` or ``ERROR_*`` options are given the output will
-be shared with the corresponding pipes of the CMake process itself.
-
-The :command:`execute_process` command is a newer more powerful version of
-:command:`exec_program`, but the old command has been kept for compatibility.
-Both commands run while CMake is processing the project prior to build
-system generation. Use :command:`add_custom_target` and
-:command:`add_custom_command` to create custom commands that run at
-build time.
diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst
index d446a2d..ca19e0c 100644
--- a/Help/command/set_property.rst
+++ b/Help/command/set_property.rst
@@ -90,7 +90,7 @@ It must be one of the following:
for tests created by the :command:`add_test(NAME)` signature.
``CACHE``
- Scope must name zero or more cache existing entries.
+ Scope must name zero or more existing cache entries.
The required ``PROPERTY`` option is immediately followed by the name of
the property to set. Remaining arguments are used to compose the
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 23d8256..8564e7c 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -226,6 +226,8 @@ Variables that Change Behavior
/variable/CMAKE_INSTALL_MESSAGE
/variable/CMAKE_INSTALL_PREFIX
/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
+ /variable/CMAKE_KATE_FILES_MODE
+ /variable/CMAKE_KATE_MAKE_ARGUMENTS
/variable/CMAKE_LIBRARY_PATH
/variable/CMAKE_LINK_DIRECTORIES_BEFORE
/variable/CMAKE_LINK_LIBRARIES_ONLY_TARGETS
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 9f77562..e48ecd9 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -1080,10 +1080,6 @@ Available commands are:
situations instead. Use ``--`` to stop interpreting options and treat all
remaining arguments as paths, even if they start with ``-``.
-.. option:: server
-
- Launch :manual:`cmake-server(7)` mode.
-
.. option:: sleep <number>...
.. versionadded:: 3.0
diff --git a/Help/variable/CMAKE_KATE_FILES_MODE.rst b/Help/variable/CMAKE_KATE_FILES_MODE.rst
new file mode 100644
index 0000000..195c15d
--- /dev/null
+++ b/Help/variable/CMAKE_KATE_FILES_MODE.rst
@@ -0,0 +1,20 @@
+CMAKE_KATE_FILES_MODE
+---------------------
+
+.. versionadded:: 3.27
+
+This cache variable is used by the Kate project generator and controls
+to what mode the ``files`` entry in the project file will be set. See
+:manual:`cmake-generators(7)`.
+
+Possible values are ``AUTO``, ``SVN``, ``GIT``, ``HG``, ``FOSSIL`` and ``LIST``.
+
+When set to ``LIST``, CMake will put the list of source files known to CMake
+in the project file.
+When set to ``SVN``, ``GIT``, ``HG`` or ``FOSSIL``, CMake will set
+the generated project accordingly to Subversion, git, Mercurial
+or Fossil, and Kate will then use the respective command line tool to
+retrieve the list of files in the project.
+When unset or set to ``AUTO``, CMake will try to detect whether the
+source directory is part of a git or svn checkout or not, and put the
+respective entry into the project file.
diff --git a/Help/variable/CMAKE_KATE_MAKE_ARGUMENTS.rst b/Help/variable/CMAKE_KATE_MAKE_ARGUMENTS.rst
new file mode 100644
index 0000000..c830332
--- /dev/null
+++ b/Help/variable/CMAKE_KATE_MAKE_ARGUMENTS.rst
@@ -0,0 +1,11 @@
+CMAKE_KATE_MAKE_ARGUMENTS
+-------------------------
+
+.. versionadded:: 3.0
+
+This cache variable is used by the Kate project generator. See
+:manual:`cmake-generators(7)`.
+
+This variable holds arguments which are used when Kate invokes the make
+tool. By default it is initialized to hold flags to enable parallel builds
+(using -j typically).
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 41e0e1a..1f89c74 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -35,7 +35,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
else(CMAKE_${lang}_FLAGS_INIT)
set(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS_INIT})
endif()
- string(REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}")
+ separate_arguments(CMAKE_${lang}_COMPILER_ID_FLAGS_LIST NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ID_FLAGS}")
# Compute the directory in which to run the test.
set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang})
diff --git a/Modules/CMakeFindKate.cmake b/Modules/CMakeFindKate.cmake
index 9aaf6e5..521bc5c 100644
--- a/Modules/CMakeFindKate.cmake
+++ b/Modules/CMakeFindKate.cmake
@@ -3,7 +3,7 @@
# This file is included in CMakeSystemSpecificInformation.cmake if
-# the Eclipse CDT4 extra generator has been selected.
+# the Kate extra generator has been selected.
# Try to find out how many CPUs we have and set the -j argument for make accordingly
@@ -17,5 +17,9 @@ if("${_CMAKE_KATE_PROCESSOR_COUNT}" GREATER 1 AND CMAKE_HOST_UNIX AND "${CMA
set(_CMAKE_KATE_INITIAL_MAKE_ARGS "-j${_CMAKE_KATE_PROCESSOR_COUNT}")
endif()
-# This variable is used by the Eclipse generator and appended to the make invocation commands.
+# This variable is used by the Kate generator and appended to the make invocation commands.
set(CMAKE_KATE_MAKE_ARGUMENTS "${_CMAKE_KATE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Kate invokes make. Enter e.g. -j<some_number> to get parallel builds")
+
+
+set(CMAKE_KATE_FILES_MODE "AUTO" CACHE STRING "Option to override the version control detection and force a mode for the Kate project.")
+set_property(CACHE CMAKE_KATE_FILES_MODE PROPERTY STRINGS "AUTO;SVN;GIT;LIST")
diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake
index e134329..8dcc1d5 100644
--- a/Modules/CheckFortranSourceCompiles.cmake
+++ b/Modules/CheckFortranSourceCompiles.cmake
@@ -19,18 +19,22 @@ Check if given Fortran source compiles and links into an executable.
)
Checks that the source supplied in ``<code>`` can be compiled as a Fortran
- source file and linked as an executable. The ``<code>`` must be a Fortran program
- containing at least an ``end`` statement--for example:
+ source file and linked as an executable. The ``<code>`` must be a Fortran
+ ``program``.
.. code-block:: cmake
- check_fortran_source_compiles("character :: b; error stop b; end" F2018ESTOPOK SRC_EXT F90)
+ check_fortran_source_compiles("program test
+ error stop
+ end program"
+ HAVE_ERROR_STOP
+ SRC_EXT .F90)
This command can help avoid costly build processes when a compiler lacks support
for a necessary feature, or a particular vendor library is not compatible with
the Fortran compiler version being used. This generate-time check may advise the
user of such before the main build process. See also the
- :command:`check_fortran_source_runs` command to actually run the compiled code.
+ :command:`check_fortran_source_runs` command to run the compiled code.
The result will be stored in the internal cache
variable ``<resultVar>``, with a boolean true value for success and boolean
diff --git a/Modules/CheckFortranSourceRuns.cmake b/Modules/CheckFortranSourceRuns.cmake
index 28f713f..985c765 100644
--- a/Modules/CheckFortranSourceRuns.cmake
+++ b/Modules/CheckFortranSourceRuns.cmake
@@ -18,12 +18,16 @@ subsequently be run.
[SRC_EXT <extension>])
Check that the source supplied in ``<code>`` can be compiled as a Fortran source
- file, linked as an executable and then run. The ``<code>`` must be a Fortran program
- containing at least an ``end`` statement--for example:
+ file, linked as an executable and then run. The ``<code>`` must be a Fortran
+ ``program``.
.. code-block:: cmake
- check_fortran_source_runs("real :: x[*]; call co_sum(x); end" F2018coarrayOK)
+ check_fortran_source_runs("program test
+ real :: x[*]
+ call co_sum(x)
+ end program"
+ HAVE_COARRAY)
This command can help avoid costly build processes when a compiler lacks support
for a necessary feature, or a particular vendor library is not compatible with
diff --git a/Modules/CheckSourceCompiles.cmake b/Modules/CheckSourceCompiles.cmake
index ad74c3c..9788798 100644
--- a/Modules/CheckSourceCompiles.cmake
+++ b/Modules/CheckSourceCompiles.cmake
@@ -19,17 +19,34 @@ Check if given source compiles and links into an executable.
[SRC_EXT <extension>])
Check that the source supplied in ``<code>`` can be compiled as a source
- file for the requested language and linked as an executable (so it must
- contain at least a ``main()`` function). The result will be stored in the
- internal cache variable specified by ``<resultVar>``, with a boolean true
- value for success and boolean false for failure. If ``FAIL_REGEX`` is
- provided, then failure is determined by checking if anything in the output
- matches any of the specified regular expressions.
+ file for the requested language and linked as an executable. The result
+ will be stored in the internal cache variable specified by ``<resultVar>``,
+ with a boolean true value for success and boolean false for failure. If
+ ``FAIL_REGEX`` is provided, then failure is determined by checking if
+ anything in the compiler output matches any of the specified regular
+ expressions.
By default, the test source file will be given a file extension that matches
the requested language. The ``SRC_EXT`` option can be used to override this
with ``.<extension>`` instead.
+ The ``<code>`` must contain a valid main program. For example:
+
+ .. code-block:: cmake
+
+ check_source_compiles(C
+ "#include <stdlib.h>
+ #include <stdnoreturn.h>
+ noreturn void f(){ exit(0); }
+ int main(void) { f(); return 1; }"
+ HAVE_NORETURN)
+
+ check_source_compiles(Fortran
+ "program test
+ error stop
+ end program"
+ HAVE_ERROR_STOP)
+
The underlying check is performed by the :command:`try_compile` command. The
compile and link commands can be influenced by setting any of the following
variables prior to calling ``check_source_compiles()``:
@@ -73,7 +90,6 @@ Check if given source compiles and links into an executable.
#]=======================================================================]
-
include_guard(GLOBAL)
include(Internal/CheckSourceCompiles)
diff --git a/Modules/CheckSourceRuns.cmake b/Modules/CheckSourceRuns.cmake
index 8f1cf01..e2fa579 100644
--- a/Modules/CheckSourceRuns.cmake
+++ b/Modules/CheckSourceRuns.cmake
@@ -20,22 +20,40 @@ subsequently be run.
Check that the source supplied in ``<code>`` can be compiled as a source
file for the requested language, linked as an executable and then run.
- The ``<code>`` must contain at least a ``main()`` function. If the ``<code>``
- could be built and run successfully, the internal cache variable specified by
- ``<resultVar>`` will be set to 1, otherwise it will be set to an value that
- evaluates to boolean false (e.g. an empty string or an error message).
+ If the ``<code>`` could be built and run successfully, the internal cache variable
+ specified by ``<resultVar>`` will be set to 1, otherwise it will be set to
+ a value that evaluates to boolean false (e.g. an empty string or an error
+ message).
By default, the test source file will be given a file extension that matches
the requested language. The ``SRC_EXT`` option can be used to override this
with ``.<extension>`` instead.
+ The ``<code>`` must contain a valid main program. For example:
+
+ .. code-block:: cmake
+
+ check_source_runs(C
+ "#include <stdlib.h>
+ #include <stdnoreturn.h>
+ noreturn void f(){ exit(0); }
+ int main(void) { f(); return 1; }"
+ HAVE_NORETURN)
+
+ check_source_runs(Fortran
+ "program test
+ real :: x[*]
+ call co_sum(x)
+ end program"
+ HAVE_COARRAY)
+
The underlying check is performed by the :command:`try_run` command. The
compile and link commands can be influenced by setting any of the following
- variables prior to calling ``check_objc_source_runs()``:
+ variables prior to calling ``check_source_runs()``:
``CMAKE_REQUIRED_FLAGS``
Additional flags to pass to the compiler. Note that the contents of
- :variable:`CMAKE_OBJC_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
+ :variable:`CMAKE_<LANG>_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
configuration-specific variable are automatically added to the compiler
command before the contents of ``CMAKE_REQUIRED_FLAGS``.
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index b59b38c..6c544fd 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -80,7 +80,7 @@ else()
set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto")
endif()
- if(ANDROID AND CMAKE_ANDROID_NDK_VERSION VERSION_LESS "22")
+ if(ANDROID AND NOT CMAKE_ANDROID_NDK_VERSION VERSION_GREATER_EQUAL "22")
# https://github.com/android-ndk/ndk/issues/242
set(CMAKE_${lang}_LINK_OPTIONS_IPO "-fuse-ld=gold")
endif()
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index cd44cc6..c3b6bc3 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -1122,7 +1122,7 @@ if(CUDAToolkit_FOUND)
_CUDAToolkit_find_and_add_import_lib(nvrtc_builtins DEPS cuda_driver)
_CUDAToolkit_find_and_add_import_lib(nvrtc DEPS nvrtc_builtins nvJitLink)
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.5.0)
- _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins_static DEPS cuda_driver)
+ _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins_static ALT nvrtc-builtins_static DEPS cuda_driver)
_CUDAToolkit_find_and_add_import_lib(nvrtc_static DEPS nvrtc_builtins_static nvptxcompiler_static nvJitLink_static)
endif()
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
index 2b700ff..55be667 100644
--- a/Modules/FindOpenCL.cmake
+++ b/Modules/FindOpenCL.cmake
@@ -39,6 +39,8 @@ The module will also define two cache variables::
#]=======================================================================]
+set(_OPENCL_x86 "(x86)")
+
function(_FIND_OPENCL_VERSION)
include(CheckSymbolExists)
include(CMakePushCheckState)
@@ -79,6 +81,9 @@ find_path(OpenCL_INCLUDE_DIR
CL/cl.h OpenCL/cl.h
PATHS
ENV "PROGRAMFILES(X86)"
+ ENV "PROGRAMFILES"
+ $ENV{PROGRAMFILES${_OPENCL_x86}}/OpenCLHeaders
+ $ENV{PROGRAMFILES}/OpenCLHeaders
ENV AMDAPPSDKROOT
ENV INTELOCLSDKROOT
ENV NVSDKCOMPUTE_ROOT
@@ -100,6 +105,9 @@ if(WIN32)
NAMES OpenCL
PATHS
ENV "PROGRAMFILES(X86)"
+ ENV "PROGRAMFILES"
+ $ENV{PROGRAMFILES${_OPENCL_x86}}/OpenCL-ICD-Loader
+ $ENV{PROGRAMFILES}/OpenCL-ICD-Loader
ENV AMDAPPSDKROOT
ENV INTELOCLSDKROOT
ENV CUDA_PATH
@@ -116,6 +124,9 @@ if(WIN32)
NAMES OpenCL
PATHS
ENV "PROGRAMFILES(X86)"
+ ENV "PROGRAMFILES"
+ $ENV{PROGRAMFILES${_OPENCL_x86}}/OpenCL-ICD-Loader
+ $ENV{PROGRAMFILES}/OpenCL-ICD-Loader
ENV AMDAPPSDKROOT
ENV INTELOCLSDKROOT
ENV CUDA_PATH
@@ -126,6 +137,7 @@ if(WIN32)
"AMD APP/lib/x86_64"
lib/x86_64
lib/x64
+ lib
OpenCL/common/lib/x64)
endif()
else()
@@ -156,6 +168,8 @@ else()
endif()
endif()
+unset(_OPENCL_x86)
+
set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR})
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index 94d15db..043b69c 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -48,18 +48,35 @@ Since PNG depends on the ZLib compression library, none of the above
will be defined unless ZLib can be found.
#]=======================================================================]
+# Default install location on windows when installing from included cmake build
+# From FindZLIB.cmake
+set(_PNG_x86 "(x86)")
+set(_PNG_INCLUDE_SEARCH_NORMAL
+ "$ENV{ProgramFiles}/libpng"
+ "$ENV{ProgramFiles${_PNG_x86}}/libpng")
+set(_PNG_LIB_SEARCH_NORMAL
+ "$ENV{ProgramFiles}/libpng/lib"
+ "$ENV{ProgramFiles${_PNG_x86}}/libpng/lib")
+unset(_PNG_x86)
+
if(PNG_FIND_QUIETLY)
set(_FIND_ZLIB_ARG QUIET)
endif()
find_package(ZLIB ${_FIND_ZLIB_ARG})
if(ZLIB_FOUND)
- find_path(PNG_PNG_INCLUDE_DIR png.h PATH_SUFFIXES include/libpng)
+ set(_PNG_VERSION_SUFFIXES 17 16 15 14 12)
+
+ list(APPEND _PNG_INCLUDE_PATH_SUFFIXES include/libpng)
+ foreach(v IN LISTS _PNG_VERSION_SUFFIXES)
+ list(APPEND _PNG_INCLUDE_PATH_SUFFIXES include/libpng${v})
+ endforeach()
+
+ find_path(PNG_PNG_INCLUDE_DIR png.h PATH_SUFFIXES ${_PNG_INCLUDE_PATH_SUFFIXES} PATHS ${_PNG_INCLUDE_SEARCH_NORMAL} )
mark_as_advanced(PNG_PNG_INCLUDE_DIR)
list(APPEND PNG_NAMES png libpng)
unset(PNG_NAMES_DEBUG)
- set(_PNG_VERSION_SUFFIXES 17 16 15 14 12)
if (PNG_FIND_VERSION MATCHES "^([0-9]+)\\.([0-9]+)(\\..*)?$")
set(_PNG_VERSION_SUFFIX_MIN "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
if (PNG_FIND_VERSION_EXACT)
@@ -79,14 +96,15 @@ if(ZLIB_FOUND)
# For compatibility with versions prior to this multi-config search, honor
# any PNG_LIBRARY that is already specified and skip the search.
if(NOT PNG_LIBRARY)
- find_library(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES} NAMES_PER_DIR)
- find_library(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG} NAMES_PER_DIR)
+ find_library(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES} NAMES_PER_DIR PATHS ${_PNG_LIB_SEARCH_NORMAL})
+ find_library(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG} NAMES_PER_DIR PATHS ${_PNG_LIB_SEARCH_NORMAL})
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(PNG)
mark_as_advanced(PNG_LIBRARY_RELEASE PNG_LIBRARY_DEBUG)
endif()
unset(PNG_NAMES)
unset(PNG_NAMES_DEBUG)
+ unset(_PNG_INCLUDE_PATH_SUFFIXES)
# Set by select_library_configurations(), but we want the one from
# find_package_handle_standard_args() below.
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
index d0f686c..0530988 100644
--- a/Modules/Platform/Android.cmake
+++ b/Modules/Platform/Android.cmake
@@ -39,6 +39,8 @@ endif()
# Commonly used Android toolchain files that pre-date CMake upstream support
# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
if(CMAKE_SYSTEM_VERSION EQUAL 1)
+ # The NDK legacy toolchain file provides its version number.
+ set(CMAKE_ANDROID_NDK_VERSION ${ANDROID_NDK_MAJOR}.${ANDROID_NDK_MINOR})
return()
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 9c3331e..9699b09 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 26)
-set(CMake_VERSION_PATCH 20230203)
+set(CMake_VERSION_PATCH 20230207)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index eec43c4..0d0b513 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -8,6 +8,7 @@
#include <set>
#include <vector>
+#include "cmCMakePath.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
@@ -220,17 +221,58 @@ void cmExtraKateGenerator::CreateDummyKateProjectFile(
std::string cmExtraKateGenerator::GenerateFilesString(
const cmLocalGenerator& lg) const
{
- std::string s = cmStrCat(lg.GetSourceDirectory(), "/.git");
- if (cmSystemTools::FileExists(s)) {
- return "\"git\": 1 ";
+ const cmMakefile* mf = lg.GetMakefile();
+ std::string mode =
+ cmSystemTools::UpperCase(mf->GetSafeDefinition("CMAKE_KATE_FILES_MODE"));
+ static const std::string gitString = "\"git\": 1 ";
+ static const std::string svnString = "\"svn\": 1 ";
+ static const std::string hgString = "\"hg\": 1 ";
+ static const std::string fossilString = "\"fossil\": 1 ";
+
+ if (mode == "SVN") {
+ return svnString;
}
-
- s = cmStrCat(lg.GetSourceDirectory(), "/.svn");
- if (cmSystemTools::FileExists(s)) {
- return "\"svn\": 1 ";
+ if (mode == "GIT") {
+ return gitString;
+ }
+ if (mode == "HG") {
+ return hgString;
}
+ if (mode == "FOSSIL") {
+ return fossilString;
+ }
+
+ // check for the VCS files except when "forced" to "FILES" mode:
+ if (mode != "LIST") {
+ cmCMakePath startDir(lg.GetSourceDirectory(), cmCMakePath::auto_format);
+ // move the directories up to the root directory to see whether we are in
+ // a subdir of a svn, git, hg or fossil checkout
+ for (;;) {
+ std::string s = startDir.String() + "/.git";
+ if (cmSystemTools::FileExists(s)) {
+ return gitString;
+ }
+
+ s = startDir.String() + "/.svn";
+ if (cmSystemTools::FileExists(s)) {
+ return svnString;
+ }
- s = cmStrCat(lg.GetSourceDirectory(), '/');
+ s = startDir.String() + "/.hg";
+ if (cmSystemTools::FileExists(s)) {
+ return hgString;
+ }
+ s = startDir.String() + "/.fslckout";
+ if (cmSystemTools::FileExists(s)) {
+ return fossilString;
+ }
+
+ if (!startDir.HasRelativePath()) { // have we reached the root dir ?
+ break;
+ }
+ startDir = startDir.GetParentPath();
+ }
+ }
std::set<std::string> files;
std::string tmp;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 468ff73..dbf961d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -964,7 +964,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
return true;
};
- auto ToolsetLamda = [&](std::string const& value, cmake* state) -> bool {
+ auto ToolsetLambda = [&](std::string const& value, cmake* state) -> bool {
if (haveToolset) {
cmSystemTools::Error("Multiple -T options not allowed");
return false;
@@ -1016,7 +1016,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
CommandArgument::RequiresSeparator::No, PlatformLambda },
CommandArgument{ "-T", "No toolset specified for -T",
CommandArgument::Values::One,
- CommandArgument::RequiresSeparator::No, ToolsetLamda },
+ CommandArgument::RequiresSeparator::No, ToolsetLambda },
CommandArgument{ "--toolchain", "No file specified for --toolchain",
CommandArgument::Values::One, IgnoreAndTrueLambda },
CommandArgument{ "--install-prefix",
diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt
index 1c24017..fcfce48 100644
--- a/Tests/COnly/CMakeLists.txt
+++ b/Tests/COnly/CMakeLists.txt
@@ -7,11 +7,5 @@ add_library(testc1 STATIC libc1.c)
add_library(testc2 SHARED libc2.c)
add_executable (COnly conly.c foo.c foo.h)
target_link_libraries(COnly testc1 testc2)
-if(MSVC_VERSION AND NOT CMAKE_C_COMPILER_ID STREQUAL Clang OR "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
- set_target_properties(COnly PROPERTIES
- LINK_FLAGS " /NODEFAULTLIB:\"libcdg.lib\" /NODEFAULTLIB:\"libcmtg.lib\" /NODEFAULTLIB:\"foomsvcrt.lib\" /NODEFAULTLIB:\"libbar.lib\" /NODEFAULTLIB:\"libfooba.lib\"")
-endif()
-string(ASCII 35 32 67 77 97 107 101 ASCII_STRING)
-message(STATUS "String: ${ASCII_STRING}")
add_library(testCModule MODULE testCModule.c)
diff --git a/Tests/LinkFlags/CMakeLists.txt b/Tests/LinkFlags/CMakeLists.txt
index 31ff9b5..de853cf 100644
--- a/Tests/LinkFlags/CMakeLists.txt
+++ b/Tests/LinkFlags/CMakeLists.txt
@@ -32,6 +32,11 @@ add_executable(LinkFlags_exe_config LinkFlagsExe.c)
set_property(TARGET LinkFlags_exe_config PROPERTY LINK_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj})
add_executable(LinkFlags LinkFlags.c)
+if("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC")
+ set_property(TARGET LinkFlags PROPERTY
+ LINK_FLAGS "/NODEFAULTLIB:\"libcdg.lib\" /NODEFAULTLIB:\"libcmtg.lib\" /NODEFAULTLIB:\"foomsvcrt.lib\" /NODEFAULTLIB:\"libbar.lib\" /NODEFAULTLIB:\"libfooba.lib\""
+ )
+endif()
add_subdirectory(LinkerFlags)
add_subdirectory(LinkerFlagsConfig)
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx
index e0b1872..8dfc41b 100644
--- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/importable.cxx
@@ -1,6 +1,8 @@
export module importable;
+extern "C++" {
int forwarding();
+}
export int from_import()
{
diff --git a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx
index e0b1872..8dfc41b 100644
--- a/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx
+++ b/Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/importable.cxx
@@ -1,6 +1,8 @@
export module importable;
+extern "C++" {
int forwarding();
+}
export int from_import()
{
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx
index e0b1872..8dfc41b 100644
--- a/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-build/importable.cxx
@@ -1,6 +1,8 @@
export module importable;
+extern "C++" {
int forwarding();
+}
export int from_import()
{
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx
index e0b1872..8dfc41b 100644
--- a/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-install/importable.cxx
@@ -1,6 +1,8 @@
export module importable;
+extern "C++" {
int forwarding();
+}
export int from_import()
{
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/importable.cxx
index e0b1872..8dfc41b 100644
--- a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/importable.cxx
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/importable.cxx
@@ -1,6 +1,8 @@
export module importable;
+extern "C++" {
int forwarding();
+}
export int from_import()
{
diff --git a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/importable.cxx b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/importable.cxx
index e0b1872..8dfc41b 100644
--- a/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/importable.cxx
+++ b/Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/importable.cxx
@@ -1,6 +1,8 @@
export module importable;
+extern "C++" {
int forwarding();
+}
export int from_import()
{