diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeCUDAInformation.cmake | 6 | ||||
-rw-r--r-- | Modules/CPack.NuGet.nuspec.in | 24 | ||||
-rw-r--r-- | Modules/CPack.cmake | 680 | ||||
-rw-r--r-- | Modules/CPackNuGet.cmake | 556 | ||||
-rw-r--r-- | Modules/CPackRPM.cmake | 28 | ||||
-rw-r--r-- | Modules/FindBLAS.cmake | 11 | ||||
-rw-r--r-- | Modules/FindBZip2.cmake | 24 | ||||
-rw-r--r-- | Modules/FindBoost.cmake | 68 | ||||
-rw-r--r-- | Modules/FindCUDA.cmake | 12 | ||||
-rw-r--r-- | Modules/FindDoxygen.cmake | 12 | ||||
-rw-r--r-- | Modules/FindJNI.cmake | 4 | ||||
-rw-r--r-- | Modules/FindJPEG.cmake | 2 | ||||
-rw-r--r-- | Modules/FindJava.cmake | 2 | ||||
-rw-r--r-- | Modules/FindLua.cmake | 134 | ||||
-rw-r--r-- | Modules/FindODBC.cmake | 227 | ||||
-rw-r--r-- | Modules/FindPerl.cmake | 1 | ||||
-rw-r--r-- | Modules/FindPkgConfig.cmake | 47 | ||||
-rw-r--r-- | Modules/FindQt4.cmake | 46 | ||||
-rw-r--r-- | Modules/InstallRequiredSystemLibraries.cmake | 18 | ||||
-rw-r--r-- | Modules/Platform/Windows-NVIDIA-CUDA.cmake | 8 | ||||
-rw-r--r-- | Modules/Qt4Macros.cmake | 25 |
21 files changed, 1417 insertions, 518 deletions
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index 479493b..8e62941 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -168,7 +168,7 @@ endif() # compile a cu file into an executable if(NOT CMAKE_CUDA_LINK_EXECUTABLE) set(CMAKE_CUDA_LINK_EXECUTABLE - "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_CUDA_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_LINKS}") + "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_LINKS}") endif() if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "8.0.0") @@ -194,11 +194,11 @@ unset(__IMPLICT_DLINK_DIRS) #These are used when linking relocatable (dc) cuda code if(NOT CMAKE_CUDA_DEVICE_LINK_LIBRARY) set(CMAKE_CUDA_DEVICE_LINK_LIBRARY - "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <CMAKE_CUDA_LINK_FLAGS> <LANGUAGE_COMPILE_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}") + "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <LANGUAGE_COMPILE_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}") endif() if(NOT CMAKE_CUDA_DEVICE_LINK_EXECUTABLE) set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE - "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <FLAGS> <CMAKE_CUDA_LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}") + "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}") endif() unset(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS) diff --git a/Modules/CPack.NuGet.nuspec.in b/Modules/CPack.NuGet.nuspec.in new file mode 100644 index 0000000..b7beb5d --- /dev/null +++ b/Modules/CPack.NuGet.nuspec.in @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> + <metadata> + <!-- Required elements--> + <id>@CPACK_NUGET_PACKAGE_NAME@</id> + <version>@CPACK_NUGET_PACKAGE_VERSION@</version> + <description>@CPACK_NUGET_PACKAGE_DESCRIPTION@</description> + <authors>@CPACK_NUGET_PACKAGE_AUTHORS@</authors> + + <!-- Optional elements --> + @_CPACK_NUGET_TITLE_TAG@ + @_CPACK_NUGET_OWNERS_TAG@ + @_CPACK_NUGET_PROJECTURL_TAG@ + @_CPACK_NUGET_LICENSEURL_TAG@ + @_CPACK_NUGET_ICONURL_TAG@ + @_CPACK_NUGET_REQUIRELICENSEACCEPTANCE_TAG@ + @_CPACK_NUGET_SUMMARY_TAG@ + @_CPACK_NUGET_RELEASENOTES_TAG@ + @_CPACK_NUGET_COPYRIGHT_TAG@ + @_CPACK_NUGET_TAGS_TAG@ + @_CPACK_NUGET_DEPENDENCIES_TAG@ + </metadata> + @_CPACK_NUGET_FILES_TAG@ +</package> diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index f6d74c5..8070869 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -1,326 +1,342 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -#.rst: -# CPack -# ----- -# -# Build binary and source package installers. -# -# Variables common to all CPack generators -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# The -# CPack module generates binary and source installers in a variety of -# formats using the cpack program. Inclusion of the CPack module adds -# two new targets to the resulting makefiles, package and -# package_source, which build the binary and source installers, -# respectively. The generated binary installers contain everything -# installed via CMake's INSTALL command (and the deprecated -# INSTALL_FILES, INSTALL_PROGRAMS, and INSTALL_TARGETS commands). -# -# For certain kinds of binary installers (including the graphical -# installers on Mac OS X and Windows), CPack generates installers that -# allow users to select individual application components to install. -# See CPackComponent module for that. -# -# The CPACK_GENERATOR variable has different meanings in different -# contexts. In your CMakeLists.txt file, CPACK_GENERATOR is a *list of -# generators*: when run with no other arguments, CPack will iterate over -# that list and produce one package for each generator. In a -# CPACK_PROJECT_CONFIG_FILE, though, CPACK_GENERATOR is a *string naming -# a single generator*. If you need per-cpack- generator logic to -# control *other* cpack settings, then you need a -# CPACK_PROJECT_CONFIG_FILE. -# -# The CMake source tree itself contains a CPACK_PROJECT_CONFIG_FILE. -# See the top level file CMakeCPackOptions.cmake.in for an example. -# -# If set, the CPACK_PROJECT_CONFIG_FILE is included automatically on a -# per-generator basis. It only need contain overrides. -# -# Here's how it works: -# -# * cpack runs -# * it includes CPackConfig.cmake -# * it iterates over the generators given by the ``-G`` command line option, -# or if no such option was specified, over the list of generators given by -# the CPACK_GENERATOR variable set in the CPackConfig.cmake input file. -# * foreach generator, it then -# -# - sets CPACK_GENERATOR to the one currently being iterated -# - includes the CPACK_PROJECT_CONFIG_FILE -# - produces the package for that generator -# -# This is the key: For each generator listed in CPACK_GENERATOR in -# CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR internally to -# *the one currently being used* and then include the -# CPACK_PROJECT_CONFIG_FILE. -# -# Before including this CPack module in your CMakeLists.txt file, there -# are a variety of variables that can be set to customize the resulting -# installers. The most commonly-used variables are: -# -# .. variable:: CPACK_PACKAGE_NAME -# -# The name of the package (or application). If not specified, defaults to -# the project name. -# -# .. variable:: CPACK_PACKAGE_VENDOR -# -# The name of the package vendor. (e.g., "Kitware"). Default is "Humanity". -# -# .. variable:: CPACK_PACKAGE_DIRECTORY -# -# The directory in which CPack is doing its packaging. If it is not set -# then this will default (internally) to the build dir. This variable may -# be defined in CPack config file or from the cpack command line option -# "-B". If set the command line option override the value found in the -# config file. -# -# .. variable:: CPACK_PACKAGE_VERSION_MAJOR -# -# Package major version. This variable will always be set, but its default -# value depends on whether or not version details were given to the -# :command:`project` command in the top level CMakeLists.txt file. If version -# details were given, the default value will be -# :variable:`CMAKE_PROJECT_VERSION_MAJOR`. If no version details were given, -# a default version of 0.1.1 will be assumed, leading to -# ``CPACK_PACKAGE_VERSION_MAJOR`` having a default value of 0. -# -# .. variable:: CPACK_PACKAGE_VERSION_MINOR -# -# Package minor version. The default value is determined based on whether or -# not version details were given to the :command:`project` command in the top -# level CMakeLists.txt file. If version details were given, the default -# value will be :variable:`CMAKE_PROJECT_VERSION_MINOR`, but if no minor -# version component was specified then ``CPACK_PACKAGE_VERSION_MINOR`` will be -# left unset. If no project version was given at all, a default version of -# 0.1.1 will be assumed, leading to ``CPACK_PACKAGE_VERSION_MINOR`` having a -# default value of 1. -# -# .. variable:: CPACK_PACKAGE_VERSION_PATCH -# -# Package patch version. The default value is determined based on whether or -# not version details were given to the :command:`project` command in the top -# level CMakeLists.txt file. If version details were given, the default -# value will be :variable:`CMAKE_PROJECT_VERSION_PATCH`, but if no patch -# version component was specified then ``CPACK_PACKAGE_VERSION_PATCH`` will be -# left unset. If no project version was given at all, a default version of -# 0.1.1 will be assumed, leading to ``CPACK_PACKAGE_VERSION_PATCH`` having a -# default value of 1. -# -# .. variable:: CPACK_PACKAGE_DESCRIPTION_FILE -# -# A text file used to describe the project. Used, for example, the -# introduction screen of a CPack-generated Windows installer to describe -# the project. -# -# .. variable:: CPACK_PACKAGE_DESCRIPTION_SUMMARY -# -# Short description of the project (only a few words). Default value is:: -# -# ${CMAKE_PROJECT_DESCRIPTION} -# -# if DESCRIPTION has given to the project() call or -# CMake generated string with PROJECT_NAME otherwise. -# -# .. variable:: CPACK_PACKAGE_HOMEPAGE_URL -# -# Project homepage URL. Default value is:: -# -# ${CMAKE_PROJECT_HOMEPAGE_URL} -# -# if HOMEPAGE_URL has given to the project(). -# -# .. variable:: CPACK_PACKAGE_FILE_NAME -# -# The name of the package file to generate, not including the -# extension. For example, cmake-2.6.1-Linux-i686. The default value is:: -# -# ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}. -# -# .. variable:: CPACK_PACKAGE_INSTALL_DIRECTORY -# -# Installation directory on the target system. This may be used by some -# CPack generators like NSIS to create an installation directory e.g., -# "CMake 2.5" below the installation prefix. All installed element will be -# put inside this directory. -# -# .. variable:: CPACK_PACKAGE_ICON -# -# A branding image that will be displayed inside the installer (used by GUI -# installers). -# -# .. variable:: CPACK_PACKAGE_CHECKSUM -# -# An algorithm that will be used to generate additional file with checksum -# of the package. Output file name will be:: -# -# ${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_CHECKSUM} -# -# Supported algorithms are those listed by the -# :ref:`string(\<HASH\>) <Supported Hash Algorithms>` -# command. -# -# .. variable:: CPACK_PROJECT_CONFIG_FILE -# -# CPack-time project CPack configuration file. This file included at cpack -# time, once per generator after CPack has set CPACK_GENERATOR to the -# actual generator being used. It allows per-generator setting of CPACK_* -# variables at cpack time. -# -# .. variable:: CPACK_RESOURCE_FILE_LICENSE -# -# License to be embedded in the installer. It will typically be displayed -# to the user by the produced installer (often with an explicit "Accept" -# button, for graphical installers) prior to installation. This license -# file is NOT added to installed file but is used by some CPack generators -# like NSIS. If you want to install a license file (may be the same as this -# one) along with your project you must add an appropriate CMake INSTALL -# command in your CMakeLists.txt. -# -# .. variable:: CPACK_RESOURCE_FILE_README -# -# ReadMe file to be embedded in the installer. It typically describes in -# some detail the purpose of the project during the installation. Not all -# CPack generators uses this file. -# -# .. variable:: CPACK_RESOURCE_FILE_WELCOME -# -# Welcome file to be embedded in the installer. It welcomes users to this -# installer. Typically used in the graphical installers on Windows and Mac -# OS X. -# -# .. variable:: CPACK_MONOLITHIC_INSTALL -# -# Disables the component-based installation mechanism. When set the -# component specification is ignored and all installed items are put in a -# single "MONOLITHIC" package. Some CPack generators do monolithic -# packaging by default and may be asked to do component packaging by -# setting CPACK_<GENNAME>_COMPONENT_INSTALL to 1/TRUE. -# -# .. variable:: CPACK_GENERATOR -# -# List of CPack generators to use. If not specified, CPack will create a -# set of options CPACK_BINARY_<GENNAME> (e.g., CPACK_BINARY_NSIS) allowing -# the user to enable/disable individual generators. If the ``-G`` option -# is given on the :manual:`cpack <cpack(1)>` command line, it will override -# this variable and any CPACK_BINARY_<GENNAME> options. -# -# .. variable:: CPACK_OUTPUT_CONFIG_FILE -# -# The name of the CPack binary configuration file. This file is the CPack -# configuration generated by the CPack module for binary -# installers. Defaults to CPackConfig.cmake. -# -# .. variable:: CPACK_PACKAGE_EXECUTABLES -# -# Lists each of the executables and associated text label to be used to -# create Start Menu shortcuts. For example, setting this to the list -# ccmake;CMake will create a shortcut named "CMake" that will execute the -# installed executable ccmake. Not all CPack generators use it (at least -# NSIS, WIX and OSXX11 do). -# -# .. variable:: CPACK_STRIP_FILES -# -# List of files to be stripped. Starting with CMake 2.6.0 CPACK_STRIP_FILES -# will be a boolean variable which enables stripping of all files (a list -# of files evaluates to TRUE in CMake, so this change is compatible). -# -# .. variable:: CPACK_VERBATIM_VARIABLES -# -# If set to TRUE, values of variables prefixed with CPACK_ will be escaped -# before being written to the configuration files, so that the cpack program -# receives them exactly as they were specified. If not, characters like quotes -# and backslashes can cause parsing errors or alter the value received by the -# cpack program. Defaults to FALSE for backwards compatibility. -# -# * Mandatory : NO -# * Default : FALSE -# -# The following CPack variables are specific to source packages, and -# will not affect binary packages: -# -# .. variable:: CPACK_SOURCE_PACKAGE_FILE_NAME -# -# The name of the source package. For example cmake-2.6.1. -# -# .. variable:: CPACK_SOURCE_STRIP_FILES -# -# List of files in the source tree that will be stripped. Starting with -# CMake 2.6.0 CPACK_SOURCE_STRIP_FILES will be a boolean variable which -# enables stripping of all files (a list of files evaluates to TRUE in -# CMake, so this change is compatible). -# -# .. variable:: CPACK_SOURCE_GENERATOR -# -# List of generators used for the source packages. As with CPACK_GENERATOR, -# if this is not specified then CPack will create a set of options (e.g., -# CPACK_SOURCE_ZIP) allowing users to select which packages will be -# generated. -# -# .. variable:: CPACK_SOURCE_OUTPUT_CONFIG_FILE -# -# The name of the CPack source configuration file. This file is the CPack -# configuration generated by the CPack module for source -# installers. Defaults to CPackSourceConfig.cmake. -# -# .. variable:: CPACK_SOURCE_IGNORE_FILES -# -# Pattern of files in the source tree that won't be packaged when building -# a source package. This is a list of regular expression patterns (that -# must be properly escaped), e.g., -# /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.* -# -# The following variables are for advanced uses of CPack: -# -# .. variable:: CPACK_CMAKE_GENERATOR -# -# What CMake generator should be used if the project is CMake -# project. Defaults to the value of CMAKE_GENERATOR few users will want to -# change this setting. -# -# .. variable:: CPACK_INSTALL_CMAKE_PROJECTS -# -# List of four values that specify what project to install. The four values -# are: Build directory, Project Name, Project Component, Directory. If -# omitted, CPack will build an installer that installs everything. -# -# .. variable:: CPACK_SYSTEM_NAME -# -# System name, defaults to the value of ${CMAKE_SYSTEM_NAME}, except on -# Windows where it will be "win32" or "win64". -# -# .. variable:: CPACK_PACKAGE_VERSION -# -# Package full version, used internally. By default, this is built from -# CPACK_PACKAGE_VERSION_MAJOR, CPACK_PACKAGE_VERSION_MINOR, and -# CPACK_PACKAGE_VERSION_PATCH. -# -# .. variable:: CPACK_TOPLEVEL_TAG -# -# Directory for the installed files. -# -# .. variable:: CPACK_INSTALL_COMMANDS -# -# Extra commands to install components. -# -# .. variable:: CPACK_INSTALLED_DIRECTORIES -# -# Extra directories to install. -# -# .. variable:: CPACK_PACKAGE_INSTALL_REGISTRY_KEY -# -# Registry key used when installing this project. This is only used by -# installer for Windows. The default value is based on the installation -# directory. -# -# .. variable:: CPACK_CREATE_DESKTOP_LINKS -# -# List of desktop links to create. -# Each desktop link requires a corresponding start menu shortcut -# as created by :variable:`CPACK_PACKAGE_EXECUTABLES`. +#[=======================================================================[.rst: +CPack +----- + +Build binary and source package installers. + +Variables common to all CPack generators +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The CPack module generates binary and source installers in a variety of +formats using the cpack program. Inclusion of the CPack module adds +two new build targets, ``package`` and ``package_source``, which build +the binary and source installers respectively. The generated binary +installers contain everything installed via CMake's :command:`install` +command (and the deprecated :command:`install_files`, +:command:`install_programs` and :command:`install_targets` commands). + +For certain kinds of binary installers (including the graphical +installers on Mac OS X and Windows), CPack generates installers that +allow users to select individual application components to install. +See :module:`CPackComponent` module for further details. + +The :variable:`CPACK_GENERATOR` variable has different meanings in different +contexts. In a ``CMakeLists.txt`` file, :variable:`CPACK_GENERATOR` is a +*list of generators*: and when :manual:`cpack <cpack(1)>` is run with no other +arguments, it will iterate over that list and produce one package for each +generator. In a :variable:`CPACK_PROJECT_CONFIG_FILE`, +:variable:`CPACK_GENERATOR` is a *string naming a single generator*. If you +need per-cpack-generator logic to control *other* cpack settings, then you +need a :variable:`CPACK_PROJECT_CONFIG_FILE`. + +The CMake source tree itself contains a :variable:`CPACK_PROJECT_CONFIG_FILE`. +See the top level file ``CMakeCPackOptions.cmake.in`` for an example. + +If set, the :variable:`CPACK_PROJECT_CONFIG_FILE` is included automatically +on a per-generator basis. It only need contain overrides. + +Here's how it works: + +* :manual:`cpack <cpack(1)>` runs +* it includes ``CPackConfig.cmake`` +* it iterates over the generators given by the ``-G`` command line option, + or if no such option was specified, over the list of generators given by + the :variable:`CPACK_GENERATOR` variable set in the ``CPackConfig.cmake`` + input file. +* foreach generator, it then + + - sets :variable:`CPACK_GENERATOR` to the one currently being iterated + - includes the :variable:`CPACK_PROJECT_CONFIG_FILE` + - produces the package for that generator + +This is the key: For each generator listed in :variable:`CPACK_GENERATOR` in +``CPackConfig.cmake``, cpack will *reset* :variable:`CPACK_GENERATOR` +internally to *the one currently being used* and then include the +:variable:`CPACK_PROJECT_CONFIG_FILE`. + +Before including this CPack module in your ``CMakeLists.txt`` file, there +are a variety of variables that can be set to customize the resulting +installers. The most commonly-used variables are: + +.. variable:: CPACK_PACKAGE_NAME + + The name of the package (or application). If not specified, it defaults to + the project name. + +.. variable:: CPACK_PACKAGE_VENDOR + + The name of the package vendor. (e.g., "Kitware"). The default is "Humanity". + +.. variable:: CPACK_PACKAGE_DIRECTORY + + The directory in which CPack is doing its packaging. If it is not set + then this will default (internally) to the build dir. This variable may + be defined in a CPack config file or from the :manual:`cpack <cpack(1)>` + command line option ``-B``. If set, the command line option overrides the + value found in the config file. + +.. variable:: CPACK_PACKAGE_VERSION_MAJOR + + Package major version. This variable will always be set, but its default + value depends on whether or not version details were given to the + :command:`project` command in the top level CMakeLists.txt file. If version + details were given, the default value will be + :variable:`CMAKE_PROJECT_VERSION_MAJOR`. If no version details were given, + a default version of 0.1.1 will be assumed, leading to + ``CPACK_PACKAGE_VERSION_MAJOR`` having a default value of 0. + +.. variable:: CPACK_PACKAGE_VERSION_MINOR + + Package minor version. The default value is determined based on whether or + not version details were given to the :command:`project` command in the top + level CMakeLists.txt file. If version details were given, the default + value will be :variable:`CMAKE_PROJECT_VERSION_MINOR`, but if no minor + version component was specified then ``CPACK_PACKAGE_VERSION_MINOR`` will be + left unset. If no project version was given at all, a default version of + 0.1.1 will be assumed, leading to ``CPACK_PACKAGE_VERSION_MINOR`` having a + default value of 1. + +.. variable:: CPACK_PACKAGE_VERSION_PATCH + + Package patch version. The default value is determined based on whether or + not version details were given to the :command:`project` command in the top + level CMakeLists.txt file. If version details were given, the default + value will be :variable:`CMAKE_PROJECT_VERSION_PATCH`, but if no patch + version component was specified then ``CPACK_PACKAGE_VERSION_PATCH`` will be + left unset. If no project version was given at all, a default version of + 0.1.1 will be assumed, leading to ``CPACK_PACKAGE_VERSION_PATCH`` having a + default value of 1. + +.. variable:: CPACK_PACKAGE_DESCRIPTION + + A description of the project, used in places such as the introduction + screen of CPack-generated Windows installers. If not set, the value of + this variable is populated from the file named by + :variable:`CPACK_PACKAGE_DESCRIPTION_FILE`. + +.. variable:: CPACK_PACKAGE_DESCRIPTION_FILE + + A text file used to describe the project when + :variable:`CPACK_PACKAGE_DESCRIPTION` is not explicitly set. The default + value for ``CPACK_PACKAGE_DESCRIPTION_FILE`` points to a built-in template + file ``Templates/CPack.GenericDescription.txt``. + +.. variable:: CPACK_PACKAGE_DESCRIPTION_SUMMARY + + Short description of the project (only a few words). If the + :variable:`CMAKE_PROJECT_DESCRIPTION` variable is set, it is used as the + default value, otherwise the default will be a string generated by CMake + based on :variable:`CMAKE_PROJECT_NAME`. + +.. variable:: CPACK_PACKAGE_HOMEPAGE_URL + + Project homepage URL. The default value is taken from the + :variable:`CMAKE_PROJECT_HOMEPAGE_URL` variable, which is set by the top + level :command:`project` command, or else the default will be empty if no + URL was provided to :command:`project`. + +.. variable:: CPACK_PACKAGE_FILE_NAME + + The name of the package file to generate, not including the + extension. For example, ``cmake-2.6.1-Linux-i686``. The default value + is:: + + ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME} + +.. variable:: CPACK_PACKAGE_INSTALL_DIRECTORY + + Installation directory on the target system. This may be used by some + CPack generators like NSIS to create an installation directory e.g., + "CMake 2.5" below the installation prefix. All installed elements will be + put inside this directory. + +.. variable:: CPACK_PACKAGE_ICON + + A branding image that will be displayed inside the installer (used by GUI + installers). + +.. variable:: CPACK_PACKAGE_CHECKSUM + + An algorithm that will be used to generate an additional file with the + checksum of the package. The output file name will be:: + + ${CPACK_PACKAGE_FILE_NAME}.${CPACK_PACKAGE_CHECKSUM} + + Supported algorithms are those listed by the + :ref:`string(\<HASH\>) <Supported Hash Algorithms>` command. + +.. variable:: CPACK_PROJECT_CONFIG_FILE + + CPack-time project CPack configuration file. This file is included at cpack + time, once per generator after CPack has set :variable:`CPACK_GENERATOR` + to the actual generator being used. It allows per-generator setting of + ``CPACK_*`` variables at cpack time. + +.. variable:: CPACK_RESOURCE_FILE_LICENSE + + License to be embedded in the installer. It will typically be displayed + to the user by the produced installer (often with an explicit "Accept" + button, for graphical installers) prior to installation. This license + file is NOT added to the installed files but is used by some CPack generators + like NSIS. If you want to install a license file (may be the same as this + one) along with your project, you must add an appropriate CMake + :command:`install` command in your ``CMakeLists.txt``. + +.. variable:: CPACK_RESOURCE_FILE_README + + ReadMe file to be embedded in the installer. It typically describes in + some detail the purpose of the project during the installation. Not all + CPack generators use this file. + +.. variable:: CPACK_RESOURCE_FILE_WELCOME + + Welcome file to be embedded in the installer. It welcomes users to this + installer. Typically used in the graphical installers on Windows and Mac + OS X. + +.. variable:: CPACK_MONOLITHIC_INSTALL + + Disables the component-based installation mechanism. When set, the + component specification is ignored and all installed items are put in a + single "MONOLITHIC" package. Some CPack generators do monolithic + packaging by default and may be asked to do component packaging by + setting ``CPACK_<GENNAME>_COMPONENT_INSTALL`` to ``TRUE``. + +.. variable:: CPACK_GENERATOR + + List of CPack generators to use. If not specified, CPack will create a + set of options following the naming pattern + :variable:`CPACK_BINARY_<GENNAME>` (e.g. ``CPACK_BINARY_NSIS``) allowing + the user to enable/disable individual generators. If the ``-G`` option is + given on the :manual:`cpack <cpack(1)>` command line, it will override this + variable and any ``CPACK_BINARY_<GENNAME>`` options. + +.. variable:: CPACK_OUTPUT_CONFIG_FILE + + The name of the CPack binary configuration file. This file is the CPack + configuration generated by the CPack module for binary installers. + Defaults to ``CPackConfig.cmake``. + +.. variable:: CPACK_PACKAGE_EXECUTABLES + + Lists each of the executables and associated text label to be used to + create Start Menu shortcuts. For example, setting this to the list + ``ccmake;CMake`` will create a shortcut named "CMake" that will execute the + installed executable ``ccmake``. Not all CPack generators use it (at least + NSIS, WIX and OSXX11 do). + +.. variable:: CPACK_STRIP_FILES + + List of files to be stripped. Starting with CMake 2.6.0, + ``CPACK_STRIP_FILES`` will be a boolean variable which enables + stripping of all files (a list of files evaluates to ``TRUE`` in CMake, + so this change is compatible). + +.. variable:: CPACK_VERBATIM_VARIABLES + + If set to ``TRUE``, values of variables prefixed with ``CPACK_`` will be + escaped before being written to the configuration files, so that the cpack + program receives them exactly as they were specified. If not, characters + like quotes and backslashes can cause parsing errors or alter the value + received by the cpack program. Defaults to ``FALSE`` for backwards + compatibility. + +The following CPack variables are specific to source packages, and +will not affect binary packages: + +.. variable:: CPACK_SOURCE_PACKAGE_FILE_NAME + + The name of the source package. For example ``cmake-2.6.1``. + +.. variable:: CPACK_SOURCE_STRIP_FILES + + List of files in the source tree that will be stripped. Starting with + CMake 2.6.0, ``CPACK_SOURCE_STRIP_FILES`` will be a boolean + variable which enables stripping of all files (a list of files evaluates + to ``TRUE`` in CMake, so this change is compatible). + +.. variable:: CPACK_SOURCE_GENERATOR + + List of generators used for the source packages. As with + :variable:`CPACK_GENERATOR`, if this is not specified then CPack will + create a set of options (e.g. ``CPACK_SOURCE_ZIP``) allowing + users to select which packages will be generated. + +.. variable:: CPACK_SOURCE_OUTPUT_CONFIG_FILE + + The name of the CPack source configuration file. This file is the CPack + configuration generated by the CPack module for source installers. + Defaults to ``CPackSourceConfig.cmake``. + +.. variable:: CPACK_SOURCE_IGNORE_FILES + + Pattern of files in the source tree that won't be packaged when building + a source package. This is a list of regular expression patterns (that + must be properly escaped), e.g., + ``/CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.*`` + +The following variables are for advanced uses of CPack: + +.. variable:: CPACK_CMAKE_GENERATOR + + What CMake generator should be used if the project is a CMake + project. Defaults to the value of :variable:`CMAKE_GENERATOR`. Few users + will want to change this setting. + +.. variable:: CPACK_INSTALL_CMAKE_PROJECTS + + List of four values that specify what project to install. The four values + are: Build directory, Project Name, Project Component, Directory. If + omitted, CPack will build an installer that installs everything. + +.. variable:: CPACK_SYSTEM_NAME + + System name, defaults to the value of :variable:`CMAKE_SYSTEM_NAME`, + except on Windows where it will be ``win32`` or ``win64``. + +.. variable:: CPACK_PACKAGE_VERSION + + Package full version, used internally. By default, this is built from + :variable:`CPACK_PACKAGE_VERSION_MAJOR`, + :variable:`CPACK_PACKAGE_VERSION_MINOR`, and + :variable:`CPACK_PACKAGE_VERSION_PATCH`. + +.. variable:: CPACK_TOPLEVEL_TAG + + Directory for the installed files. + +.. variable:: CPACK_INSTALL_COMMANDS + + Extra commands to install components. + +.. variable:: CPACK_INSTALLED_DIRECTORIES + + Extra directories to install. + +.. variable:: CPACK_PACKAGE_INSTALL_REGISTRY_KEY + + Registry key used when installing this project. This is only used by + installers for Windows. The default value is based on the installation + directory. + +.. variable:: CPACK_CREATE_DESKTOP_LINKS + + List of desktop links to create. Each desktop link requires a + corresponding start menu shortcut as created by + :variable:`CPACK_PACKAGE_EXECUTABLES`. + +.. variable:: CPACK_BINARY_<GENNAME> + + CPack generated options for binary generators. The ``CPack.cmake`` module + generates (when :variable:`CPACK_GENERATOR` is not set) a set of CMake + options (see CMake :command:`option` command) which may then be used to + select the CPack generator(s) to be used when building the ``package`` + target or when running :manual:`cpack <cpack(1)>` without the ``-G`` option. + +#]=======================================================================] # Define this var in order to avoid (or warn) concerning multiple inclusion if(CPack_CMake_INCLUDED) @@ -501,16 +517,9 @@ macro(cpack_optional_append _list _cond _item) endif() endmacro() -#.rst: -# .. variable:: CPACK_BINARY_<GENNAME> -# -# CPack generated options for binary generators. The CPack.cmake module -# generates (when CPACK_GENERATOR is not set) a set of CMake options (see -# CMake option command) which may then be used to select the CPack -# generator(s) to be used when launching the package target. -# -# Provide options to choose generators we might check here if the required -# tools for the generates exist and set the defaults according to the results +# Provide options to choose generators we might check here if the required +# tools for the generators exist and set the defaults according to the +# results. if(NOT CPACK_GENERATOR) if(UNIX) if(CYGWIN) @@ -535,10 +544,11 @@ if(NOT CPACK_GENERATOR) option(CPACK_BINARY_TXZ "Enable to build TXZ packages" OFF) endif() else() - option(CPACK_BINARY_7Z "Enable to build 7-Zip packages" OFF) - option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON) - option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF) - option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) + option(CPACK_BINARY_7Z "Enable to build 7-Zip packages" OFF) + option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON) + option(CPACK_BINARY_NUGET "Enable to build NuGet packages" OFF) + option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF) + option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) endif() option(CPACK_BINARY_IFW "Enable to build IFW packages" OFF) @@ -550,6 +560,7 @@ if(NOT CPACK_GENERATOR) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_FREEBSD FREEBSD) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_IFW IFW) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NUGET NuGet) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PRODUCTBUILD productbuild) @@ -602,6 +613,7 @@ mark_as_advanced( CPACK_BINARY_FREEBSD CPACK_BINARY_IFW CPACK_BINARY_NSIS + CPACK_BINARY_NUGET CPACK_BINARY_OSXX11 CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_PRODUCTBUILD diff --git a/Modules/CPackNuGet.cmake b/Modules/CPackNuGet.cmake new file mode 100644 index 0000000..29d4296 --- /dev/null +++ b/Modules/CPackNuGet.cmake @@ -0,0 +1,556 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +CPackNuGet +---------- + +When build a NuGet pacakge there is no direct way to control an output +filename due a lack of the corresponding CLI option of NuGet, so there +is no ``CPACK_NUGET_PACKAGE_FILENAME`` variable. To form the output filename +NuGet uses the package name and the version according to its built-in rules. + +Also, be aware that including a top level directory +(``CPACK_INCLUDE_TOPLEVEL_DIRECTORY``) is ignored by this generator. + + +Variables specific to CPack NuGet generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +CPackNuGet may be used to create NuGet packages using :module:`CPack`. +CPackNuGet is a :module:`CPack` generator thus it uses the ``CPACK_XXX`` +variables used by :module:`CPack`. + +CPackNuGet has specific features which are controlled by the specifics +:code:`CPACK_NUGET_XXX` variables. In the "one per group" mode +(see :variable:`CPACK_COMPONENTS_GROUPING`), ``<compName>`` placeholder +in the variables below would contain a group name (uppercased and turned into +a "C" identifier). + +List of CPackNuGet specific variables: + +.. variable:: CPACK_NUGET_COMPONENT_INSTALL + + Enable component packaging for CPackNuGet + + * Mandatory : NO + * Default : OFF + +.. variable:: CPACK_NUGET_PACKAGE_NAME + CPACK_NUGET_<compName>_PACKAGE_NAME + + The NUGET package name. + + * Mandatory : YES + * Default : :variable:`CPACK_PACKAGE_NAME` + +.. variable:: CPACK_NUGET_PACKAGE_VERSION + CPACK_NUGET_<compName>_PACKAGE_VERSION + + The NuGet package version. + + * Mandatory : YES + * Default : :variable:`CPACK_PACKAGE_VERSION` + +.. variable:: CPACK_NUGET_PACKAGE_DESCRIPTION + CPACK_NUGET_<compName>_PACKAGE_DESCRIPTION + + A long description of the package for UI display. + + * Mandatory : YES + * Default : + - :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION`, + - ``CPACK_COMPONENT_GROUP_<groupName>_DESCRIPTION``, + - :variable:`CPACK_PACKAGE_DESCRIPTION` + + .. variable:: CPACK_NUGET_PACKAGE_AUTHORS + CPACK_NUGET_<compName>_PACKAGE_AUTHORS + + A comma-separated list of packages authors, matching the profile names + on nuget.org_. These are displayed in the NuGet Gallery on + nuget.org_ and are used to cross-reference packages by the same + authors. + + * Mandatory : YES + * Default : :variable:`CPACK_PACKAGE_VENDOR` + +.. variable:: CPACK_NUGET_PACKAGE_TITLE + CPACK_NUGET_<compName>_PACKAGE_TITLE + + A human-friendly title of the package, typically used in UI displays + as on nuget.org_ and the Package Manager in Visual Studio. If not + specified, the package ID is used. + + * Mandatory : NO + * Default : + - :variable:`CPACK_COMPONENT_<compName>_DISPLAY_NAME`, + - ``CPACK_COMPONENT_GROUP_<groupName>_DISPLAY_NAME`` + +.. variable:: CPACK_NUGET_PACKAGE_OWNERS + CPACK_NUGET_<compName>_PACKAGE_OWNERS + + A comma-separated list of the package creators using profile names + on nuget.org_. This is often the same list as in authors, + and is ignored when uploading the package to nuget.org_. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_NUGET_PACKAGE_HOMEPAGE_URL + CPACK_NUGET_<compName>_PACKAGE_HOMEPAGE_URL + + A URL for the package's home page, often shown in UI displays as well + as nuget.org_. + + * Mandatory : NO + * Default : :variable:`CPACK_PACKAGE_HOMEPAGE_URL` + +.. variable:: CPACK_NUGET_PACKAGE_LICENSEURL + CPACK_NUGET_<compName>_PACKAGE_LICENSEURL + + A URL for the package's license, often shown in UI displays as well + as nuget.org_. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_NUGET_PACKAGE_ICONURL + CPACK_NUGET_<compName>_PACKAGE_ICONURL + + A URL for a 64x64 image with transparency background to use as the + icon for the package in UI display. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_NUGET_PACKAGE_DESCRIPTION_SUMMARY + CPACK_NUGET_<compName>_PACKAGE_DESCRIPTION_SUMMARY + + A short description of the package for UI display. If omitted, a + truncated version of description is used. + + * Mandatory : NO + * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` + +.. variable:: CPACK_NUGET_PACKAGE_RELEASE_NOTES + CPACK_NUGET_<compName>_PACKAGE_RELEASE_NOTES + + A description of the changes made in this release of the package, + often used in UI like the Updates tab of the Visual Studio Package + Manager in place of the package description. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_NUGET_PACKAGE_COPYRIGHT + CPACK_NUGET_<compName>_PACKAGE_COPYRIGHT + + Copyright details for the package. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_NUGET_PACKAGE_TAGS + CPACK_NUGET_<compName>_PACKAGE_TAGS + + A space-delimited list of tags and keywords that describe the + package and aid discoverability of packages through search and + filtering. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_NUGET_PACKAGE_DEPENDENCIES + CPACK_NUGET_<compName>_PACKAGE_DEPENDENCIES + + A list of package dependencies. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_NUGET_PACKAGE_DEPENDENCIES_<dependency>_VERSION + CPACK_NUGET_<compName>_PACKAGE_DEPENDENCIES_<dependency>_VERSION + + A `version specification`_ for the particular dependency, where + ``<dependency>`` is an item of the dependency list (see above) + transformed with ``MAKE_C_IDENTIFIER`` function of :command:`string` + command. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_NUGET_PACKAGE_DEBUG + + Enable debug messages while executing ``CPackNuGet.cmake``. + + * Mandatory : NO + * Default : OFF + + +.. _nuget.org: http://nuget.org +.. _version specification: https://docs.microsoft.com/en-us/nuget/reference/package-versioning#version-ranges-and-wildcards + +.. NuGet spec docs https://docs.microsoft.com/en-us/nuget/reference/nuspec + +#]=======================================================================] + +# Author: Alex Turbov + +if(CMAKE_BINARY_DIR) + message(FATAL_ERROR "CPackNuGet.cmake may only be used by CPack internally.") +endif() + +function(_cpack_nuget_debug) + if(CPACK_NUGET_PACKAGE_DEBUG) + message("CPackNuGet:Debug: " ${ARGN}) + endif() +endfunction() + +function(_cpack_nuget_debug_var NAME) + if(CPACK_NUGET_PACKAGE_DEBUG) + message("CPackNuGet:Debug: ${NAME}=`${${NAME}}`") + endif() +endfunction() + +function(_cpack_nuget_variable_fallback OUTPUT_VAR_NAME NUGET_VAR_NAME) + if(ARGN) + list(JOIN ARGN "`, `" _va_args) + set(_va_args ", ARGN: `${_va_args}`") + endif() + _cpack_nuget_debug( + "_cpack_nuget_variable_fallback: " + "OUTPUT_VAR_NAME=`${OUTPUT_VAR_NAME}`, " + "NUGET_VAR_NAME=`${NUGET_VAR_NAME}`" + "${_va_args}" + ) + + set(_options USE_CDATA) + set(_one_value_args LIST_GLUE) + set(_multi_value_args FALLBACK_VARS) + cmake_parse_arguments(PARSE_ARGV 0 _args "${_options}" "${_one_value_args}" "${_multi_value_args}") + + if(CPACK_NUGET_PACKAGE_COMPONENT) + string( + TOUPPER "${CPACK_NUGET_PACKAGE_COMPONENT}" + CPACK_NUGET_PACKAGE_COMPONENT_UPPER + ) + endif() + + if(CPACK_NUGET_PACKAGE_COMPONENT + AND CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_PACKAGE_${NUGET_VAR_NAME} + ) + set( + _result + "${CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_PACKAGE_${NUGET_VAR_NAME}}" + ) + _cpack_nuget_debug( + " CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT}_PACKAGE_${NUGET_VAR_NAME}: " + "OUTPUT_VAR_NAME->${OUTPUT_VAR_NAME}=`${_result}`" + ) + + elseif(CPACK_NUGET_PACKAGE_COMPONENT_UPPER + AND CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT_UPPER}_PACKAGE_${NUGET_VAR_NAME} + ) + set( + _result + "${CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT_UPPER}_PACKAGE_${NUGET_VAR_NAME}}" + ) + _cpack_nuget_debug( + " CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT_UPPER}_PACKAGE_${NUGET_VAR_NAME}: " + "OUTPUT_VAR_NAME->${OUTPUT_VAR_NAME}=`${_result}`" + ) + + elseif(CPACK_NUGET_PACKAGE_${NUGET_VAR_NAME}) + set(_result "${CPACK_NUGET_PACKAGE_${NUGET_VAR_NAME}}") + _cpack_nuget_debug( + " CPACK_NUGET_PACKAGE_${NUGET_VAR_NAME}: " + "OUTPUT_VAR_NAME->${OUTPUT_VAR_NAME}=`${_result}`" + ) + + else() + foreach(_var IN LISTS _args_FALLBACK_VARS) + _cpack_nuget_debug(" Fallback: ${_var} ...") + if(${_var}) + _cpack_nuget_debug(" ${_var}=`${${_var}}`") + set(_result "${${_var}}") + _cpack_nuget_debug( + " ${_var}: OUTPUT_VAR_NAME->${OUTPUT_VAR_NAME}=`${_result}`" + ) + break() + endif() + endforeach() + endif() + + if(_result) + if(_args_USE_CDATA) + set(_value_before "<![CDATA[") + set(_value_after "]]>") + endif() + + list(LENGTH _result _result_len) + if(_result_len GREATER 1 AND _args_LIST_GLUE) + list(JOIN _result "${_args_LIST_GLUE}" _result) + endif() + + set(${OUTPUT_VAR_NAME} "${_value_before}${_result}${_value_after}" PARENT_SCOPE) + endif() + +endfunction() + +function(_cpack_nuget_variable_fallback_and_wrap_into_element ELEMENT NUGET_VAR_NAME) + set(_options) + set(_one_value_args) + set(_multi_value_args FALLBACK_VARS) + cmake_parse_arguments(PARSE_ARGV 0 _args "${_options}" "${_one_value_args}" "${_multi_value_args}") + + _cpack_nuget_variable_fallback(_value ${NUGET_VAR_NAME} ${ARGN} USE_CDATA) + + if(_value) + string(TOUPPER "${ELEMENT}" _ELEMENT_UP) + set( + _CPACK_NUGET_${_ELEMENT_UP}_TAG + "<${ELEMENT}>${_value}</${ELEMENT}>" + PARENT_SCOPE + ) + endif() +endfunction() + +# Print some debug info +_cpack_nuget_debug("---[CPack NuGet Input Variables]---") +_cpack_nuget_debug_var(CPACK_PACKAGE_NAME) +_cpack_nuget_debug_var(CPACK_PACKAGE_VERSION) +_cpack_nuget_debug_var(CPACK_TOPLEVEL_TAG) +_cpack_nuget_debug_var(CPACK_TOPLEVEL_DIRECTORY) +_cpack_nuget_debug_var(CPACK_TEMPORARY_DIRECTORY) +_cpack_nuget_debug_var(CPACK_NUGET_GROUPS) +if(CPACK_NUGET_GROUPS) + foreach(_group IN LISTS CPACK_NUGET_GROUPS) + string(MAKE_C_IDENTIFIER "${_group}" _group_up) + string(TOUPPER "${_group_up}" _group_up) + _cpack_nuget_debug_var(CPACK_NUGET_${_group_up}_GROUP_COMPONENTS) + endforeach() +endif() +_cpack_nuget_debug_var(CPACK_NUGET_COMPONENTS) +_cpack_nuget_debug_var(CPACK_NUGET_ALL_IN_ONE) +_cpack_nuget_debug_var(CPACK_NUGET_ORDINAL_MONOLITIC) +_cpack_nuget_debug("-----------------------------------") + +function(_cpack_nuget_render_spec) + # Make a variable w/ upper-cased component name + if(CPACK_NUGET_PACKAGE_COMPONENT) + string(TOUPPER "${CPACK_NUGET_PACKAGE_COMPONENT}" CPACK_NUGET_PACKAGE_COMPONENT_UPPER) + endif() + + # Set mandatory variables (not wrapped into XML elements) + # https://docs.microsoft.com/en-us/nuget/reference/nuspec#required-metadata-elements + if(CPACK_NUGET_PACKAGE_COMPONENT) + if(CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME) + set( + CPACK_NUGET_PACKAGE_NAME + "${CPACK_NUGET_${CPACK_NUGET_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME}" + ) + elseif(NOT CPACK_NUGET_PACKAGE_COMPONENT STREQUAL "Unspecified") + set( + CPACK_NUGET_PACKAGE_NAME + "${CPACK_PACKAGE_NAME}.${CPACK_NUGET_PACKAGE_COMPONENT}" + ) + else() + set(CPACK_NUGET_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") + endif() + elseif(NOT CPACK_NUGET_PACKAGE_NAME) + set(CPACK_NUGET_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") + endif() + + _cpack_nuget_variable_fallback( + CPACK_NUGET_PACKAGE_VERSION VERSION + FALLBACK_VARS + CPACK_PACKAGE_VERSION + ) + _cpack_nuget_variable_fallback( + CPACK_NUGET_PACKAGE_DESCRIPTION DESCRIPTION + FALLBACK_VARS + CPACK_COMPONENT_${CPACK_NUGET_PACKAGE_COMPONENT}_DESCRIPTION + CPACK_COMPONENT_${CPACK_NUGET_PACKAGE_COMPONENT_UPPER}_DESCRIPTION + CPACK_COMPONENT_GROUP_${CPACK_NUGET_PACKAGE_COMPONENT_UPPER}_DESCRIPTION + CPACK_PACKAGE_DESCRIPTION + USE_CDATA + ) + _cpack_nuget_variable_fallback( + CPACK_NUGET_PACKAGE_AUTHORS AUTHORS + FALLBACK_VARS + CPACK_PACKAGE_VENDOR + USE_CDATA + LIST_GLUE "," + ) + + # Set optional variables (wrapped into XML elements) + # https://docs.microsoft.com/en-us/nuget/reference/nuspec#optional-metadata-elements + _cpack_nuget_variable_fallback_and_wrap_into_element( + title + TITLE + FALLBACK_VARS + CPACK_COMPONENT_${CPACK_NUGET_PACKAGE_COMPONENT}_DISPLAY_NAME + CPACK_COMPONENT_${CPACK_NUGET_PACKAGE_COMPONENT_UPPER}_DISPLAY_NAME + CPACK_COMPONENT_GROUP_${CPACK_NUGET_PACKAGE_COMPONENT_UPPER}_DISPLAY_NAME + ) + _cpack_nuget_variable_fallback_and_wrap_into_element(owners OWNERS LIST_GLUE ",") + _cpack_nuget_variable_fallback_and_wrap_into_element( + projectUrl + HOMEPAGE_URL + FALLBACK_VARS + CPACK_PACKAGE_HOMEPAGE_URL + ) + _cpack_nuget_variable_fallback_and_wrap_into_element(licenseUrl LICENSEURL) + _cpack_nuget_variable_fallback_and_wrap_into_element(iconUrl ICONURL) + _cpack_nuget_variable_fallback_and_wrap_into_element( + summary DESCRIPTION_SUMMARY + FALLBACK_VARS + CPACK_PACKAGE_DESCRIPTION_SUMMARY + ) + if(CPACK_NUGET_PACKAGE_REQUIRE_LICENSE_ACCEPTANCE) + set( + _CPACK_NUGET_REQUIRELICENSEACCEPTANCE_TAG + "<requireLicenseAcceptance>true</requireLicenseAcceptance>" + ) + endif() + _cpack_nuget_variable_fallback_and_wrap_into_element(releaseNotes RELEASE_NOTES) + _cpack_nuget_variable_fallback_and_wrap_into_element(copyright COPYRIGHT) + _cpack_nuget_variable_fallback_and_wrap_into_element(tags TAGS LIST_GLUE " ") + + # Handle dependencies + _cpack_nuget_variable_fallback(_deps DEPENDENCIES) + set(_collected_deps) + foreach(_dep IN LISTS _deps) + _cpack_nuget_debug(" checking dependency `${_dep}`") + + string(MAKE_C_IDENTIFIER "${_dep}" _dep_id) + + _cpack_nuget_variable_fallback(_ver DEPENDENCIES_${_dep_id}_VERSION) + + if(NOT _ver) + string(TOUPPER "${_dep_id}" _dep_id) + _cpack_nuget_variable_fallback(_ver DEPENDENCIES_${_dep_id}_VERSION) + endif() + + if(_ver) + _cpack_nuget_debug(" got `${_dep}` dependency version ${_ver}") + list(APPEND _collected_deps "<dependency id=\"${_dep}\" version=\"${_ver}\" />") + endif() + endforeach() + + # Render deps into the variable + if(_collected_deps) + set(_CPACK_NUGET_DEPENDENCIES_TAG "<dependencies>\n") + foreach(_line IN LISTS _collected_deps) + string( + APPEND _CPACK_NUGET_DEPENDENCIES_TAG + " ${_line}\n" + ) + endforeach() + string(APPEND _CPACK_NUGET_DEPENDENCIES_TAG " </dependencies>") + endif() + + # Render the spec file + # NOTE The spec filename doesn't matter. Being included into a package, + # NuGet will name it properly. + _cpack_nuget_debug("Rendering `${CPACK_TEMPORARY_DIRECTORY}/CPack.NuGet.nuspec` file...") + configure_file( + "${CMAKE_CURRENT_LIST_DIR}/CPack.NuGet.nuspec.in" + "${CPACK_TEMPORARY_DIRECTORY}/CPack.NuGet.nuspec" + @ONLY + ) +endfunction() + +function(_cpack_nuget_make_files_tag) + set(_files) + foreach(_comp IN LISTS ARGN) + string(APPEND _files " <file src=\"${_comp}\\**\" target=\".\" />\n") + endforeach() + set(_CPACK_NUGET_FILES_TAG "<files>\n${_files} </files>" PARENT_SCOPE) +endfunction() + +find_program(NUGET_EXECUTABLE NuGet) +_cpack_nuget_debug_var(NUGET_EXECUTABLE) +if(NOT NUGET_EXECUTABLE) + message(FATAL_ERROR "NuGet executable not found") +endif() + +# Add details for debug run +if(CPACK_NUGET_PACKAGE_DEBUG) + list(APPEND CPACK_NUGET_PACK_ADDITIONAL_OPTIONS "-Verbosity" "detailed") +endif() + +# Case one: ordinal all-in-one package +if(CPACK_NUGET_ORDINAL_MONOLITIC) + # This variable `CPACK_NUGET_ALL_IN_ONE` set by C++ code: + # Meaning to pack all installed files into a single package + _cpack_nuget_debug("---[Making an ordinal monolitic package]---") + _cpack_nuget_render_spec() + execute_process( + COMMAND "${NUGET_EXECUTABLE}" pack ${CPACK_NUGET_PACK_ADDITIONAL_OPTIONS} + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + ) + +elseif(CPACK_NUGET_ALL_IN_ONE) + # This variable `CPACK_NUGET_ALL_IN_ONE` set by C++ code: + # Meaning to pack all installed components into a single package + _cpack_nuget_debug("---[Making a monolitic package from installed components]---") + + # Prepare the `files` element which include files from several components + _cpack_nuget_make_files_tag(${CPACK_NUGET_COMPONENTS}) + _cpack_nuget_render_spec() + execute_process( + COMMAND "${NUGET_EXECUTABLE}" pack ${CPACK_NUGET_PACK_ADDITIONAL_OPTIONS} + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + ) + +else() + # Is there any grouped component? + if(CPACK_NUGET_GROUPS) + _cpack_nuget_debug("---[Making grouped component(s) package(s)]---") + foreach(_group IN LISTS CPACK_NUGET_GROUPS) + _cpack_nuget_debug("Starting to make the pacakge for group `${_group}`") + string(MAKE_C_IDENTIFIER "${_group}" _group_up) + string(TOUPPER "${_group_up}" _group_up) + + # Render a spec file which includes all components in the current group + unset(_CPACK_NUGET_FILES_TAG) + _cpack_nuget_make_files_tag(${CPACK_NUGET_${_group_up}_GROUP_COMPONENTS}) + # Temporary set `CPACK_NUGET_PACKAGE_COMPONENT` to the group name + # to properly collect various per group settings + set(CPACK_NUGET_PACKAGE_COMPONENT ${_group}) + _cpack_nuget_render_spec() + unset(CPACK_NUGET_PACKAGE_COMPONENT) + execute_process( + COMMAND "${NUGET_EXECUTABLE}" pack ${CPACK_NUGET_PACK_ADDITIONAL_OPTIONS} + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + ) + endforeach() + endif() + # Is there any single component package needed? + if(CPACK_NUGET_COMPONENTS) + _cpack_nuget_debug("---[Making single-component(s) package(s)]---") + foreach(_comp IN LISTS CPACK_NUGET_COMPONENTS) + _cpack_nuget_debug("Starting to make the pacakge for component `${_comp}`") + # Render a spec file which includes only given component + unset(_CPACK_NUGET_FILES_TAG) + _cpack_nuget_make_files_tag(${_comp}) + # Temporary set `CPACK_NUGET_PACKAGE_COMPONENT` to the the current + # component name to properly collect various per group settings + set(CPACK_NUGET_PACKAGE_COMPONENT ${_comp}) + _cpack_nuget_render_spec() + unset(CPACK_NUGET_PACKAGE_COMPONENT) + execute_process( + COMMAND "${NUGET_EXECUTABLE}" pack ${CPACK_NUGET_PACK_ADDITIONAL_OPTIONS} + WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" + ) + endforeach() + endif() +endif() + +file(GLOB_RECURSE GEN_CPACK_OUTPUT_FILES "${CPACK_TEMPORARY_DIRECTORY}/*.nupkg") +if(NOT GEN_CPACK_OUTPUT_FILES) + message(FATAL_ERROR "NuGet package was not generated at `${CPACK_TEMPORARY_DIRECTORY}`!") +endif() + +_cpack_nuget_debug("Generated files: ${GEN_CPACK_OUTPUT_FILES}") diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 8d8eab3..60b3abe 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -410,17 +410,17 @@ # # .. variable:: CPACK_RPM_SPEC_INSTALL_POST # -# Deprecated - use :variable:`CPACK_RPM_POST_INSTALL_SCRIPT_FILE` instead. +# Deprecated - use :variable:`CPACK_RPM_SPEC_MORE_DEFINE` instead. # # * Mandatory : NO # * Default : - # * Deprecated: YES # -# This way of specifying post-install script is deprecated, use -# :variable:`CPACK_RPM_POST_INSTALL_SCRIPT_FILE`. -# May be used to set an RPM post-install command inside the spec file. -# For example setting it to ``/bin/true`` may be used to prevent -# rpmbuild to strip binaries. +# May be used to override the ``__spec_install_post`` section within the +# generated spec file. This affects the install step during package creation, +# not during package installation. For adding operations to be performed +# during package installation, use +# :variable:`CPACK_RPM_POST_INSTALL_SCRIPT_FILE` instead. # # .. variable:: CPACK_RPM_SPEC_MORE_DEFINE # @@ -429,7 +429,11 @@ # * Mandatory : NO # * Default : - # -# May be used to add any ``%define`` lines to the generated spec file. +# May be used to add any ``%define`` lines to the generated spec file. An +# example of its use is to prevent stripping of executables (but note that +# this may also disable other default post install processing):: +# +# set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true") # # .. variable:: CPACK_RPM_PACKAGE_DEBUG # @@ -877,9 +881,9 @@ # variable while usually using :variable:`CPACK_INSTALLED_DIRECTORIES` variable # to provide directory containing CMakeLists.txt and source files. # -# For CMake projects SRPM package would be product by executing: +# For CMake projects SRPM package would be produced by executing:: # -# ``cpack -G RPM --config ./CPackSourceConfig.cmake`` +# cpack -G RPM --config ./CPackSourceConfig.cmake # # .. note:: # @@ -892,10 +896,10 @@ # # Once the SRPM package is generated it can be used to generate binary packages # by creating a directory structure for rpm generation and executing rpmbuild -# tool: +# tool:: # -# ``mkdir -p build_dir/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}`` -# ``rpmbuild --define "_topdir <path_to_build_dir>" --rebuild <SRPM_file_name>`` +# mkdir -p build_dir/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} +# rpmbuild --define "_topdir <path_to_build_dir>" --rebuild <SRPM_file_name> # # Generated packages will be located in build_dir/RPMS directory or its sub # directories. diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 5223b1d..5ee703a 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -88,16 +88,9 @@ endif() if(BLA_PREFER_PKGCONFIG) find_package(PkgConfig) - pkg_check_modules(PKGC_BLAS IMPORTED_TARGET blas) + pkg_check_modules(PKGC_BLAS blas) if(PKGC_BLAS_FOUND) - # FIXME: We should not interpret the INTERFACE_LINK_LIBRARIES property - # because it could have generator expressions and such. This is a - # workaround for pkg_check_modules not providing a first-class way to - # get the list of libraries. - get_property(BLAS_LIBRARIES TARGET PkgConfig::PKGC_BLAS PROPERTY INTERFACE_LINK_LIBRARIES) - find_package_handle_standard_args(BLAS - REQUIRED_VARS BLAS_LIBRARIES - VERSION_VAR PKGC_BLAS_VERSION) + set(BLAS_LIBRARIES "${PKGC_BLAS_LINK_LIBRARIES}") return() endif() endif() diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index 0375b09..4d7123d 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -18,13 +18,24 @@ # # This module defines the following variables: # -# :: +# ``BZIP2_FOUND`` +# system has BZip2 +# ``BZIP2_INCLUDE_DIRS`` +# the BZip2 include directories +# ``BZIP2_LIBRARIES`` +# Link these to use BZip2 +# ``BZIP2_NEED_PREFIX`` +# this is set if the functions are prefixed with ``BZ2_`` +# ``BZIP2_VERSION_STRING`` +# the version of BZip2 found # -# BZIP2_FOUND - system has BZip2 -# BZIP2_INCLUDE_DIR - the BZip2 include directory -# BZIP2_LIBRARIES - Link these to use BZip2 -# BZIP2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_ -# BZIP2_VERSION_STRING - the version of BZip2 found (since CMake 2.8.8) +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``BZIP2_INCLUDE_DIR`` +# the BZip2 include directory set(_BZIP2_PATHS PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Bzip2;InstallPath]" @@ -53,6 +64,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 VERSION_VAR BZIP2_VERSION_STRING) if (BZIP2_FOUND) + set(BZIP2_INCLUDE_DIRS ${BZIP2_INCLUDE_DIR}) include(${CMAKE_CURRENT_LIST_DIR}/CheckSymbolExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) cmake_push_check_state() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 5b5002a..08d9762 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -585,7 +585,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_FILESYSTEM_DEPENDENCIES system) set(_Boost_IOSTREAMS_DEPENDENCIES regex) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_WAVE_DEPENDENCIES filesystem system thread) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(NOT Boost_VERSION VERSION_LESS 103600 AND Boost_VERSION VERSION_LESS 103800) @@ -593,7 +593,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_IOSTREAMS_DEPENDENCIES regex) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_WAVE_DEPENDENCIES filesystem system thread) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(NOT Boost_VERSION VERSION_LESS 103800 AND Boost_VERSION VERSION_LESS 104300) @@ -601,7 +601,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_IOSTREAMS_DEPENDENCIES regex) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_THREAD_DEPENDENCIES date_time) set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) @@ -610,7 +610,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_IOSTREAMS_DEPENDENCIES regex) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_THREAD_DEPENDENCIES date_time) set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) @@ -619,7 +619,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_IOSTREAMS_DEPENDENCIES regex) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_THREAD_DEPENDENCIES date_time) set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) @@ -628,7 +628,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_IOSTREAMS_DEPENDENCIES regex) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_THREAD_DEPENDENCIES date_time) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) @@ -638,7 +638,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_IOSTREAMS_DEPENDENCIES regex) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_THREAD_DEPENDENCIES date_time) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) @@ -648,7 +648,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_IOSTREAMS_DEPENDENCIES regex) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_THREAD_DEPENDENCIES date_time) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) @@ -659,7 +659,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_IOSTREAMS_DEPENDENCIES regex) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_THREAD_DEPENDENCIES chrono system date_time) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) @@ -671,7 +671,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_IOSTREAMS_DEPENDENCIES regex) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) @@ -684,7 +684,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) @@ -697,7 +697,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) @@ -710,7 +710,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) @@ -724,7 +724,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) @@ -738,7 +738,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) @@ -753,7 +753,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) @@ -768,7 +768,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) @@ -784,28 +784,28 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) elseif(NOT Boost_VERSION VERSION_LESS 106500 AND Boost_VERSION VERSION_LESS 106700) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_NUMPY_DEPENDENCIES python) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) else() if(NOT Boost_VERSION VERSION_LESS 106700) set(_Boost_CHRONO_DEPENDENCIES system) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index a0e4aa9..874fb89 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -557,10 +557,10 @@ else() set(c_compiler_realpath "") endif() set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC") - elseif(MSVC AND "${CMAKE_C_COMPILER}" MATCHES "clcache") - # NVCC does not think it will work if it is passed clcache.exe as the host - # compiler, which means that builds with CC=cl.exe won't work. Best to just - # feed it whatever the actual cl.exe is as the host compiler. + elseif(MSVC AND "${CMAKE_C_COMPILER}" MATCHES "clcache|sccache") + # NVCC does not think it will work if it is passed clcache.exe or sccache.exe + # as the host compiler, which means that builds with CC=cl.exe won't work. + # Best to just feed it whatever the actual cl.exe is as the host compiler. set(CUDA_HOST_COMPILER "cl.exe" CACHE FILEPATH "Host side compiler used by NVCC") else() set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" @@ -1769,7 +1769,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options add_custom_command( OUTPUT ${output_file} DEPENDS ${object_files} - COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} ${CUDA_cublas_device_LIBRARY} -o ${output_file} + COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} -o ${output_file} ${flags} COMMENT "Building NVCC intermediate link file ${output_file_relative_path}" COMMAND_EXPAND_LISTS @@ -1782,7 +1782,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options PRE_LINK COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}" COMMAND ${CMAKE_COMMAND} -E make_directory "${output_file_dir}" - COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} ${CUDA_cublas_device_LIBRARY} -o "${output_file}" + COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}" COMMAND_EXPAND_LISTS ${_verbatim} ) diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index 599d799..945ee0e 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -69,6 +69,7 @@ Functions doxygen_add_docs(targetName [filesOrDirs...] + [ALL] [WORKING_DIRECTORY dir] [COMMENT comment]) @@ -91,6 +92,8 @@ Functions the :command:`add_custom_target` command used to create the custom target internally. + If ALL is set, the target will be added to the default build target. + The contents of the generated ``Doxyfile`` can be customized by setting CMake variables before calling ``doxygen_add_docs()``. Any variable with a name of the form ``DOXYGEN_<tag>`` will have its value substituted for the @@ -788,7 +791,7 @@ function(doxygen_list_to_quoted_strings LIST_VARIABLE) endfunction() function(doxygen_add_docs targetName) - set(_options) + set(_options ALL) set(_one_value_args WORKING_DIRECTORY COMMENT) set(_multi_value_args) cmake_parse_arguments(_args @@ -1089,8 +1092,13 @@ doxygen_add_docs() for target ${targetName}") set(_target_doxyfile "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.${targetName}") configure_file("${_doxyfile_template}" "${_target_doxyfile}") + unset(_all) + if(${_args_ALL}) + set(_all ALL) + endif() + # Add the target - add_custom_target( ${targetName} VERBATIM + add_custom_target( ${targetName} ${_all} VERBATIM COMMAND ${CMAKE_COMMAND} -E make_directory ${_original_doxygen_output_dir} COMMAND "${DOXYGEN_EXECUTABLE}" "${_target_doxyfile}" WORKING_DIRECTORY "${_args_WORKING_DIRECTORY}" diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index ff8d353..4913e05 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -128,7 +128,7 @@ if (WIN32) OUTPUT_VARIABLE _JNI_VERSIONS ERROR_QUIET) if (NOT _JNI_RESULT) - string (REGEX MATCHALL "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\JavaSoft\\\\JDK\\\\[0-9\.]+" _JNI_VERSIONS "${_JNI_VERSIONS}") + string (REGEX MATCHALL "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\JavaSoft\\\\JDK\\\\[0-9.]+" _JNI_VERSIONS "${_JNI_VERSIONS}") if (_JNI_VERSIONS) # sort versions. Most recent first ## handle version 9 apart from other versions to get correct ordering @@ -141,7 +141,7 @@ if (WIN32) list (REVERSE _JNI_V9) list (APPEND _JNI_VERSIONS ${_JNI_V9}) foreach (_JNI_HINT IN LISTS _JNI_VERSIONS) - list(APPEND _JNI_HINTS "[${_JNI_HINT}\\MSI;INSTALLDIR]") + list(APPEND _JNI_HINTS "[${_JNI_HINT};JavaHome]") endforeach() endif() endif() diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake index 9542f69..61a2213 100644 --- a/Modules/FindJPEG.cmake +++ b/Modules/FindJPEG.cmake @@ -51,7 +51,7 @@ find_path(JPEG_INCLUDE_DIR jpeglib.h) -set(jpeg_names ${JPEG_NAMES} jpeg libjpeg) +set(jpeg_names ${JPEG_NAMES} jpeg jpeg-static libjpeg libjpeg-static) foreach(name ${JPEG_NAMES}) list(APPEND jpeg_names_debug "${name}d") endforeach() diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 95e551f..cddc5d2 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -97,7 +97,7 @@ if (WIN32) list (REVERSE _JAVA_V9) list (APPEND _JAVA_VERSIONS ${_JAVA_V9}) foreach (_JAVA_HINT IN LISTS _JAVA_VERSIONS) - list(APPEND _JAVA_HINTS "[${_JAVA_HINT}\\MSI;INSTALLDIR]/bin") + list(APPEND _JAVA_HINTS "[${_JAVA_HINT};JavaHome]/bin") endforeach() endif() endif() diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index 7eba206..8f35fc7 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -39,9 +39,16 @@ unset(_lua_include_subdirs) unset(_lua_library_names) unset(_lua_append_versions) +set(_lua_additional_paths + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt) # this is a function only to have all the variables inside go away automatically -function(_lua_set_version_vars) +function(_lua_get_versions) set(LUA_VERSIONS5 5.3 5.2 5.1 5.0) if (Lua_FIND_VERSION_EXACT) @@ -59,6 +66,10 @@ function(_lua_set_version_vars) list(APPEND _lua_append_versions ${subver}) endif () endforeach () + # New version -> Search for it (heuristic only! Defines in include might have changed) + if (NOT _lua_append_versions) + set(_lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR}) + endif() endif () endif () else () @@ -66,22 +77,42 @@ function(_lua_set_version_vars) set(_lua_append_versions ${LUA_VERSIONS5}) endif () - list(APPEND _lua_include_subdirs "include/lua" "include") + if (LUA_Debug) + message(STATUS "Considering following Lua versions: ${_lua_append_versions}") + endif() + + set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE) +endfunction() + +function(_lua_set_version_vars) + set(_lua_include_subdirs_raw "lua") foreach (ver IN LISTS _lua_append_versions) string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") - list(APPEND _lua_include_subdirs - include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} - include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + list(APPEND _lua_include_subdirs_raw + lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} + lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} ) endforeach () + # Prepend "include/" to each path directly after the path + set(_lua_include_subdirs "include") + foreach (dir IN LISTS _lua_include_subdirs_raw) + list(APPEND _lua_include_subdirs "${dir}" "include/${dir}") + endforeach () + set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) - set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE) endfunction(_lua_set_version_vars) -function(_lua_check_header_version _hdr_file) +function(_lua_get_header_version) + unset(LUA_VERSION_STRING PARENT_SCOPE) + set(_hdr_file "${LUA_INCLUDE_DIR}/lua.h") + + if (NOT EXISTS "${_hdr_file}") + return() + endif () + # At least 5.[012] have different ways to express the version # so all of them need to be tested. Lua 5.2 defines LUA_VERSION # and LUA_RELEASE as joined by the C preprocessor, so avoid those. @@ -111,39 +142,54 @@ function(_lua_check_header_version _hdr_file) return() endif () endforeach () -endfunction(_lua_check_header_version) - -_lua_set_version_vars() - -if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") - _lua_check_header_version("${LUA_INCLUDE_DIR}/lua.h") -endif () - -if (NOT LUA_VERSION_STRING) - foreach (subdir IN LISTS _lua_include_subdirs) - unset(LUA_INCLUDE_PREFIX CACHE) - unset(LUA_INCLUDE_PREFIX) - find_path(LUA_INCLUDE_PREFIX ${subdir}/lua.h - HINTS - ENV LUA_DIR - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - ) - if (LUA_INCLUDE_PREFIX) - _lua_check_header_version("${LUA_INCLUDE_PREFIX}/${subdir}/lua.h") - if (LUA_VERSION_STRING) - set(LUA_INCLUDE_DIR "${LUA_INCLUDE_PREFIX}/${subdir}") +endfunction(_lua_get_header_version) + +function(_lua_find_header) + _lua_set_version_vars() + + # Initialize as local variable + set(CMAKE_IGNORE_PATH ${CMAKE_IGNORE_PATH}) + while (TRUE) + # Find the next header to test. Check each possible subdir in order + # This prefers e.g. higher versions as they are earlier in the list + # It is also consistent with previous versions of FindLua + foreach (subdir IN LISTS _lua_include_subdirs) + find_path(LUA_INCLUDE_DIR lua.h + HINTS + ENV LUA_DIR + PATH_SUFFIXES ${subdir} + PATHS ${_lua_additional_paths} + ) + if (LUA_INCLUDE_DIR) break() - endif () - endif () - endforeach () -endif () -unset(_lua_include_subdirs) + endif() + endforeach() + # Did not found header -> Fail + if (NOT LUA_INCLUDE_DIR) + return() + endif() + _lua_get_header_version() + # Found accepted version -> Ok + if (LUA_VERSION_STRING) + if (LUA_Debug) + message(STATUS "Found suitable version ${LUA_VERSION_STRING} in ${LUA_INCLUDE_DIR}/lua.h") + endif() + return() + endif() + # Found wrong version -> Ignore this path and retry + if (LUA_Debug) + message(STATUS "Ignoring unsuitable version in ${LUA_INCLUDE_DIR}") + endif() + list(APPEND CMAKE_IGNORE_PATH "${LUA_INCLUDE_DIR}") + unset(LUA_INCLUDE_DIR CACHE) + unset(LUA_INCLUDE_DIR) + unset(LUA_INCLUDE_DIR PARENT_SCOPE) + endwhile () +endfunction() + +_lua_get_versions() +_lua_find_header() +_lua_get_header_version() unset(_lua_append_versions) if (LUA_VERSION_STRING) @@ -160,13 +206,7 @@ find_library(LUA_LIBRARY HINTS ENV LUA_DIR PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt + PATHS ${_lua_additional_paths} ) unset(_lua_library_names) diff --git a/Modules/FindODBC.cmake b/Modules/FindODBC.cmake new file mode 100644 index 0000000..c8ca477 --- /dev/null +++ b/Modules/FindODBC.cmake @@ -0,0 +1,227 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindODBC +-------- + +Find an Open Database Connectivity (ODBC) include directory and library. + +On Windows, when building with Visual Studio, this module assumes the ODBC +library is provided by the available Windows SDK. + +On Unix, this module allows to search for ODBC library provided by +unixODBC or iODBC implementations of ODBC API. +This module reads hint about location of the config program: + +.. variable:: ODBC_CONFIG + + Location of odbc_config or iodbc-config program + +Otherwise, this module tries to find the config program, +first from unixODBC, then from iODBC. +If no config program found, this module searches for ODBC header +and library in list of known locations. + +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` targets: + +.. variable:: ODBC::ODBC + + Imported target for using the ODBC library, if found. + +Result variables +^^^^^^^^^^^^^^^^ + +.. variable:: ODBC_FOUND + + Set to true if ODBC library found, otherwise false or undefined. + +.. variable:: ODBC_INCLUDE_DIRS + + Paths to include directories listed in one variable for use by ODBC client. + May be empty on Windows, where the include directory corresponding to the + expected Windows SDK is already available in the compilation environment. + +.. variable:: ODBC_LIBRARIES + + Paths to libraries to linked against to use ODBC. + May just a library name on Windows, where the library directory corresponding + to the expected Windows SDK is already available in the compilation environment. + +.. variable:: ODBC_CONFIG + + Path to unixODBC or iODBC config program, if found or specified. + +Cache variables +^^^^^^^^^^^^^^^ + +For users who wish to edit and control the module behavior, this module +reads hints about search locations from the following variables: + +.. variable:: ODBC_INCLUDE_DIR + + Path to ODBC include directory with ``sql.h`` header. + +.. variable:: ODBC_LIBRARY + + Path to ODBC library to be linked. + +These variables should not be used directly by project code. + +Limitations +^^^^^^^^^^^ + +On Windows, this module does not search for iODBC. +On Unix, there is no way to prefer unixODBC over iODBC, or vice versa, +other than providing the config program location using the ``ODBC_CONFIG``. +This module does not allow to search for a specific ODBC driver. + +#]=======================================================================] + +# Define lists used internally +set(_odbc_include_paths) +set(_odbc_lib_paths) +set(_odbc_lib_names) +set(_odbc_required_libs_names) + +### Try Windows Kits ########################################################## +if(WIN32) + # List names of ODBC libraries on Windows + set(ODBC_LIBRARY odbc32.lib) + set(_odbc_lib_names odbc32;) + + # List additional libraries required to use ODBC library + if(MSVC OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") + set(_odbc_required_libs_names odbccp32;ws2_32) + elseif(MINGW) + set(_odbc_required_libs_names odbccp32) + endif() +endif() + +### Try unixODBC or iODBC config program ###################################### +if (UNIX) + find_program(ODBC_CONFIG + NAMES odbc_config iodbc-config + DOC "Path to unixODBC or iODBC config program") + mark_as_advanced(ODBC_CONFIG) +endif() + +if (UNIX AND ODBC_CONFIG) + # unixODBC and iODBC accept unified command line options + execute_process(COMMAND ${ODBC_CONFIG} --cflags + OUTPUT_VARIABLE _cflags OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${ODBC_CONFIG} --libs + OUTPUT_VARIABLE _libs OUTPUT_STRIP_TRAILING_WHITESPACE) + + # Collect paths of include directories from CFLAGS + separate_arguments(_cflags NATIVE_COMMAND "${_cflags}") + foreach(arg IN LISTS _cflags) + if("${arg}" MATCHES "^-I(.*)$") + list(APPEND _odbc_include_paths "${CMAKE_MATCH_1}") + endif() + endforeach() + unset(_cflags) + + # Collect paths of library names and directories from LIBS + separate_arguments(_libs NATIVE_COMMAND "${_libs}") + foreach(arg IN LISTS _libs) + if("${arg}" MATCHES "^-L(.*)$") + list(APPEND _odbc_lib_paths "${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^-l(.*)$") + set(_lib_name ${CMAKE_MATCH_1}) + string(REGEX MATCH "odbc" _is_odbc ${_lib_name}) + if(_is_odbc) + list(APPEND _odbc_lib_names ${_lib_name}) + else() + list(APPEND _odbc_required_libs_names ${_lib_name}) + endif() + unset(_lib_name) + endif() + endforeach() + unset(_libs) +endif() + +### Try unixODBC or iODBC in include/lib filesystems ########################## +if (UNIX AND NOT ODBC_CONFIG) + # List names of both ODBC libraries, unixODBC and iODBC + set(_odbc_lib_names odbc;iodbc;unixodbc;) +endif() + +### Find include directories ################################################## +find_path(ODBC_INCLUDE_DIR + NAMES sql.h + PATHS ${_odbc_include_paths}) + +if(NOT ODBC_INCLUDE_DIR AND WIN32) + set(ODBC_INCLUDE_DIR "") +endif() + +### Find libraries ############################################################ +if(NOT ODBC_LIBRARY) + find_library(ODBC_LIBRARY + NAMES ${_odbc_lib_names} + PATHS ${_odbc_lib_paths} + PATH_SUFFIXES odbc) + + foreach(_lib IN LISTS _odbc_required_libs_names) + find_library(_lib_path + NAMES ${_lib} + PATHS ${_odbc_lib_paths} # system parths or collected from ODBC_CONFIG + PATH_SUFFIXES odbc) + if(_lib_path) + list(APPEND _odbc_required_libs_paths ${_lib_path}) + endif() + unset(_lib_path CACHE) + endforeach() +endif() + +# Unset internal lists as no longer used +unset(_odbc_include_paths) +unset(_odbc_lib_paths) +unset(_odbc_lib_names) +unset(_odbc_required_libs_names) + +### Set result variables ###################################################### +set(_odbc_required_vars ODBC_LIBRARY) +if(NOT WIN32) + list(APPEND _odbc_required_vars ODBC_INCLUDE_DIR) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ODBC DEFAULT_MSG ${_odbc_required_vars}) + +unset(_odbc_required_vars) + +mark_as_advanced(ODBC_LIBRARY ODBC_INCLUDE_DIR) + +set(ODBC_INCLUDE_DIRS ${ODBC_INCLUDE_DIR}) +list(APPEND ODBC_LIBRARIES ${ODBC_LIBRARY}) +list(APPEND ODBC_LIBRARIES ${_odbc_required_libs_paths}) + +### Import targets ############################################################ +if(ODBC_FOUND) + if(NOT TARGET ODBC::ODBC) + if(IS_ABSOLUTE "${ODBC_LIBRARY}") + add_library(ODBC::ODBC UNKNOWN IMPORTED) + set_target_properties(ODBC::ODBC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${ODBC_LIBRARY}") + else() + add_library(ODBC::ODBC INTERFACE IMPORTED) + set_target_properties(ODBC::ODBC PROPERTIES + IMPORTED_LIBNAME "${ODBC_LIBRARY}") + endif() + set_target_properties(ODBC::ODBC PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${ODBC_INCLUDE_DIR}") + + if(_odbc_required_libs_paths) + set_property(TARGET ODBC::ODBC APPEND PROPERTY + INTERFACE_LINK_LIBRARIES "${_odbc_required_libs_paths}") + endif() + endif() +endif() + +unset(_odbc_required_libs_paths) diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake index 423fc69..c38527c 100644 --- a/Modules/FindPerl.cmake +++ b/Modules/FindPerl.cmake @@ -28,6 +28,7 @@ if(WIN32) NAME) set(PERL_POSSIBLE_BIN_PATHS ${PERL_POSSIBLE_BIN_PATHS} "C:/Perl/bin" + "C:/Strawberry/perl/bin" [HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl\\${ActivePerl_CurrentVersion}]/bin ) endif() diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 415e914..775a9d7 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -183,8 +183,8 @@ endfunction() # scan the LDFLAGS returned by pkg-config for library directories and # libraries, figure out the absolute paths of that libraries in the -# given directories, and create an imported target from them -function(_pkg_create_imp_target _prefix _no_cmake_path _no_cmake_environment_path) +# given directories +function(_pkg_find_libs _prefix _no_cmake_path _no_cmake_environment_path) unset(_libs) unset(_find_opts) @@ -200,9 +200,7 @@ function(_pkg_create_imp_target _prefix _no_cmake_path _no_cmake_environment_pat unset(_search_paths) foreach (flag IN LISTS ${_prefix}_LDFLAGS) if (flag MATCHES "^-L(.*)") - # only look into the given paths from now on list(APPEND _search_paths ${CMAKE_MATCH_1}) - set(_find_opts HINTS ${_search_paths} NO_DEFAULT_PATH) continue() endif() if (flag MATCHES "^-l(.*)") @@ -211,24 +209,35 @@ function(_pkg_create_imp_target _prefix _no_cmake_path _no_cmake_environment_pat continue() endif() + if(_search_paths) + # Firstly search in -L paths + find_library(pkgcfg_lib_${_prefix}_${_pkg_search} + NAMES ${_pkg_search} + HINTS ${_search_paths} NO_DEFAULT_PATH) + endif() find_library(pkgcfg_lib_${_prefix}_${_pkg_search} NAMES ${_pkg_search} ${_find_opts}) list(APPEND _libs "${pkgcfg_lib_${_prefix}_${_pkg_search}}") endforeach() + set(${_prefix}_LINK_LIBRARIES "${_libs}" PARENT_SCOPE) +endfunction() + +# create an imported target from all the information returned by pkg-config +function(_pkg_create_imp_target _prefix) # only create the target if it is linkable, i.e. no executables if (NOT TARGET PkgConfig::${_prefix} - AND ( ${_prefix}_INCLUDE_DIRS OR _libs OR ${_prefix}_CFLAGS_OTHER )) + AND ( ${_prefix}_INCLUDE_DIRS OR ${_prefix}_LINK_LIBRARIES OR ${_prefix}_CFLAGS_OTHER )) add_library(PkgConfig::${_prefix} INTERFACE IMPORTED) if(${_prefix}_INCLUDE_DIRS) set_property(TARGET PkgConfig::${_prefix} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_prefix}_INCLUDE_DIRS}") endif() - if(_libs) + if(${_prefix}_LINK_LIBRARIES) set_property(TARGET PkgConfig::${_prefix} PROPERTY - INTERFACE_LINK_LIBRARIES "${_libs}") + INTERFACE_LINK_LIBRARIES "${${_prefix}_LINK_LIBRARIES}") endif() if(${_prefix}_CFLAGS_OTHER) set_property(TARGET PkgConfig::${_prefix} PROPERTY @@ -237,6 +246,15 @@ function(_pkg_create_imp_target _prefix _no_cmake_path _no_cmake_environment_pat endif() endfunction() +# recalculate the dynamic output +# this is a macro and not a function so the result of _pkg_find_libs is automatically propagated +macro(_pkg_recalculate _prefix _no_cmake_path _no_cmake_environment_path _imp_target) + _pkg_find_libs(${_prefix} ${_no_cmake_path} ${_no_cmake_environment_path}) + if(${_imp_target}) + _pkg_create_imp_target(${_prefix}) + endif() +endmacro() + ### macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _prefix) _pkgconfig_unset(${_prefix}_FOUND) @@ -456,9 +474,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) - if (_imp_target) - _pkg_create_imp_target("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path}) - endif() + _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target}) endif() if(NOT "${_extra_paths}" STREQUAL "") @@ -521,6 +537,7 @@ endmacro() <XXX>_FOUND ... set to 1 if module(s) exist <XXX>_LIBRARIES ... only the libraries (without the '-l') + <XXX>_LINK_LIBRARIES ... the libraries and their absolute paths <XXX>_LIBRARY_DIRS ... the paths of the libraries (without the '-L') <XXX>_LDFLAGS ... all required linker flags <XXX>_LDFLAGS_OTHER ... all other linker flags @@ -588,8 +605,10 @@ macro(pkg_check_modules _prefix _module0) if (${_prefix}_FOUND) _pkgconfig_set(__pkg_config_arguments_${_prefix} "${_module0};${ARGN}") endif() - elseif (${_prefix}_FOUND AND ${_imp_target}) - _pkg_create_imp_target("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path}) + else() + if (${_prefix}_FOUND) + _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target}) + endif() endif() endmacro() @@ -642,8 +661,8 @@ macro(pkg_search_module _prefix _module0) endif() _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) - elseif (${_prefix}_FOUND AND ${_imp_target}) - _pkg_create_imp_target("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path}) + elseif (${_prefix}_FOUND) + _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target}) endif() endmacro() diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 5a7eadb..847a798 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -547,15 +547,11 @@ if (QT_QMAKE_EXECUTABLE AND if(NOT WIN32) string(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}") endif() - set(qt_cross_paths) - foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) - set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/mkspecs") - endforeach() - set(QT_MKSPECS_DIR NOTFOUND) + find_path(QT_MKSPECS_DIR NAMES qconfig.pri - HINTS ${qt_cross_paths} ${qt_mkspecs_dirs} - DOC "The location of the Qt mkspecs containing qconfig.pri" - NO_CMAKE_FIND_ROOT_PATH) + HINTS ${qt_mkspecs_dirs} + PATH_SUFFIXES mkspecs share/qt4/mkspecs + DOC "The location of the Qt mkspecs containing qconfig.pri") endif() if(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri") @@ -709,14 +705,15 @@ if (QT_QMAKE_EXECUTABLE AND # ask qmake for the plugins directory if (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir) - set(QT_PLUGINS_DIR NOTFOUND) - foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) - set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins") - endforeach() - find_path(QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer - HINTS ${qt_cross_paths} ${qt_plugins_dir} - DOC "The location of the Qt plugins" - NO_CMAKE_FIND_ROOT_PATH) + if(CMAKE_CROSSCOMPILING OR NOT qt_plugins_dir) + find_path(QT_PLUGINS_DIR + NAMES accessible bearer codecs designer graphicssystems iconengines imageformats inputmethods qmltooling script sqldrivers + HINTS ${qt_plugins_dir} + PATH_SUFFIXES plugins lib/qt4/plugins + DOC "The location of the Qt plugins") + else() + set(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins") + endif() endif () # ask qmake for the translations directory @@ -728,18 +725,13 @@ if (QT_QMAKE_EXECUTABLE AND # ask qmake for the imports directory if (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir) - if(qt_imports_dir) - set(QT_IMPORTS_DIR NOTFOUND) - foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) - set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports") - endforeach() + if(CMAKE_CROSSCOMPILING OR NOT qt_imports_dir) find_path(QT_IMPORTS_DIR NAMES Qt - HINTS ${qt_cross_paths} ${qt_imports_dir} - DOC "The location of the Qt imports" - NO_CMAKE_FIND_ROOT_PATH - NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH - NO_CMAKE_SYSTEM_PATH) - mark_as_advanced(QT_IMPORTS_DIR) + HINTS ${qt_imports_dir} + PATH_SUFFIXES imports lib/qt4/imports + DOC "The location of the Qt imports") + else() + set(QT_IMPORTS_DIR ${qt_imports_dir} CACHE PATH "The location of the Qt imports") endif() endif () diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 0fd76c0..36dd0a0 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -584,8 +584,10 @@ if(_IRSL_HAVE_Intel) foreach(__Intel_lib IN ITEMS libchkp.dylib libcilkrts.5.dylib libcilkrts.dylib libimf.dylib libintlc.dylib libirc.dylib libirng.dylib libsvml.dylib) list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}") endforeach() - if(_Intel_compiler_ver VERSION_LESS 17) - list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.dylib") + if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel) + if(_Intel_compiler_ver VERSION_LESS 17) + list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.dylib") + endif() endif() if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel) foreach(__Intel_lib IN ITEMS libifcore.dylib libifcoremt.dylib libifport.dylib libifportmt.dylib) @@ -594,8 +596,7 @@ if(_IRSL_HAVE_Intel) endforeach() endif() else() - set(__install_dirs "${_Intel_redistdir}/irml") - foreach(__Intel_lib IN ITEMS cilk_db.so libchkp.so libcilkrts.so libcilkrts.so.5 libimf.so libintlc.so libintlc.so.5 libirc.so libpdbx.so libpdbx.so.5 libsvml.so) + foreach(__Intel_lib IN ITEMS libchkp.so libcilkrts.so libcilkrts.so.5 libimf.so libintlc.so libintlc.so.5 libirc.so libpdbx.so libpdbx.so.5 libsvml.so) list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}") endforeach() @@ -605,10 +606,11 @@ if(_IRSL_HAVE_Intel) list(APPEND __install_libs "${_Intel_redistdir}/${__Intel_lib}") endforeach() endif() - if(_Intel_compiler_ver VERSION_GREATER_EQUAL 15) - list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.so") - if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel) - list(APPEND __install_libs "${_Intel_redistdir}/libgfxoffload.so") + if(CMAKE_C_COMPILER_ID STREQUAL Intel OR CMAKE_CXX_COMPILER_ID STREQUAL Intel) + set(__install_dirs "${_Intel_redistdir}/irml") + list(APPEND __install_libs "${_Intel_redistdir}/cilk_db.so") + if(_Intel_compiler_ver VERSION_GREATER_EQUAL 15) + list(APPEND __install_libs "${_Intel_redistdir}/libistrconv.so" "${_Intel_redistdir}/libgfxoffload.so") endif() endif() if(_Intel_compiler_ver VERSION_GREATER_EQUAL 16) diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake index 0c11e55..f1c1f2d 100644 --- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake @@ -15,7 +15,7 @@ foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES}) string(APPEND __IMPLICT_LINKS " \"${lib}\"") endforeach() set(CMAKE_CUDA_LINK_EXECUTABLE - "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_CUDA_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_LIBRARIES>${__IMPLICT_LINKS}") + "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_LIBRARIES>${__IMPLICT_LINKS}") set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ") set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --intdir=<OBJECT_DIR> --manifests <MANIFESTS> -- ") @@ -26,7 +26,7 @@ set(CMAKE_CUDA_CREATE_SHARED_MODULE ${CMAKE_CUDA_CREATE_SHARED_LIBRARY}) set(CMAKE_CUDA_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") set(CMAKE_CUDA_LINKER_SUPPORTS_PDB ON) set(CMAKE_CUDA_LINK_EXECUTABLE - "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_CUDA_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICT_LINKS} ${CMAKE_END_TEMP_FILE}") + "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICT_LINKS} ${CMAKE_END_TEMP_FILE}") unset(_CMAKE_VS_LINK_EXE) unset(_CMAKE_VS_LINK_EXE) @@ -51,9 +51,9 @@ endforeach() unset(__IMPLICT_DLINK_DIRS) set(CMAKE_CUDA_DEVICE_LINK_LIBRARY - "<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> <LANGUAGE_COMPILE_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}") + "<CMAKE_CUDA_COMPILER> <LANGUAGE_COMPILE_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}") set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE - "<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}") + "<CMAKE_CUDA_COMPILER> <FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}") unset(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS) unset(__IMPLICT_DLINK_FLAGS) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index aee4028..a2c8d85 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -151,7 +151,8 @@ macro (QT4_GENERATE_MOC infile outfile ) set(moc_target ${ARGV3}) endif() QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}") - set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file endmacro () @@ -166,6 +167,8 @@ macro (QT4_WRAP_CPP outfiles ) get_filename_component(it ${it} ABSOLUTE) QT4_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile) QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}" "${moc_target}") + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file set(${outfiles} ${${outfiles}} ${outfile}) endforeach() @@ -185,6 +188,8 @@ macro (QT4_WRAP_UI outfiles ) COMMAND Qt4::uic ARGS ${ui_options} -o ${outfile} ${infile} MAIN_DEPENDENCY ${infile} VERBATIM) + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file set(${outfiles} ${${outfiles}} ${outfile}) endforeach () @@ -233,6 +238,8 @@ macro (QT4_ADD_RESOURCES outfiles ) ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile} MAIN_DEPENDENCY ${infile} DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM) + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${outfile} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file set(${outfiles} ${${outfiles}} ${outfile}) endforeach () @@ -245,19 +252,19 @@ macro(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) set(_impl "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp") set(_moc "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc") - get_source_file_property(_nonamespace ${_interface} NO_NAMESPACE) + get_property(_nonamespace SOURCE ${_interface} PROPERTY NO_NAMESPACE) if(_nonamespace) set(_params -N -m) else() set(_params -m) endif() - get_source_file_property(_classname ${_interface} CLASSNAME) + get_property(_classname SOURCE ${_interface} PROPERTY CLASSNAME) if(_classname) set(_params ${_params} -c ${_classname}) endif() - get_source_file_property(_include ${_interface} INCLUDE) + get_property(_include SOURCE ${_interface} PROPERTY INCLUDE) if(_include) set(_params ${_params} -i ${_include}) endif() @@ -266,7 +273,8 @@ macro(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) COMMAND Qt4::qdbusxml2cpp ${_params} -p ${_basename} ${_infile} DEPENDS ${_infile} VERBATIM) - set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) + set_property(SOURCE ${_impl} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${_impl} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file QT4_GENERATE_MOC("${_header}" "${_moc}") @@ -350,7 +358,8 @@ macro(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optional endif() QT4_GENERATE_MOC("${_header}" "${_moc}") - set_source_files_properties("${_impl}" PROPERTIES SKIP_AUTOMOC TRUE) + set_property(SOURCE ${_impl} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file + set_property(SOURCE ${_impl} PROPERTY SKIP_AUTOUIC TRUE) # don't run autouic on this file MACRO_ADD_FILE_DEPENDENCIES("${_impl}" "${_moc}") list(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}") @@ -374,7 +383,7 @@ macro(QT4_AUTOMOC) # cmake is run for the very first time on them -> however the .cpp files might # exist at a later run. at that time we need to skip them, so that we don't add two # different rules for the same moc file - get_source_file_property(_skip ${_abs_FILE} SKIP_AUTOMOC) + get_property(_skip SOURCE ${_abs_FILE} PROPERTY SKIP_AUTOMOC) if ( NOT _skip AND EXISTS ${_abs_FILE} ) @@ -454,7 +463,7 @@ macro(QT4_ADD_TRANSLATION _qm_files) foreach (_current_FILE ${ARGN}) get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) get_filename_component(qm ${_abs_FILE} NAME_WE) - get_source_file_property(output_location ${_abs_FILE} OUTPUT_LOCATION) + get_property(output_location SOURCE ${_abs_FILE} PROPERTY OUTPUT_LOCATION) if(output_location) file(MAKE_DIRECTORY "${output_location}") set(qm "${output_location}/${qm}.qm") |