Merge topic 'update-minimum-cmake'

1f578ca3c5 cmake: use NEW behaviors for policies up to CMake 3.16
bc1ed229c3 cmake: use `list(APPEND)` when building up arglists
ad3153fee2 cmake: use `string(APPEND)` when building up file contents
e9ad416896 cmake: use `string(APPEND)` to build the objlib target names
a476581629 cmake: use `string(PREPEND)` to make paths absolute
bf2a9017d5 docs: add a release note for the CMake bump
ea4b22fa51 vtkModule: remove CMake pre-3.12 workarounds
de2db1654e vtk-config: require CMake 3.12 to find VTK
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kyle Edwards <kyle.edwards@kitware.com>
Acked-by: Brad King <brad.king@kitware.com>
Merge-request: !6622
UnusedIncludesXMLPU
Ben Boeckel 2020-04-09 21:34:47 +00:00 committed by Kitware Robot
commit 50f9bf6b62
19 changed files with 66 additions and 721 deletions

View File

@ -91,13 +91,6 @@ list(APPEND headers
if (TARGET vtkm::cuda)
enable_language(CUDA)
# XXX(cmake#7519): Workaround for CMake which causes the c++11 flag set for
# VTK-m using target_compile_features to not work.
if (CMAKE_VERSION VERSION_LESS 3.11)
set(CMAKE_CUDA_STANDARD 11)
set(CMAKE_CUDA_STANDARD_REQUIRED True)
endif()
# Temporarily suppress "has address taken but no possible call to it" warnings,
# until we figure out its implications.
# We are disabling all warnings as nvlink has no known way to suppress

View File

@ -4,8 +4,6 @@ LIBRARY_NAME
vtkAcceleratorsVTKm
DESCRIPTION
VTKm filters and algorithms
CONDITION
NOT CMAKE_VERSION VERSION_LESS "3.9.0"
DEPENDS
VTK::CommonCore
VTK::CommonDataModel

View File

@ -1,37 +0,0 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "@CVF_VERSION@")
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
# if the installed project requested no architecture check, don't perform the check
if("@CVF_ARCH_INDEPENDENT@")
return()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View File

@ -1,52 +0,0 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is equal to the requested version.
# The tweak version component is ignored.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "@CVF_VERSION@")
if("@CVF_VERSION@" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
set(CVF_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_NO_TWEAK "@CVF_VERSION@")
endif()
if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
else()
set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}")
endif()
if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
# if the installed project requested no architecture check, don't perform the check
if("@CVF_ARCH_INDEPENDENT@")
return()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View File

@ -1,51 +0,0 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
# but only if the requested major version is the same as the current one.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "@CVF_VERSION@")
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
if("@CVF_VERSION@" MATCHES "^([0-9]+)\\.")
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_MAJOR "@CVF_VERSION@")
endif()
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
# if the installed project requested no architecture check, don't perform the check
if("@CVF_ARCH_INDEPENDENT@")
return()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View File

@ -1,55 +0,0 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
# but only if the requested major and minor versions are the same as the current
# one.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "@CVF_VERSION@")
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
if("@CVF_VERSION@" MATCHES "^([0-9]+)\\.([0-9]+)")
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
else()
set(CVF_VERSION_MAJOR "@CVF_VERSION@")
set(CVF_VERSION_MINOR "")
endif()
if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND
(PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR))
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
# if the installed project requested no architecture check, don't perform the check
if("@CVF_ARCH_INDEPENDENT@")
return()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View File

