summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-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
11 files changed, 109 insertions, 29 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 41e0e1a49e..1f89c74d20 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 9aaf6e5716..521bc5caf8 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 e1343293b7..8dcc1d54a5 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 28f713fdf0..985c765599 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 ad74c3cad0..978879815d 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 8f1cf01eac..e2fa579253 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 b59b38c936..6c544fdb27 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 cd44cc6d9e..c3b6bc3892 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 2b700ffd37..55be667a86 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 94d15db5fc..043b69ca02 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 d0f686cb03..05309883cd 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()