summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeFindBinUtils.cmake2
-rw-r--r--Modules/CMakeFortranCompilerId.F.in3
-rw-r--r--Modules/CPackIFW.cmake10
-rw-r--r--Modules/FindDoxygen.cmake3
-rw-r--r--Modules/FindIntl.cmake104
-rw-r--r--Modules/GNUInstallDirs.cmake5
-rw-r--r--Modules/Internal/CPack/CPackRPM.cmake29
-rw-r--r--Modules/Platform/Android-Initialize.cmake50
-rw-r--r--Modules/Platform/Android.cmake50
-rw-r--r--Modules/UseSWIG.cmake19
10 files changed, 173 insertions, 102 deletions
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index ff178f6..e87a16b 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -99,6 +99,8 @@ else()
set(_CMAKE_LINKER_NAMES "ld.lld")
endif()
list(APPEND _CMAKE_AR_NAMES "llvm-ar")
+ list(APPEND _CMAKE_RANLIB_NAMES "llvm-ranlib")
+ list(APPEND _CMAKE_STRIP_NAMES "llvm-strip")
list(APPEND _CMAKE_NM_NAMES "llvm-nm")
list(APPEND _CMAKE_OBJDUMP_NAMES "llvm-objdump")
list(APPEND _CMAKE_OBJCOPY_NAMES "llvm-objcopy")
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index 0b92b6a..f61a3f2 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -62,6 +62,9 @@
PRINT *, 'INFO:compiler[Cray]'
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
+# if defined(_RELEASE_PATCHLEVEL)
+# define COMPILER_VERSION_PATCH DEC(_RELEASE_PATCHLEVEL)
+# endif
#elif defined(__G95__)
PRINT *, 'INFO:compiler[G95]'
# define COMPILER_VERSION_MAJOR DEC(__G95__)
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
index d57cf18..2087a51 100644
--- a/Modules/CPackIFW.cmake
+++ b/Modules/CPackIFW.cmake
@@ -125,6 +125,11 @@ The module defines the following commands:
list of dependency component or component group identifiers in
QtIFW style.
+ .. versionadded:: 3.21
+
+ Component or group names listed as dependencies may contain hyphens.
+ This requires QtIFW 3.1 or later.
+
``AUTO_DEPEND_ON``
.. versionadded:: 3.8
@@ -260,6 +265,11 @@ The module defines the following commands:
list of dependency component or component group identifiers in
QtIFW style.
+ .. versionadded:: 3.21
+
+ Component or group names listed as dependencies may contain hyphens.
+ This requires QtIFW 3.1 or later.
+
``AUTO_DEPEND_ON``
.. versionadded:: 3.8
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index 7fe5da1..4a16e31 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -223,7 +223,8 @@ them to be separated by whitespace. CMake variables hold lists as a string with
items separated by semi-colons, so a conversion needs to be performed. The
``doxygen_add_docs()`` command specifically checks the following Doxygen config
options and will convert their associated CMake variable's contents into the
-required form if set.
+required form if set. CMake variables are named ``DOXYGEN_<name>`` for the
+Doxygen settings specified here.
::
diff --git a/Modules/FindIntl.cmake b/Modules/FindIntl.cmake
index a1dfed1..038f4da 100644
--- a/Modules/FindIntl.cmake
+++ b/Modules/FindIntl.cmake
@@ -61,24 +61,11 @@ The following cache variables may also be set:
The libintl library (if any)
-.. variable:: Intl_HAVE_GETTEXT_BUILTIN
+.. variable:: Intl_IS_BUILT_IN
.. versionadded:: 3.20
- True if gettext is in the C library
-
-.. variable:: Intl_HAVE_DCGETTEXT_BUILTIN
-
- .. versionadded:: 3.20
-
- True if dcgettext is in the C library
-
-.. variable:: Intl_IS_BUILTIN
-
- .. versionadded:: 3.20
-
- whether intl is a part of the C library determined from the result of
- Intl_HAVE_GETTEXT_BUILTIN and Intl_HAVE_DCGETTEXT_BUILTIN
+ whether ``intl`` is a part of the C library.
.. note::
On some platforms, such as Linux with GNU libc, the gettext
@@ -95,44 +82,60 @@ The following cache variables may also be set:
``msgfmt``, etc.), use :module:`FindGettext`.
#]=======================================================================]
-
-# Written by Roger Leigh <rleigh@codelibre.net>
-
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
-include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake)
-
-# Check if we have libintl is a part of libc
-cmake_push_check_state(RESET)
-set(CMAKE_REQUIRED_QUIET TRUE)
-check_symbol_exists(gettext libintl.h Intl_HAVE_GETTEXT_BUILTIN)
-check_symbol_exists(dcgettext libintl.h Intl_HAVE_DCGETTEXT_BUILTIN) # redundant check
-cmake_pop_check_state()
-
-if(Intl_HAVE_GETTEXT_BUILTIN AND Intl_HAVE_DCGETTEXT_BUILTIN)
- set(Intl_IS_BUILTIN TRUE)
+if(CMAKE_C_COMPILER_LOADED)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckCSourceCompiles.cmake)
+elseif(CMAKE_CXX_COMPILER_LOADED)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSourceCompiles.cmake)
else()
- set(Intl_IS_BUILTIN FALSE)
+ # If neither C nor CXX are loaded, implicit intl makes no sense.
+ set(Intl_IS_BUILT_IN FALSE)
endif()
-# Find include directory
-find_path(Intl_INCLUDE_DIR
- NAMES "libintl.h"
- DOC "libintl include directory")
-mark_as_advanced(Intl_INCLUDE_DIR)
+# Check if Intl is built in to the C library.
+if(NOT DEFINED Intl_IS_BUILT_IN)
+ if(NOT DEFINED Intl_INCLUDE_DIR AND NOT DEFINED Intl_LIBRARY)
+ cmake_push_check_state(RESET)
+ set(CMAKE_REQUIRED_QUIET TRUE)
+ set(Intl_IMPLICIT_TEST_CODE [[
+#include <libintl.h>
+int main(void) {
+ gettext("");
+ dgettext("", "");
+ dcgettext("", "", 0);
+ return 0;
+}
+]])
+ if(CMAKE_C_COMPILER_LOADED)
+ check_c_source_compiles("${Intl_IMPLICIT_TEST_CODE}" Intl_IS_BUILT_IN)
+ else()
+ check_cxx_source_compiles("${Intl_IMPLICIT_TEST_CODE}" Intl_IS_BUILT_IN)
+ endif()
+ cmake_pop_check_state()
+ else()
+ set(Intl_IS_BUILT_IN FALSE)
+ endif()
+endif()
-# Find all Intl libraries
-if(NOT Intl_IS_BUILTIN)
- set(Intl_LIBRARY_NAMES "intl" "libintl")
+set(_Intl_REQUIRED_VARS)
+if(Intl_IS_BUILT_IN)
+ set(_Intl_REQUIRED_VARS _Intl_IS_BUILT_IN_MSG)
+ set(_Intl_IS_BUILT_IN_MSG "built in to C library")
else()
- set(Intl_LIBRARY_NAMES "c")
-endif()
+ set(_Intl_REQUIRED_VARS Intl_LIBRARY Intl_INCLUDE_DIR)
+
+ find_path(Intl_INCLUDE_DIR
+ NAMES "libintl.h"
+ DOC "libintl include directory")
+ mark_as_advanced(Intl_INCLUDE_DIR)
-find_library(Intl_LIBRARY ${Intl_LIBRARY_NAMES} NAMES_PER_DIR
- DOC "intl library (potentially the C library)")
-mark_as_advanced(Intl_LIBRARY)
+ find_library(Intl_LIBRARY "intl" "libintl" NAMES_PER_DIR
+ DOC "libintl libraries (if not in the C library)")
+ mark_as_advanced(Intl_LIBRARY)
+endif()
# NOTE: glibc's libintl.h does not define LIBINTL_VERSION
-if(Intl_INCLUDE_DIR AND NOT Intl_IS_BUILTIN)
+if(Intl_INCLUDE_DIR AND EXISTS "${Intl_INCLUDE_DIR}/libintl.h")
file(STRINGS ${Intl_INCLUDE_DIR}/libintl.h Intl_VERSION_DEFINE REGEX "LIBINTL_VERSION (.*)")
if(Intl_VERSION_DEFINE MATCHES "(0x[A-Fa-f0-9]+)")
@@ -155,13 +158,20 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
FOUND_VAR Intl_FOUND
- REQUIRED_VARS Intl_LIBRARY Intl_INCLUDE_DIR
+ REQUIRED_VARS ${_Intl_REQUIRED_VARS}
VERSION_VAR Intl_VERSION
FAIL_MESSAGE "Failed to find Gettext libintl")
+unset(_Intl_REQUIRED_VARS)
+unset(_Intl_IS_BUILT_IN_MSG)
if(Intl_FOUND)
- set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
- set(Intl_LIBRARIES "${Intl_LIBRARY}")
+ if(Intl_IS_BUILT_IN)
+ set(Intl_INCLUDE_DIRS "")
+ set(Intl_LIBRARIES "")
+ else()
+ set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
+ set(Intl_LIBRARIES "${Intl_LIBRARY}")
+ endif()
if(NOT TARGET Intl::Intl)
add_library(Intl::Intl INTERFACE IMPORTED)
set_target_properties(Intl::Intl PROPERTIES
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index 37869fb..e149f4c 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -21,7 +21,10 @@ Inclusion of this module defines the following variables:
Destination for files of a given type. This value may be passed to
the ``DESTINATION`` options of :command:`install` commands for the
- corresponding file type.
+ corresponding file type. It should typically be a path relative to
+ the installation prefix so that it can be converted to an absolute
+ path in a relocatable way (see ``CMAKE_INSTALL_FULL_<dir>``).
+ However, an absolute path is also allowed.
``CMAKE_INSTALL_FULL_<dir>``
diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake
index 08bbc68..faaff7b 100644
--- a/Modules/Internal/CPack/CPackRPM.cmake
+++ b/Modules/Internal/CPack/CPackRPM.cmake
@@ -1349,15 +1349,21 @@ function(cpack_rpm_generate_package)
continue()
endif()
- file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE
+ file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES true RELATIVE
"${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}"
"${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*")
foreach(f_ IN LISTS files_for_move_)
- get_filename_component(dir_path_ "${f_}" DIRECTORY)
set(src_file_
"${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/${f_}")
+ if(IS_DIRECTORY "${src_file_}")
+ file(MAKE_DIRECTORY "${WDIR}/${f_}")
+ continue()
+ endif()
+
+ get_filename_component(dir_path_ "${f_}" DIRECTORY)
+
# check that we are not overriding an existing file that doesn't
# match the file that we want to copy
if(EXISTS "${src_file_}" AND EXISTS "${WDIR}/${f_}")
@@ -1637,6 +1643,25 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
%description -n \@CPACK_RPM_PACKAGE_NAME\@
\@CPACK_RPM_PACKAGE_DESCRIPTION\@
+%post -n \@CPACK_RPM_PACKAGE_NAME\@
+\@RPM_SYMLINK_POSTINSTALL\@
+\@CPACK_RPM_SPEC_POSTINSTALL\@
+
+%posttrans -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_SPEC_POSTTRANS\@
+
+%postun -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_SPEC_POSTUNINSTALL\@
+
+%pre -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_SPEC_PREINSTALL\@
+
+%pretrans -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_SPEC_PRETRANS\@
+
+%preun -n \@CPACK_RPM_PACKAGE_NAME\@
+\@CPACK_RPM_SPEC_PREUNINSTALL\@
+
%files -n \@CPACK_RPM_PACKAGE_NAME\@
%defattr(\@TMP_DEFAULT_FILE_PERMISSIONS\@,\@TMP_DEFAULT_USER\@,\@TMP_DEFAULT_GROUP\@,\@TMP_DEFAULT_DIR_PERMISSIONS\@)
\@CPACK_RPM_INSTALL_FILES\@
diff --git a/Modules/Platform/Android-Initialize.cmake b/Modules/Platform/Android-Initialize.cmake
index 6116ae1..50f0620 100644
--- a/Modules/Platform/Android-Initialize.cmake
+++ b/Modules/Platform/Android-Initialize.cmake
@@ -25,6 +25,56 @@ endif()
set(CMAKE_BUILD_TYPE_INIT "RelWithDebInfo")
+if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
+ # Tell CMake not to search host sysroots for headers/libraries.
+
+ # All paths added to CMAKE_SYSTEM_*_PATH below will be rerooted under
+ # CMAKE_FIND_ROOT_PATH. This is set because:
+ # 1. Users may structure their libraries in a way similar to NDK. When they do that,
+ # they can simply append another path to CMAKE_FIND_ROOT_PATH.
+ # 2. CMAKE_FIND_ROOT_PATH must be non-empty for CMAKE_FIND_ROOT_PATH_MODE_* == ONLY
+ # to be meaningful. https://github.com/android-ndk/ndk/issues/890
+ list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/sysroot")
+
+ # Allow users to override these values in case they want more strict behaviors.
+ # For example, they may want to prevent the NDK's libz from being picked up so
+ # they can use their own.
+ # https://github.com/android-ndk/ndk/issues/517
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
+ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+ endif()
+
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
+ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+ endif()
+
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
+ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+ endif()
+
+ if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
+ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+ endif()
+
+ # Don't search paths in PATH environment variable.
+ if(NOT DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH)
+ set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
+ endif()
+
+ # Allows CMake to find headers in the architecture-specific include directories.
+ set(CMAKE_LIBRARY_ARCHITECTURE "${CMAKE_ANDROID_ARCH_TRIPLE}")
+
+ # Instructs CMake to search the correct API level for libraries.
+ # Besides the paths like <root>/<prefix>/lib/<arch>, cmake also searches <root>/<prefix>.
+ # So we can add the API level specific directory directly.
+ # https://github.com/android/ndk/issues/929
+ list(PREPEND CMAKE_SYSTEM_PREFIX_PATH
+ "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_SYSTEM_VERSION}"
+ )
+
+ list(APPEND CMAKE_SYSTEM_PROGRAM_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/bin")
+endif()
+
# Skip sysroot selection if the NDK has a unified toolchain.
if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
return()
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
index e4b9a09..6944e32 100644
--- a/Modules/Platform/Android.cmake
+++ b/Modules/Platform/Android.cmake
@@ -35,56 +35,6 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1)
return()
endif()
-if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
- # Tell CMake not to search host sysroots for headers/libraries.
-
- # All paths added to CMAKE_SYSTEM_*_PATH below will be rerooted under
- # CMAKE_FIND_ROOT_PATH. This is set because:
- # 1. Users may structure their libraries in a way similar to NDK. When they do that,
- # they can simply append another path to CMAKE_FIND_ROOT_PATH.
- # 2. CMAKE_FIND_ROOT_PATH must be non-empty for CMAKE_FIND_ROOT_PATH_MODE_* == ONLY
- # to be meaningful. https://github.com/android-ndk/ndk/issues/890
- list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/sysroot")
-
- # Allow users to override these values in case they want more strict behaviors.
- # For example, they may want to prevent the NDK's libz from being picked up so
- # they can use their own.
- # https://github.com/android-ndk/ndk/issues/517
- if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
- set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
- endif()
-
- if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
- set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
- endif()
-
- if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
- set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
- endif()
-
- if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
- set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
- endif()
-
- # Don't search paths in PATH environment variable.
- if(NOT DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH)
- set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
- endif()
-
- # Allows CMake to find headers in the architecture-specific include directories.
- set(CMAKE_LIBRARY_ARCHITECTURE "${CMAKE_ANDROID_ARCH_TRIPLE}")
-
- # Instructs CMake to search the correct API level for libraries.
- # Besides the paths like <root>/<prefix>/lib/<arch>, cmake also searches <root>/<prefix>.
- # So we can add the API level specific directory directly.
- # https://github.com/android/ndk/issues/929
- list(PREPEND CMAKE_SYSTEM_PREFIX_PATH
- "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_SYSTEM_VERSION}"
- )
-
- list(APPEND CMAKE_SYSTEM_PROGRAM_PATH "${CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED}/bin")
-endif()
-
# Include the NDK hook.
# It can be used by NDK to inject necessary fixes for an earlier cmake.
if(CMAKE_ANDROID_NDK)
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index b1e0576..c7d8346 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -38,7 +38,13 @@ Defines the following command for use with ``SWIG``:
.. versionchanged:: 3.15
Alternate library name (set with the :prop_tgt:`OUTPUT_NAME` property,
- for example) will be passed on to Python and CSharp wrapper libraries.
+ for example) will be passed on to ``Python`` and ``CSharp`` wrapper
+ libraries.
+
+ .. versionchanged:: 3.21
+ Generated library use standard naming conventions for ``CSharp`` language
+ when policy :policy:`CMP0122` is set to ``NEW``. Otherwise, the legacy
+ behavior is applied.
.. note::
@@ -950,6 +956,17 @@ function(SWIG_ADD_LIBRARY name)
endif ()
elseif (swig_lowercase_language STREQUAL "fortran")
# Do *not* override the target's library prefix
+ elseif (swig_lowercase_language STREQUAL "csharp")
+ cmake_policy(GET CMP0122 csharp_naming_policy)
+ if (csharp_naming_policy STREQUAL "NEW")
+ # Do *not* override the target's library prefix
+ else()
+ if (NOT csharp_naming_policy)
+ cmake_policy(GET_WARNING CMP0122 _cmp0122_warning)
+ message(AUTHOR_WARNING "${_cmp0122_warning}\n")
+ endif()
+ set_target_properties (${target_name} PROPERTIES PREFIX "")
+ endif()
else()
# assume empty prefix because we expect the module to be dynamically loaded
set_target_properties (${target_name} PROPERTIES PREFIX "")