@ -1,332 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CMakePackageConfigHelpers
-------------------------
Helpers functions for creating config files that can be included by other
projects to find and use a package.
Adds the :command:`configure_package_config_file()` and
:command:`write_basic_package_version_file()` commands.
Generating a Package Configuration File
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. command:: configure_package_config_file
Create a config file for a project::
configure_package_config_file(<input> <output>
INSTALL_DESTINATION <path>
[PATH_VARS <var1> <var2> ... <varN>]
[NO_SET_AND_CHECK_MACRO]
[NO_CHECK_REQUIRED_COMPONENTS_MACRO]
[INSTALL_PREFIX <path>]
)
``configure_package_config_file()`` should be used instead of the plain
:command:`configure_file()` command when creating the ``<PackageName>Config.cmake``
or ``<PackageName>-config.cmake`` file for installing a project or library.
It helps making the resulting package relocatable by avoiding hardcoded paths
in the installed ``Config.cmake`` file.
In a ``FooConfig.cmake`` file there may be code like this to make the install
destinations know to the using project:
.. code-block:: cmake
set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" )
set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" )
set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" )
#...logic to determine installedPrefix from the own location...
set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" )
All 4 options shown above are not sufficient, since the first 3 hardcode the
absolute directory locations, and the 4th case works only if the logic to
determine the ``installedPrefix`` is correct, and if ``CONFIG_INSTALL_DIR``
contains a relative path, which in general cannot be guaranteed. This has the
effect that the resulting ``FooConfig.cmake`` file would work poorly under
Windows and OSX, where users are used to choose the install location of a
binary package at install time, independent from how
:variable:`CMAKE_INSTALL_PREFIX` was set at build/cmake time.
Using ``configure_package_config_file`` helps. If used correctly, it makes
the resulting ``FooConfig.cmake`` file relocatable. Usage:
1. write a ``FooConfig.cmake.in`` file as you are used to
2. insert a line containing only the string ``@PACKAGE_INIT@``
3. instead of ``set(FOO_DIR "@SOME_INSTALL_DIR@")``, use
``set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")`` (this must be after the
``@PACKAGE_INIT@`` line)
4. instead of using the normal :command:`configure_file()`, use
``configure_package_config_file()``
The ``<input>`` and ``<output>`` arguments are the input and output file, the
same way as in :command:`configure_file()`.
The ``<path>`` given to ``INSTALL_DESTINATION`` must be the destination where
the ``FooConfig.cmake`` file will be installed to. This path can either be
absolute, or relative to the ``INSTALL_PREFIX`` path.
The variables ``<var1>`` to ``<varN>`` given as ``PATH_VARS`` are the
variables which contain install destinations. For each of them the macro will
create a helper variable ``PACKAGE_<var...>``. These helper variables must be
used in the ``FooConfig.cmake.in`` file for setting the installed location.
They are calculated by ``configure_package_config_file`` so that they are
always relative to the installed location of the package. This works both for
relative and also for absolute locations. For absolute locations it works
only if the absolute location is a subdirectory of ``INSTALL_PREFIX``.
If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to
calculate all the relative paths. The ``<path>`` argument must be an absolute
path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX`
variable will be used instead. The default value is good when generating a
FooConfig.cmake file to use your package from the install tree. When
generating a FooConfig.cmake file to use your package from the build tree this
option should be used.
By default ``configure_package_config_file`` also generates two helper macros,
``set_and_check()`` and ``check_required_components()`` into the
``FooConfig.cmake`` file.
``set_and_check()`` should be used instead of the normal ``set()`` command for
setting directories and file locations. Additionally to setting the variable
it also checks that the referenced file or directory actually exists and fails
with a ``FATAL_ERROR`` otherwise. This makes sure that the created
``FooConfig.cmake`` file does not contain wrong references.
When using the ``NO_SET_AND_CHECK_MACRO``, this macro is not generated
into the ``FooConfig.cmake`` file.
``check_required_components(<PackageName>)`` should be called at the end of
the ``FooConfig.cmake`` file. This macro checks whether all requested,
non-optional components have been found, and if this is not the case, sets
the ``Foo_FOUND`` variable to ``FALSE``, so that the package is considered to
be not found. It does that by testing the ``Foo_<Component>_FOUND``
variables for all requested required components. This macro should be
called even if the package doesn't provide any components to make sure
users are not specifying components erroneously. When using the
``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is not generated
into the ``FooConfig.cmake`` file.
For an example see below the documentation for
:command:`write_basic_package_version_file()`.
Generating a Package Version File
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. command:: write_basic_package_version_file
Create a version file for a project::
write_basic_package_version_file(<filename>
[VERSION <major.minor.patch>]
COMPATIBILITY <AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion>
[ARCH_INDEPENDENT] )
Writes a file for use as ``<PackageName>ConfigVersion.cmake`` file to
``<filename>``. See the documentation of :command:`find_package()` for
details on this.
``<filename>`` is the output filename, it should be in the build tree.
``<major.minor.patch>`` is the version number of the project to be installed.
If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable is used.
If this hasn't been set, it errors out.
The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed
package version will be considered compatible if it is newer or exactly the
same as the requested version. This mode should be used for packages which
are fully backward compatible, also across major versions.
If ``SameMajorVersion`` is used instead, then the behaviour differs from
``AnyNewerVersion`` in that the major version number must be the same as
requested, e.g. version 2.0 will not be considered compatible if 1.0 is
requested. This mode should be used for packages which guarantee backward
compatibility within the same major version.
If ``SameMinorVersion`` is used, the behaviour is the same as
``SameMajorVersion``, but both major and minor version must be the same as
requested, e.g version 0.2 will not be compatible if 0.1 is requested.
If ``ExactVersion`` is used, then the package is only considered compatible if
the requested version matches exactly its own version number (not considering
the tweak version). For example, version 1.2.3 of a package is only
considered compatible to requested version 1.2.3. This mode is for packages
without compatibility guarantees.
If your project has more elaborated version matching rules, you will need to
write your own custom ``ConfigVersion.cmake`` file instead of using this
macro.
If ``ARCH_INDEPENDENT`` is given, the installed package version will be
considered compatible even if it was built for a different architecture than
the requested architecture. Otherwise, an architecture check will be performed,
and the package will be considered compatible only if the architecture matches
exactly. For example, if the package is built for a 32-bit architecture, the
package is only considered compatible if it is used on a 32-bit architecture,
unless ``ARCH_INDEPENDENT`` is given, in which case the package is considered
compatible on any architecture.
.. note:: ``ARCH_INDEPENDENT`` is intended for header-only libraries or similar
packages with no binaries.
Internally, this macro executes :command:`configure_file()` to create the
resulting version file. Depending on the ``COMPATIBILITY``, the corresponding
``BasicConfigVersion-<COMPATIBILITY>.cmake.in`` file is used.
Please note that these files are internal to CMake and you should not call
:command:`configure_file()` on them yourself, but they can be used as starting
point to create more sophisticted custom ``ConfigVersion.cmake`` files.
Example Generating Package Files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Example using both :command:`configure_package_config_file` and
``write_basic_package_version_file()``:
``CMakeLists.txt``:
.. code-block:: cmake
set(INCLUDE_INSTALL_DIR include/ ... CACHE )
set(LIB_INSTALL_DIR lib/ ... CACHE )
set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE )
#...
include(CMakePackageConfigHelpers)
configure_package_config_file(FooConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake
PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
VERSION 1.2.3
COMPATIBILITY SameMajorVersion )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake )
``FooConfig.cmake.in``:
::
set(FOO_VERSION x.y.z)
...
@PACKAGE_INIT@
...
set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@")
check_required_components(Foo)
#]=======================================================================]
include(WriteBasicConfigVersionFile)
macro(WRITE_BASIC_PACKAGE_VERSION_FILE)
write_basic_config_version_file(${ARGN})
endmacro()
function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
set(oneValueArgs INSTALL_DESTINATION INSTALL_PREFIX)
set(multiValueArgs PATH_VARS )
cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(CCF_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"")
endif()
if(NOT CCF_INSTALL_DESTINATION)
message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()")
endif()
if(DEFINED CCF_INSTALL_PREFIX)
if(IS_ABSOLUTE "${CCF_INSTALL_PREFIX}")
set(installPrefix "${CCF_INSTALL_PREFIX}")
else()
message(FATAL_ERROR "INSTALL_PREFIX must be an absolute path")
endif()
elseif(IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}")
set(installPrefix "${CMAKE_INSTALL_PREFIX}")
else()
get_filename_component(installPrefix "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
endif()
if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}")
set(absInstallDir "${CCF_INSTALL_DESTINATION}")
else()
set(absInstallDir "${installPrefix}/${CCF_INSTALL_DESTINATION}")
endif()
file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${installPrefix}" )
foreach(var ${CCF_PATH_VARS})
if(NOT DEFINED ${var})
message(FATAL_ERROR "Variable ${var} does not exist")
else()
if(IS_ABSOLUTE "${${var}}")
string(REPLACE "${installPrefix}" "\${PACKAGE_PREFIX_DIR}"
PACKAGE_${var} "${${var}}")
else()
set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
endif()
endif()
endforeach()
get_filename_component(inputFileName "${_inputFile}" NAME)
set(PACKAGE_INIT "
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was ${inputFileName} ########
get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE)
")
if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+")
# Handle "/usr move" symlinks created by some Linux distros.
string(APPEND PACKAGE_INIT "
# Use original install prefix when loaded through a \"/usr move\"
# cross-prefix symbolic link such as /lib -> /usr/lib.
get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH)
get_filename_component(_realOrig \"${absInstallDir}\" REALPATH)
if(_realCurr STREQUAL _realOrig)
set(PACKAGE_PREFIX_DIR \"${installPrefix}\")
endif()
unset(_realOrig)
unset(_realCurr)
")
endif()
if(NOT CCF_NO_SET_AND_CHECK_MACRO)
string(APPEND PACKAGE_INIT "
macro(set_and_check _var _file)
set(\${_var} \"\${_file}\")
if(NOT EXISTS \"\${_file}\")
message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\")
endif()
endmacro()
")
endif()
if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO)
string(APPEND PACKAGE_INIT "
macro(check_required_components _NAME)
foreach(comp \${\${_NAME}_FIND_COMPONENTS})
if(NOT \${_NAME}_\${comp}_FOUND)
if(\${_NAME}_FIND_REQUIRED_\${comp})
set(\${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()
endmacro()
")
endif()
string(APPEND PACKAGE_INIT "
####################################################################################")
configure_file("${_inputFile}" "${_outputFile}" @ONLY)
endfunction()

View File

@ -1,53 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
WriteBasicConfigVersionFile
---------------------------
.. deprecated:: 3.0
Use the identical command :command:`write_basic_package_version_file()`
from module :module:`CMakePackageConfigHelpers`.
::
WRITE_BASIC_CONFIG_VERSION_FILE( filename
[VERSION major.minor.patch]
COMPATIBILITY (AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion)
[ARCH_INDEPENDENT]
)
#]=======================================================================]
set(_WriteBasicConfigVersionFile_DIR "${CMAKE_CURRENT_LIST_DIR}")
function(WRITE_BASIC_CONFIG_VERSION_FILE _filename)
set(options ARCH_INDEPENDENT )
set(oneValueArgs VERSION COMPATIBILITY )
set(multiValueArgs )
cmake_parse_arguments(CVF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(CVF_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to WRITE_BASIC_CONFIG_VERSION_FILE(): \"${CVF_UNPARSED_ARGUMENTS}\"")
endif()
set(versionTemplateFile "${_WriteBasicConfigVersionFile_DIR}/BasicConfigVersion-${CVF_COMPATIBILITY}.cmake.in")
if(NOT EXISTS "${versionTemplateFile}")
message(FATAL_ERROR "Bad COMPATIBILITY value used for WRITE_BASIC_CONFIG_VERSION_FILE(): \"${CVF_COMPATIBILITY}\"")
endif()
if("${CVF_VERSION}" STREQUAL "")
if ("${PROJECT_VERSION}" STREQUAL "")
message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
else()
set(CVF_VERSION "${PROJECT_VERSION}")
endif()
endif()
configure_file("${versionTemplateFile}" "${_filename}" @ONLY)
endfunction()

View File

@ -299,17 +299,6 @@ set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95
mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r
mpixlf mpixlf_r mpxlf mpxlf_r)
# XXX(cmake-3.9.0): Support CMake 3.8.0 `separate_arguments` signature.
if (CMAKE_VERSION VERSION_LESS "3.9.0")
if (WIN32 AND NOT CYGWIN)
set(_MPI_parse_kind WINDOWS_COMMAND)
else ()
set(_MPI_parse_kind UNIX_COMMAND)
endif ()
else ()
set(_MPI_parse_kind NATIVE_COMMAND)
endif ()
# Prepend vendor-specific compiler wrappers to the list. If we don't know the compiler,
# attempt all of them.
# By attempting vendor-specific compiler names first, we should avoid situations where the compiler wrapper
@ -344,9 +333,9 @@ unset(_MPIEXEC_NAMES_BASE)
function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE)
if(DEFINED MPI_${LANG}_COMPILER_FLAGS)
separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS ${_MPI_parse_kind} "${MPI_${LANG}_COMPILER_FLAGS}")
separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_${LANG}_COMPILER_FLAGS}")
else()
separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS ${_MPI_parse_kind} "${MPI_COMPILER_FLAGS}")
separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_COMPILER_FLAGS}")
endif()
execute_process(
COMMAND ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG}
@ -634,7 +623,7 @@ function (_MPI_interrogate_compiler LANG)
if (NOT MPI_ALL_INCLUDE_PATHS)
_MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN)
if(MPI_INCDIRS_COMPILER_RETURN)
separate_arguments(MPI_ALL_INCLUDE_PATHS ${_MPI_parse_kind} "${MPI_INCDIRS_CMDLINE}")
separate_arguments(MPI_ALL_INCLUDE_PATHS NATIVE_COMMAND "${MPI_INCDIRS_CMDLINE}")
endif()
endif()
@ -702,7 +691,7 @@ function (_MPI_interrogate_compiler LANG)
if (NOT MPI_ALL_LINK_PATHS)
_MPI_check_compiler(${LANG} "-showme:libdirs" MPI_LIBDIRS_CMDLINE MPI_LIBDIRS_COMPILER_RETURN)
if(MPI_LIBDIRS_COMPILER_RETURN)
separate_arguments(MPI_ALL_LINK_PATHS ${_MPI_parse_kind} "${MPI_LIBDIRS_CMDLINE}")
separate_arguments(MPI_ALL_LINK_PATHS NATIVE_COMMAND "${MPI_LIBDIRS_CMDLINE}")
endif()
endif()
@ -1159,7 +1148,7 @@ macro(_MPI_create_imported_target LANG)
set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "")
if(MPI_${LANG}_LINK_FLAGS)
separate_arguments(_MPI_${LANG}_LINK_FLAGS ${_MPI_parse_kind} "${MPI_${LANG}_LINK_FLAGS}")
separate_arguments(_MPI_${LANG}_LINK_FLAGS NATIVE_COMMAND "${MPI_${LANG}_LINK_FLAGS}")
set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${_MPI_${LANG}_LINK_FLAGS}")
unset(_MPI_${LANG}_LINK_FLAGS)
endif()
@ -1350,7 +1339,7 @@ if(NOT MPI_IGNORE_LEGACY_VARIABLES)
unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS)
unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS)
if(MPI_${LANG}_COMPILE_FLAGS)
separate_arguments(MPI_SEPARATE_FLAGS ${_MPI_parse_kind} "${MPI_${LANG}_COMPILE_FLAGS}")
separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}")
foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS)
if("${_MPI_FLAG}" MATCHES "^ *-D([^ ]+)")
list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}")
@ -1719,13 +1708,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
set(MPI_${LANG}_INCLUDE_PATH "${MPI_${LANG}_INCLUDE_DIRS}")
unset(MPI_${LANG}_COMPILE_FLAGS)
if(MPI_${LANG}_COMPILE_OPTIONS)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
list(JOIN MPI_${LANG}_COMPILE_OPTIONS " " MPI_${LANG}_COMPILE_FLAGS)
else()
foreach(_MPI_OPT IN LISTS MPI_${LANG}_COMPILE_OPTIONS)
string(APPEND MPI_${LANG}_COMPILE_FLAGS " ${_MPI_OPT}")
endforeach()
endif()
list(JOIN MPI_${LANG}_COMPILE_OPTIONS " " MPI_${LANG}_COMPILE_FLAGS)
endif()
if(MPI_${LANG}_COMPILE_DEFINITIONS)
foreach(_MPI_DEF IN LISTS MPI_${LANG}_COMPILE_DEFINITIONS)

View File

@ -15,27 +15,6 @@ if (_${_PYTHON_PREFIX}_LOOKUP_POLICY)
cmake_policy (SET CMP0094 ${_${_PYTHON_PREFIX}_LOOKUP_POLICY})
endif()
if (CMAKE_VERSION VERSION_LESS 3.12)
function (_find_python_list_transform list actn)
set(_result)
if (CMAKE_VERSION VERSION_LESS 3.10 AND actn STREQUAL "PREPEND")
foreach(_item IN LISTS ${list})
list(APPEND _result ${ARGN}${_item})
endforeach()
else()
foreach(_item IN LISTS ${list})
string(${actn} _item ${ARGN})
list(APPEND _result ${_item})
endforeach()
endif()
set(${list} ${_result} PARENT_SCOPE)
endfunction()
else()
macro(_find_python_list_transform)
list (TRANSFORM ${ARGN})
endmacro()
endif()
#
# Initial configuration
#
@ -193,14 +172,14 @@ function (_PYTHON_GET_ABIFLAGS _PGABIFLAGS)
if (pydebug STREQUAL "ON")
if (abiflags)
_find_python_list_transform (abiflags PREPEND "d")
list (TRANSFORM abiflags PREPEND "d")
else()
set (abiflags "d")
endif()
elseif (pydebug STREQUAL "ANY")
if (abiflags)
set (flags "${abiflags}")
_find_python_list_transform (flags PREPEND "d")
list (TRANSFORM flags PREPEND "d")
list (APPEND abiflags "${flags}")
else()
set (abiflags "" "d")
@ -229,8 +208,8 @@ function (_PYTHON_GET_PATH_SUFFIXES _PYTHON_PGPS_PATH_SUFFIXES)
if (CMAKE_LIBRARY_ARCHITECTURE)
set (suffixes "${abi}")
if (suffixes)
_find_python_list_transform (suffixes PREPEND "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}")
_find_python_list_transform (suffixes APPEND "-${CMAKE_LIBRARY_ARCHITECTURE}")
list (TRANSFORM suffixes PREPEND "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}")
list (TRANSFORM suffixes APPEND "-${CMAKE_LIBRARY_ARCHITECTURE}")
else()
set (suffixes "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}-${CMAKE_LIBRARY_ARCHITECTURE}")
endif()
@ -238,7 +217,7 @@ function (_PYTHON_GET_PATH_SUFFIXES _PYTHON_PGPS_PATH_SUFFIXES)
endif()
set (suffixes "${abi}")
if (suffixes)
_find_python_list_transform (suffixes PREPEND "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}")
list (TRANSFORM suffixes PREPEND "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}")
else()
set (suffixes "lib/python${_PGPS_VERSION}/config-${_PGPS_VERSION}")
endif()
@ -246,7 +225,7 @@ function (_PYTHON_GET_PATH_SUFFIXES _PYTHON_PGPS_PATH_SUFFIXES)
elseif (_PGPS_INCLUDE)
set (suffixes "${abi}")
if (suffixes)
_find_python_list_transform (suffixes PREPEND "include/python${_PGPS_VERSION}")
list (TRANSFORM suffixes PREPEND "include/python${_PGPS_VERSION}")
else()
set (suffixes "include/python${_PGPS_VERSION}")
endif()
@ -286,14 +265,14 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES)
if (abi)
if (_PGN_CONFIG AND DEFINED CMAKE_LIBRARY_ARCHITECTURE)
set (abinames "${abi}")
_find_python_list_transform (abinames PREPEND "${CMAKE_LIBRARY_ARCHITECTURE}-python${_PGN_VERSION}")
_find_python_list_transform (abinames APPEND "-config")
list (TRANSFORM abinames PREPEND "${CMAKE_LIBRARY_ARCHITECTURE}-python${_PGN_VERSION}")
list (TRANSFORM abinames APPEND "-config")
list (APPEND names ${abinames})
endif()
set (abinames "${abi}")
_find_python_list_transform (abinames PREPEND "python${_PGN_VERSION}")
list (TRANSFORM abinames PREPEND "python${_PGN_VERSION}")
if (_PGN_CONFIG)
_find_python_list_transform (abinames APPEND "-config")
list (TRANSFORM abinames APPEND "-config")
endif()
list (APPEND names ${abinames})
else()
@ -302,7 +281,7 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES)
endif()
list (APPEND abinames "python${_PGN_VERSION}")
if (_PGN_CONFIG)
_find_python_list_transform (abinames APPEND "-config")
list (TRANSFORM abinames APPEND "-config")
endif()
list (APPEND names ${abinames})
endif()
@ -847,8 +826,8 @@ else()
if (DEFINED ${_PYTHON_PREFIX}_FIND_ABI)
# normalization
string (TOUPPER "${${_PYTHON_PREFIX}_FIND_ABI}" _${_PYTHON_PREFIX}_FIND_ABI)
_find_python_list_transform (_${_PYTHON_PREFIX}_FIND_ABI REPLACE "^(TRUE|Y(ES)?|1)$" "ON")
_find_python_list_transform (_${_PYTHON_PREFIX}_FIND_ABI REPLACE "^(FALSE|N(O)?|0)$" "OFF")
list (TRANSFORM _${_PYTHON_PREFIX}_FIND_ABI REPLACE "^(TRUE|Y(ES)?|1)$" "ON")
list (TRANSFORM _${_PYTHON_PREFIX}_FIND_ABI REPLACE "^(FALSE|N(O)?|0)$" "OFF")
if (NOT _${_PYTHON_PREFIX}_FIND_ABI MATCHES "^(ON|OFF|ANY);(ON|OFF|ANY);(ON|OFF|ANY)$")
message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${${_PYTHON_PREFIX}_FIND_ABI}: invalid value for '${_PYTHON_PREFIX}_FIND_ABI'. Ignore it")
unset (_${_PYTHON_PREFIX}_FIND_ABI)

View File

@ -49,8 +49,15 @@ data.
[VTK module API]: TODO: Link to hosted documentation.
#]==]
if (CMAKE_VERSION VERSION_LESS "3.12")
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
set("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE"
"VTK requires CMake 3.12 in order to reliably be used.")
return ()
endif ()
cmake_policy(PUSH)
cmake_policy(VERSION 3.8...3.12)
cmake_policy(VERSION 3.12)
set(_vtk_temp_variables)
set(_vtk_real_components)

View File

@ -579,7 +579,7 @@ function (vtk_module_scan)
foreach (_vtk_scan_kit_file IN LISTS _vtk_scan_KIT_FILES)
if (NOT IS_ABSOLUTE "${_vtk_scan_kit_file}")
set(_vtk_scan_kit_file "${CMAKE_CURRENT_SOURCE_DIR}/${_vtk_scan_kit_file}")
string(PREPEND _vtk_scan_kit_file "${CMAKE_CURRENT_SOURCE_DIR}/")
endif ()
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND
PROPERTY
@ -615,7 +615,7 @@ function (vtk_module_scan)
# Read all of the module files passed in.
foreach (_vtk_scan_module_file IN LISTS _vtk_scan_MODULE_FILES)
if (NOT IS_ABSOLUTE "${_vtk_scan_module_file}")
set(_vtk_scan_module_file "${CMAKE_CURRENT_SOURCE_DIR}/${_vtk_scan_module_file}")
string(PREPEND _vtk_scan_module_file "${CMAKE_CURRENT_SOURCE_DIR}/")
endif ()
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND
PROPERTY
@ -1113,11 +1113,11 @@ function (_vtk_module_real_target var module)
get_property(_vtk_real_target_kit GLOBAL
PROPERTY "_vtk_module_${module}_kit")
if (_vtk_real_target_kit)
set(_vtk_real_target_res "${_vtk_real_target_res}-objects")
string(APPEND _vtk_real_target_res "-objects")
endif ()
# A query for after the module is built.
elseif (TARGET "${_vtk_real_target_res}-objects")
set(_vtk_real_target_res "${_vtk_real_target_res}-objects")
string(APPEND _vtk_real_target_res "-objects")
endif ()
endif ()
@ -1532,7 +1532,7 @@ function (vtk_module_link module)
get_property(_vtk_link_kit GLOBAL
PROPERTY "_vtk_module_${module}_kit")
if (_vtk_link_kit AND NOT CMAKE_VERSION VERSION_LESS "3.12")
if (_vtk_link_kit)
foreach (_vtk_link_private IN LISTS _vtk_link_PRIVATE)
if (NOT TARGET "${_vtk_link_private}")
continue ()
@ -2215,12 +2215,6 @@ function (vtk_module_build)
set(_vtk_build_BUILD_WITH_KITS OFF)
endif ()
if (_vtk_build_BUILD_WITH_KITS AND CMAKE_VERSION VERSION_LESS "3.12")
message(FATAL_ERROR
"Building with kits enabled requires CMake 3.12 which introduced "
"support for OBJECT libraries to have and utilize usage requirements.")
endif ()
if (_vtk_build_BUILD_WITH_KITS AND NOT DEFINED _vtk_build_KITS)
message(FATAL_ERROR
"Building with kits was requested, but no kits were specified.")
@ -2968,7 +2962,7 @@ function (_vtk_module_write_wrap_hierarchy)
set(_vtk_add_module_target_name_iface "${_vtk_add_module_target_name}")
if (_vtk_add_module_build_with_kit)
set(_vtk_add_module_target_name_iface "${_vtk_add_module_target_name}-objects")
string(APPEND _vtk_add_module_target_name_iface "-objects")
endif ()
set(_vtk_hierarchy_genex_compile_definitions
"$<TARGET_PROPERTY:${_vtk_add_module_target_name_iface},COMPILE_DEFINITIONS>")
@ -3257,8 +3251,6 @@ function (vtk_module_add_module name)
"belong in kits.")
endif ()
# XXX(cmake-3.12.0): This unset is no longer necessary when 3.12.0 is required.
unset("${_vtk_build_module}_LIB_DEPENDS" CACHE)
add_library("${_vtk_add_module_real_target}" INTERFACE)
if (NOT _vtk_build_module STREQUAL _vtk_add_module_real_target)
@ -3285,8 +3277,6 @@ function (vtk_module_add_module name)
PROPERTY
"INTERFACE_vtk_module_library_name" "${_vtk_add_module_library_name}")
# XXX(cmake-3.12.0): This unset is no longer necessary when 3.12.0 is required.
unset("${_vtk_build_module}_LIB_DEPENDS" CACHE)
add_library("${_vtk_add_module_real_target}-objects" OBJECT
${_vtk_add_module_SOURCES}
${_vtk_add_module_TEMPLATES}
@ -3301,7 +3291,7 @@ function (vtk_module_add_module name)
target_compile_definitions("${_vtk_add_module_real_target}-objects"
PRIVATE
"${_vtk_add_module_real_target}_EXPORT")
set(_vtk_add_module_real_target "${_vtk_add_module_real_target}-objects")
string(APPEND _vtk_add_module_real_target "-objects")
else ()
add_library("${_vtk_add_module_real_target}" ${_vtk_add_module_type}
${_vtk_add_module_SOURCES}
@ -3560,8 +3550,8 @@ function (vtk_module_add_module name)
set(_vtk_add_module_autoinit_content)
if (_vtk_add_module_autoinit_depends_includes)
set(_vtk_add_module_autoinit_content
"${_vtk_add_module_autoinit_content}/* AutoInit dependencies. */\n${_vtk_add_module_autoinit_depends_includes}\n")
string(APPEND _vtk_add_module_autoinit_content
"/* AutoInit dependencies. */\n${_vtk_add_module_autoinit_depends_includes}\n")
endif ()
get_property(_vtk_add_module_implementable GLOBAL
@ -3582,8 +3572,8 @@ function (vtk_module_add_module name)
PROPERTY
"INTERFACE_vtk_module_needs_autoinit" 1)
set(_vtk_add_module_autoinit_content
"${_vtk_add_module_autoinit_content}
string(APPEND _vtk_add_module_autoinit_content
"
/* AutoInit implementations. */
#ifdef ${_vtk_add_module_library_name}_AUTOINIT_INCLUDE
#include ${_vtk_add_module_library_name}_AUTOINIT_INCLUDE
@ -3594,8 +3584,8 @@ VTK_MODULE_AUTOINIT(${_vtk_add_module_library_name})
#endif
")
set(_vtk_add_module_module_content
"${_vtk_add_module_module_content}${_vtk_add_module_autoinit_content}")
string(APPEND _vtk_add_module_module_content
"${_vtk_add_module_autoinit_content}")
endif ()
if (NOT _vtk_add_module_HEADER_ONLY AND NOT _vtk_add_module_third_party)
@ -3824,15 +3814,10 @@ function to keep the install uniform.
function (_vtk_module_install target)
set(_vtk_install_export)
if (_vtk_build_INSTALL_EXPORT)
set(_vtk_install_export
list(APPEND _vtk_install_export
EXPORT "${_vtk_build_INSTALL_EXPORT}")
endif ()
set(_vtk_install_namelink_args)
if(NOT CMAKE_VERSION VERSION_LESS 3.12)
list(APPEND _vtk_install_namelink_args
NA