diff options
573 files changed, 10120 insertions, 6341 deletions
@@ -8,3 +8,6 @@ Testing # Visual Studio work directory .vs/ + +# Visual Studio Code +.vscode/ diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el index 8ae57d4..e4fa6c1 100644 --- a/Auxiliary/cmake-mode.el +++ b/Auxiliary/cmake-mode.el @@ -55,7 +55,7 @@ set the path with these commands: (* (or (not (any space "()#\\\n")) (and ?\\ nonl))))) (defconst cmake-regex-token (rx-to-string `(group (or (regexp ,cmake-regex-comment) - ?( ?) + ?\( ?\) (regexp ,cmake-regex-argument-unquoted) (regexp ,cmake-regex-argument-quoted))))) (defconst cmake-regex-indented diff --git a/Help/command/LINK_OPTIONS_LINKER.txt b/Help/command/LINK_OPTIONS_LINKER.txt new file mode 100644 index 0000000..76927be --- /dev/null +++ b/Help/command/LINK_OPTIONS_LINKER.txt @@ -0,0 +1,10 @@ +To pass options to the linker tool, each compiler driver has is own syntax. +The ``LINKER:`` prefix can be used to specify, in a portable way, options +to pass to the linker tool. The ``LINKER:`` prefix is replaced by the required +driver option and the rest of the option string defines linker arguments using +``,`` as separator. These arguments will be formatted according to the +:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG` and +:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP` variables. + +For example, ``"LINKER:-z,defs"`` becomes ``-Xlinker -z -Xlinker defs`` for +``Clang`` and ``-Wl,-z,defs`` for ``GNU GCC``. diff --git a/Help/command/COMPILE_OPTIONS_SHELL.txt b/Help/command/OPTIONS_SHELL.txt index a1316c8..530c012 100644 --- a/Help/command/COMPILE_OPTIONS_SHELL.txt +++ b/Help/command/OPTIONS_SHELL.txt @@ -1,4 +1,4 @@ -The final set of compile options used for a target is constructed by +The final set of compile or link options used for a target is constructed by accumulating options from the current target and the usage requirements of it dependencies. The set of options is de-duplicated to avoid repetition. While beneficial for individual options, the de-duplication step can break diff --git a/Help/command/add_compile_options.rst b/Help/command/add_compile_options.rst index c445608..350a1c0 100644 --- a/Help/command/add_compile_options.rst +++ b/Help/command/add_compile_options.rst @@ -22,4 +22,4 @@ the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. -.. include:: COMPILE_OPTIONS_SHELL.txt +.. include:: OPTIONS_SHELL.txt diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index f20b274..b7ba724 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -153,6 +153,7 @@ the interface target using the commands: * :command:`set_property`, * :command:`target_link_libraries(INTERFACE)`, +* :command:`target_link_options(INTERFACE)`, * :command:`target_include_directories(INTERFACE)`, * :command:`target_compile_options(INTERFACE)`, * :command:`target_compile_definitions(INTERFACE)`, and diff --git a/Help/command/add_link_options.rst b/Help/command/add_link_options.rst new file mode 100644 index 0000000..821198d --- /dev/null +++ b/Help/command/add_link_options.rst @@ -0,0 +1,26 @@ +add_link_options +---------------- + +Adds options to the link of targets. + +:: + + add_link_options(<option> ...) + +Adds options to the link step for targets in the current directory and below +that are added after this command is invoked. See documentation of the +:prop_dir:`directory <LINK_OPTIONS>` and +:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties. + +This command can be used to add any options, but alternative commands +exist to add libraries (:command:`target_link_libraries` or +:command:`link_libraries`). + +Arguments to ``add_link_options`` may use "generator expressions" with +the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. See the :manual:`cmake-buildsystem(7)` +manual for more on defining buildsystem properties. + +.. include:: LINK_OPTIONS_LINKER.txt + +.. include:: OPTIONS_SHELL.txt diff --git a/Help/command/install.rst b/Help/command/install.rst index 6cea996..8b2a971 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -280,6 +280,14 @@ targets that link to the object libraries in their implementation. Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property set to ``TRUE`` has undefined behavior. +:command:`install(TARGETS)` can install targets that were created in +other directories. When using such cross-directory install rules, running +``make install`` (or similar) from a subdirectory will not guarantee that +targets from other directories are up-to-date. You can use +:command:`target_link_libraries` or :command:`add_dependencies` +to ensure that such out-of-directory targets are built before the +subdirectory-specific install rules are run. + The install destination given to the target install ``DESTINATION`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. @@ -427,6 +435,10 @@ example, the code will print a message during installation. +The contents of ``SCRIPT`` or ``CODE`` may use "generator expressions" with +the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. + Installing Exports ^^^^^^^^^^^^^^^^^^ diff --git a/Help/command/list.rst b/Help/command/list.rst index 589e572..ad2c428 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -28,7 +28,7 @@ Synopsis `Ordering`_ list(`REVERSE`_ <list>) - list(`SORT`_ <list>) + list(`SORT`_ <list> [...]) Introduction ^^^^^^^^^^^^ @@ -253,7 +253,23 @@ Reverses the contents of the list in-place. :: - list(SORT <list>) - + list(SORT <list> [COMPARE <compare>] [CASE <case>] [ORDER <order>]) Sorts the list in-place alphabetically. +Use the option ``<compare>`` to select the compare type for sorting. +The ``<compare>`` option may be one of: + +* ``STRING``: Sorts a list of strings alphabetically. +* ``FILE_BASENAME``: Sort a list of pathnames of files by their basenames. + +Use the option ``<case>`` to select a case sensitive or case insensitive sort mode. +The ``<case>`` option may be one of: + +* ``SENSITIVE``: Sorts the list alphabetically. +* ``INSENSITIVE``: Sorts the list alphabetically in descending order. + +Use the option ``<order>`` to select a case sensitive or case insensitive sort mode. +The ``<order>`` option may be one of: + +* ``ASCENDING``: Sorts the list in ascending order. +* ``DESCENDING``: Sorts the list in descending order. diff --git a/Help/command/math.rst b/Help/command/math.rst index f99dc3d..63af931 100644 --- a/Help/command/math.rst +++ b/Help/command/math.rst @@ -5,10 +5,26 @@ Mathematical expressions. :: - math(EXPR <output-variable> <math-expression>) + math(EXPR <output-variable> <math-expression> [OUTPUT_FORMAT <format>]) ``EXPR`` evaluates mathematical expression and returns result in the output variable. Example mathematical expression is ``5 * (10 + 13)``. Supported operators are ``+``, ``-``, ``*``, ``/``, ``%``, ``|``, ``&``, ``^``, ``~``, ``<<``, ``>>``, and ``(...)``. They have the same meaning as they do in C code. + +Numeric constants are evaluated in decimal or hexadecimal representation. + +The result is formatted according to the option "OUTPUT_FORMAT" , +where ``<format>`` is one of: +:: + + HEXADECIMAL = Result in output variable will be formatted in C code + Hexadecimal notation. + DECIMAL = Result in output variable will be formatted in decimal notation. + + +For example:: + + math(EXPR value "100 * 0xA" DECIMAL) results in value is set to "1000" + math(EXPR value "100 * 0xA" HEXADECIMAL) results in value is set to "0x3e8" diff --git a/Help/command/option.rst b/Help/command/option.rst index 91cd0a7..4fabb87 100644 --- a/Help/command/option.rst +++ b/Help/command/option.rst @@ -9,7 +9,9 @@ Provides an option that the user can optionally select. [initial value]) Provide an option for the user to select as ``ON`` or ``OFF``. If no -initial value is provided, ``OFF`` is used. +initial value is provided, ``OFF`` is used. If the option is already +set as a normal variable then the command does nothing +(see policy :policy:`CMP0077`). If you have options that depend on the values of other options, see the module help for :module:`CMakeDependentOption`. diff --git a/Help/command/string.rst b/Help/command/string.rst index efa923b..29a153a 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -151,6 +151,20 @@ has lower precedence than concatenation. This means that the regular expression ``^ab+d$`` matches ``abbd`` but not ``ababd``, and the regular expression ``^(ab|cd)$`` matches ``ab`` but not ``abd``. +Backslash (``\``) characters in regular expressions are interpreted +literally and do not escape anything or represent placeholders. +However, CMake language :ref:`Escape Sequences` such as ``\t``, +``\r``, ``\n``, and ``\\`` may be used to construct literal tabs, +carriage returns, newlines, and backslashes (respectively) to pass +in a regex. For example: + +* The quoted argument ``"[ \t\r\n]"`` specifies a regex that matches + any single whitespace character. +* The quoted argument ``"[/\\]"`` specifies a regex that matches + a single forward slash ``/`` or backslash ``\``. +* The quoted argument ``"[A-Za-z0-9_]"`` specifies a regex that matches + any single "word" character in the C locale. + Manipulation ^^^^^^^^^^^^ diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst index 194d008..88b7f15 100644 --- a/Help/command/target_compile_options.rst +++ b/Help/command/target_compile_options.rst @@ -39,4 +39,4 @@ with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. -.. include:: COMPILE_OPTIONS_SHELL.txt +.. include:: OPTIONS_SHELL.txt diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index fcc2c07..1f0d69e 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -70,7 +70,8 @@ Each ``<item>`` may be: Link flags specified here are inserted into the link command in the same place as the link libraries. This might not be correct, depending on - the linker. Use the :prop_tgt:`LINK_FLAGS` target property to add link + the linker. Use the :prop_tgt:`LINK_OPTIONS` target property or + :command:`target_link_options` command to add link flags explicitly. The flags will then be placed at the toolchain-defined flag position in the link command. diff --git a/Help/command/target_link_options.rst b/Help/command/target_link_options.rst new file mode 100644 index 0000000..8f47180 --- /dev/null +++ b/Help/command/target_link_options.rst @@ -0,0 +1,42 @@ +target_link_options +------------------- + +Add link options to a target. + +:: + + target_link_options(<target> [BEFORE] + <INTERFACE|PUBLIC|PRIVATE> [items1...] + [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...]) + +Specify link options to use when linking a given target. The +named ``<target>`` must have been created by a command such as +:command:`add_executable` or :command:`add_library` and must not be an +:ref:`ALIAS target <Alias Targets>`. + +If ``BEFORE`` is specified, the content will be prepended to the property +instead of being appended. + +This command can be used to add any options, but +alternative commands exist to add libraries +(:command:`target_link_libraries` and :command:`link_libraries`). +See documentation of the :prop_dir:`directory <LINK_OPTIONS>` and +:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties. + +The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to +specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` +items will populate the :prop_tgt:`LINK_OPTIONS` property of +``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the +:prop_tgt:`INTERFACE_LINK_OPTIONS` property of ``<target>``. +(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) +The following arguments specify link options. Repeated calls for the same +``<target>`` append items in the order called. + +Arguments to ``target_link_options`` may use "generator expressions" +with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. See the :manual:`cmake-buildsystem(7)` +manual for more on defining buildsystem properties. + +.. include:: LINK_OPTIONS_LINKER.txt + +.. include:: OPTIONS_SHELL.txt diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst index a4f5196..5dd8d86 100644 --- a/Help/command/target_sources.rst +++ b/Help/command/target_sources.rst @@ -9,7 +9,9 @@ Add sources to a target. <INTERFACE|PUBLIC|PRIVATE> [items1...] [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...]) -Specify sources to use when compiling a given target. The +Specify sources to use when compiling a given target. Relative +source file paths are interpreted as being relative to the current +source directory (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`). The named ``<target>`` must have been created by a command such as :command:`add_executable` or :command:`add_library` and must not be an :ref:`ALIAS target <Alias Targets>`. @@ -27,3 +29,6 @@ Arguments to ``target_sources`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. + +See also the :policy:`CMP0076` policy for older behavior related to the +handling of relative source file paths. diff --git a/Help/cpack_gen/archive.rst b/Help/cpack_gen/archive.rst new file mode 100644 index 0000000..b288aad --- /dev/null +++ b/Help/cpack_gen/archive.rst @@ -0,0 +1,35 @@ +CPack Archive Generator +----------------------- + +Archive CPack generator that supports packaging of sources and binaries in +different formats: + + - 7Z - 7zip - (.7z) + - TBZ2 (.tar.bz2) + - TGZ (.tar.gz) + - TXZ (.tar.xz) + - TZ (.tar.Z) + - ZIP (.zip) + +Variables specific to CPack Archive generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. variable:: CPACK_ARCHIVE_FILE_NAME + CPACK_ARCHIVE_<component>_FILE_NAME + + Package file name without extension which is added automatically depending + on the archive format. + + * Mandatory : YES + * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].<extension>`` with + spaces replaced by '-' + +.. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL + + Enable component packaging for CPackArchive + + * Mandatory : NO + * Default : OFF + + If enabled (ON) multiple packages are generated. By default a single package + containing files of all components is generated. diff --git a/Help/cpack_gen/bundle.rst b/Help/cpack_gen/bundle.rst new file mode 100644 index 0000000..4628968 --- /dev/null +++ b/Help/cpack_gen/bundle.rst @@ -0,0 +1,64 @@ +CPack Bundle Generator +---------------------- + +CPack Bundle generator (Mac OS X) specific options + +Variables specific to CPack Bundle generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Installers built on Mac OS X using the Bundle generator use the +aforementioned DragNDrop (CPACK_DMG_xxx) variables, plus the following +Bundle-specific parameters (CPACK_BUNDLE_xxx). + +.. variable:: CPACK_BUNDLE_NAME + + The name of the generated bundle. This appears in the OSX finder as the + bundle name. Required. + +.. variable:: CPACK_BUNDLE_PLIST + + Path to an OSX plist file that will be used for the generated bundle. This + assumes that the caller has generated or specified their own Info.plist + file. Required. + +.. variable:: CPACK_BUNDLE_ICON + + Path to an OSX icon file that will be used as the icon for the generated + bundle. This is the icon that appears in the OSX finder for the bundle, and + in the OSX dock when the bundle is opened. Required. + +.. variable:: CPACK_BUNDLE_STARTUP_COMMAND + + Path to a startup script. This is a path to an executable or script that + will be run whenever an end-user double-clicks the generated bundle in the + OSX Finder. Optional. + +.. variable:: CPACK_BUNDLE_APPLE_CERT_APP + + The name of your Apple supplied code signing certificate for the application. + The name usually takes the form "Developer ID Application: [Name]" or + "3rd Party Mac Developer Application: [Name]". If this variable is not set + the application will not be signed. + +.. variable:: CPACK_BUNDLE_APPLE_ENTITLEMENTS + + The name of the plist file that contains your apple entitlements for sandboxing + your application. This file is required for submission to the Mac App Store. + +.. variable:: CPACK_BUNDLE_APPLE_CODESIGN_FILES + + A list of additional files that you wish to be signed. You do not need to + list the main application folder, or the main executable. You should + list any frameworks and plugins that are included in your app bundle. + +.. variable:: CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER + + Additional parameter that will passed to codesign. + Default value: "--deep -f" + +.. variable:: CPACK_COMMAND_CODESIGN + + Path to the codesign(1) command used to sign applications with an + Apple cert. This variable can be used to override the automatically + detected command (or specify its location if the auto-detection fails + to find it.) diff --git a/Help/cpack_gen/cygwin.rst b/Help/cpack_gen/cygwin.rst new file mode 100644 index 0000000..1c5f7af --- /dev/null +++ b/Help/cpack_gen/cygwin.rst @@ -0,0 +1,23 @@ +CPack Cygwin Generator +---------------------- + +Cygwin CPack generator (Cygwin). + +Variables specific to CPack Cygwin generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The +following variable is specific to installers build on and/or for +Cygwin: + +.. variable:: CPACK_CYGWIN_PATCH_NUMBER + + The Cygwin patch number. FIXME: This documentation is incomplete. + +.. variable:: CPACK_CYGWIN_PATCH_FILE + + The Cygwin patch file. FIXME: This documentation is incomplete. + +.. variable:: CPACK_CYGWIN_BUILD_SCRIPT + + The Cygwin build script. FIXME: This documentation is incomplete. diff --git a/Help/cpack_gen/deb.rst b/Help/cpack_gen/deb.rst new file mode 100644 index 0000000..c5923be --- /dev/null +++ b/Help/cpack_gen/deb.rst @@ -0,0 +1,529 @@ +CPack Deb Generator +------------------- + +The built in (binary) CPack Deb generator (Unix only) + +Variables specific to CPack Debian (DEB) generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The CPack Deb generator may be used to create Deb package using :module:`CPack`. +The CPack Deb generator is a :module:`CPack` generator thus it uses the +``CPACK_XXX`` variables used by :module:`CPack`. + +The CPack Deb generator should work on any Linux host but it will produce +better deb package when Debian specific tools ``dpkg-xxx`` are usable on +the build system. + +The CPack Deb generator has specific features which are controlled by the +specifics :code:`CPACK_DEBIAN_XXX` variables. + +:code:`CPACK_DEBIAN_<COMPONENT>_XXXX` variables may be used in order to have +**component** specific values. Note however that ``<COMPONENT>`` refers to +the **grouping name** written in upper case. It may be either a component name +or a component GROUP name. + +Here are some CPack Deb generator wiki resources that are here for historic +reasons and are no longer maintained but may still prove useful: + + - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration + - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#deb-unix-only + +List of CPack Deb generator specific variables: + +.. variable:: CPACK_DEB_COMPONENT_INSTALL + + Enable component packaging for CPackDEB + + * Mandatory : NO + * Default : OFF + + If enabled (ON) multiple packages are generated. By default a single package + containing files of all components is generated. + +.. variable:: CPACK_DEBIAN_PACKAGE_NAME + CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME + + Set Package control field (variable is automatically transformed to lower + case). + + * Mandatory : YES + * Default : + + - :variable:`CPACK_PACKAGE_NAME` for non-component based + installations + - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with -<COMPONENT> + for component-based installations. + + See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source + +.. variable:: CPACK_DEBIAN_FILE_NAME + CPACK_DEBIAN_<COMPONENT>_FILE_NAME + + Package file name. + + * Mandatory : YES + * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].deb`` + + This may be set to ``DEB-DEFAULT`` to allow the CPack Deb generator to generate + package file name by itself in deb format:: + + <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb + + Alternatively provided package file name must end + with either ``.deb`` or ``.ipk`` suffix. + + .. note:: + + Preferred setting of this variable is ``DEB-DEFAULT`` but for backward + compatibility with the CPack Deb generator in CMake prior to version 3.6 this + feature is disabled by default. + + .. note:: + + By using non default filenames duplicate names may occur. Duplicate files + get overwritten and it is up to the packager to set the variables in a + manner that will prevent such errors. + +.. variable:: CPACK_DEBIAN_PACKAGE_EPOCH + + The Debian package epoch + + * Mandatory : No + * Default : - + + Optional number that should be incremented when changing versioning schemas + or fixing mistakes in the version numbers of older packages. + +.. variable:: CPACK_DEBIAN_PACKAGE_VERSION + + The Debian package version + + * Mandatory : YES + * Default : :variable:`CPACK_PACKAGE_VERSION` + + This variable may contain only alphanumerics (A-Za-z0-9) and the characters + . + - ~ (full stop, plus, hyphen, tilde) and should start with a digit. If + :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` is not set then hyphens are not + allowed. + + .. note:: + + For backward compatibility with CMake 3.9 and lower a failed test of this + variable's content is not a hard error when both + :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` and + :variable:`CPACK_DEBIAN_PACKAGE_EPOCH` variables are not set. An author + warning is reported instead. + +.. variable:: CPACK_DEBIAN_PACKAGE_RELEASE + + The Debian package release - Debian revision number. + + * Mandatory : No + * Default : - + + This is the numbering of the DEB package itself, i.e. the version of the + packaging and not the version of the content (see + :variable:`CPACK_DEBIAN_PACKAGE_VERSION`). One may change the default value + if the previous packaging was buggy and/or you want to put here a fancy Linux + distro specific numbering. + +.. variable:: CPACK_DEBIAN_PACKAGE_ARCHITECTURE + CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE + + The Debian package architecture + + * Mandatory : YES + * Default : Output of :code:`dpkg --print-architecture` (or :code:`i386` + if :code:`dpkg` is not found) + +.. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS + CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS + + Sets the Debian dependencies of this package. + + * Mandatory : NO + * Default : + + - An empty string for non-component based installations + - :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS` for component-based + installations. + + .. note:: + + If :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or + more specifically :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS` + is set for this component, the discovered dependencies will be appended + to :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` instead of + :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`. If + :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` is an empty string, + only the automatically discovered dependencies will be set for this + component. + + Example:: + + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)") + +.. variable:: CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS + + Sets inter component dependencies if listed with + :variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER + + The Debian package maintainer + + * Mandatory : YES + * Default : :code:`CPACK_PACKAGE_CONTACT` + +.. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION + CPACK_COMPONENT_<COMPONENT>_DESCRIPTION + + The Debian package description + + * Mandatory : YES + * Default : + + - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set or + - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` + + +.. variable:: CPACK_DEBIAN_PACKAGE_SECTION + CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION + + Set Section control field e.g. admin, devel, doc, ... + + * Mandatory : YES + * Default : "devel" + + See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections + +.. variable:: CPACK_DEBIAN_ARCHIVE_TYPE + + The archive format used for creating the Debian package. + + * Mandatory : YES + * Default : "paxr" + + Possible values are: + + - paxr + - gnutar + + .. note:: + + Default pax archive format is the most portable format and generates + packages that do not treat sparse files specially. + GNU tar format on the other hand supports longer filenames. + +.. variable:: CPACK_DEBIAN_COMPRESSION_TYPE + + The compression used for creating the Debian package. + + * Mandatory : YES + * Default : "gzip" + + Possible values are: + + - lzma + - xz + - bzip2 + - gzip + +.. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY + CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY + + Set Priority control field e.g. required, important, standard, optional, + extra + + * Mandatory : YES + * Default : "optional" + + See https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities + +.. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE + + The URL of the web site for this package, preferably (when applicable) the + site from which the original source can be obtained and any additional + upstream documentation or information may be found. + + * Mandatory : NO + * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL` + + .. note:: + + The content of this field is a simple URL without any surrounding + characters such as <>. + +.. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS + CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS + + May be set to ON in order to use :code:`dpkg-shlibdeps` to generate + better package dependency list. + + * Mandatory : NO + * Default : + + - :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` if set or + - OFF + + .. note:: + + You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value + if you use this feature, because if you don't :code:`dpkg-shlibdeps` + may fail to find your own shared libs. + See https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling + +.. variable:: CPACK_DEBIAN_PACKAGE_DEBUG + + May be set when invoking cpack in order to trace debug information + during the CPack Deb generator run. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS + CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS + + Sets the `Pre-Depends` field of the Debian package. + Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it + also forces :code:`dpkg` to complete installation of the packages named + before even starting the installation of the package which declares the + pre-dependency. + + * Mandatory : NO + * Default : + + - An empty string for non-component based installations + - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based + installations. + + See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps + +.. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES + CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES + + Sets the `Enhances` field of the Debian package. + Similar to :variable:`Suggests <CPACK_DEBIAN_PACKAGE_SUGGESTS>` but works + in the opposite direction: declares that a package can enhance the + functionality of another package. + + * Mandatory : NO + * Default : + + - An empty string for non-component based installations + - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based + installations. + + See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps + +.. variable:: CPACK_DEBIAN_PACKAGE_BREAKS + CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS + + Sets the `Breaks` field of the Debian package. + When a binary package (P) declares that it breaks other packages (B), + :code:`dpkg` will not allow the package (P) which declares `Breaks` be + **unpacked** unless the packages that will be broken (B) are deconfigured + first. + As long as the package (P) is configured, the previously deconfigured + packages (B) cannot be reconfigured again. + + * Mandatory : NO + * Default : + + - An empty string for non-component based installations + - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based + installations. + + See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks + +.. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS + CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS + + Sets the `Conflicts` field of the Debian package. + When one binary package declares a conflict with another using a `Conflicts` + field, :code:`dpkg` will not allow them to be unpacked on the system at + the same time. + + * Mandatory : NO + * Default : + + - An empty string for non-component based installations + - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based + installations. + + See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts + + .. note:: + + This is a stronger restriction than + :variable:`Breaks <CPACK_DEBIAN_PACKAGE_BREAKS>`, which prevents the + broken package from being configured while the breaking package is in + the "Unpacked" state but allows both packages to be unpacked at the same + time. + +.. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES + CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES + + Sets the `Provides` field of the Debian package. + A virtual package is one which appears in the `Provides` control field of + another package. + + * Mandatory : NO + * Default : + + - An empty string for non-component based installations + - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based + installations. + + See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual + +.. variable:: CPACK_DEBIAN_PACKAGE_REPLACES + CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES + + Sets the `Replaces` field of the Debian package. + Packages can declare in their control file that they should overwrite + files in certain other packages, or completely replace other packages. + + * Mandatory : NO + * Default : + + - An empty string for non-component based installations + - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based + installations. + + See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps + +.. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS + CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS + + Sets the `Recommends` field of the Debian package. + Allows packages to declare a strong, but not absolute, dependency on other + packages. + + * Mandatory : NO + * Default : + + - An empty string for non-component based installations + - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based + installations. + + See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps + +.. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS + CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS + + Sets the `Suggests` field of the Debian package. + Allows packages to declare a suggested package install grouping. + + * Mandatory : NO + * Default : + + - An empty string for non-component based installations + - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based + installations. + + See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps + +.. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS + + * Mandatory : NO + * Default : OFF + + Allows to generate shlibs control file automatically. Compatibility is defined by + :variable:`CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY` variable value. + + .. note:: + + Libraries are only considered if they have both library name and version + set. This can be done by setting SOVERSION property with + :command:`set_target_properties` command. + +.. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY + + Compatibility policy for auto-generated shlibs control file. + + * Mandatory : NO + * Default : "=" + + Defines compatibility policy for auto-generated shlibs control file. + Possible values: "=", ">=" + + See https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-sharedlibs-shlibdeps + +.. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_EXTRA + + This variable allow advanced user to add custom script to the + control.tar.gz. + Typical usage is for conffiles, postinst, postrm, prerm. + + * Mandatory : NO + * Default : - + + Usage:: + + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") + + .. note:: + + The original permissions of the files will be used in the final + package unless the variable + :variable:`CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION` is set. + In particular, the scripts should have the proper executable + flag prior to the generation of the package. + +.. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION + CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_STRICT_PERMISSION + + This variable indicates if the Debian policy on control files should be + strictly followed. + + * Mandatory : NO + * Default : FALSE + + Usage:: + + set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE) + + .. note:: + + This overrides the permissions on the original files, following the rules + set by Debian policy + https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners + +.. variable:: CPACK_DEBIAN_PACKAGE_SOURCE + CPACK_DEBIAN_<COMPONENT>_PACKAGE_SOURCE + + Sets the ``Source`` field of the binary Debian package. + When the binary package name is not the same as the source package name + (in particular when several components/binaries are generated from one + source) the source from which the binary has been generated should be + indicated with the field ``Source``. + + * Mandatory : NO + * Default : + + - An empty string for non-component based installations + - :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based + installations. + + See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source + + .. note:: + + This value is not interpreted. It is possible to pass an optional + revision number of the referenced source package as well. + +Building Debian packages on Windows +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To communicate UNIX file permissions from the install stage +to the CPack DEB generator the "cmake_mode_t" NTFS +alternate data stream (ADT) is used. + +When a filesystem without ADT support is used only owner read/write +permissions can be preserved. diff --git a/Help/cpack_gen/dmg.rst b/Help/cpack_gen/dmg.rst new file mode 100644 index 0000000..e4482ef --- /dev/null +++ b/Help/cpack_gen/dmg.rst @@ -0,0 +1,101 @@ +CPack DMG Generator +------------------- + +DragNDrop CPack generator (Mac OS X). + +Variables specific to CPack DragNDrop generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following variables are specific to the DragNDrop installers built +on Mac OS X: + +.. variable:: CPACK_DMG_VOLUME_NAME + + The volume name of the generated disk image. Defaults to + CPACK_PACKAGE_FILE_NAME. + +.. variable:: CPACK_DMG_FORMAT + + The disk image format. Common values are UDRO (UDIF read-only), UDZO (UDIF + zlib-compressed) or UDBZ (UDIF bzip2-compressed). Refer to hdiutil(1) for + more information on other available formats. Defaults to UDZO. + +.. variable:: CPACK_DMG_DS_STORE + + Path to a custom DS_Store file. This .DS_Store file e.g. can be used to + specify the Finder window position/geometry and layout (such as hidden + toolbars, placement of the icons etc.). This file has to be generated by + the Finder (either manually or through AppleScript) using a normal folder + from which the .DS_Store file can then be extracted. + +.. variable:: CPACK_DMG_DS_STORE_SETUP_SCRIPT + + Path to a custom AppleScript file. This AppleScript is used to generate + a .DS_Store file which specifies the Finder window position/geometry and + layout (such as hidden toolbars, placement of the icons etc.). + By specifying a custom AppleScript there is no need to use + CPACK_DMG_DS_STORE, as the .DS_Store that is generated by the AppleScript + will be packaged. + +.. variable:: CPACK_DMG_BACKGROUND_IMAGE + + Path to an image file to be used as the background. This file will be + copied to .background/background.<ext>, where ext is the original image file + extension. The background image is installed into the image before + CPACK_DMG_DS_STORE_SETUP_SCRIPT is executed or CPACK_DMG_DS_STORE is + installed. By default no background image is set. + +.. variable:: CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK + + Default behaviour is to include a symlink to ``/Applications`` in the DMG. + Set this option to ``ON`` to avoid adding the symlink. + +.. variable:: CPACK_DMG_SLA_DIR + + Directory where license and menu files for different languages are stored. + Setting this causes CPack to look for a ``<language>.menu.txt`` and + ``<language>.license.txt`` file for every language defined in + ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and + ``CPACK_RESOURCE_FILE_LICENSE`` are set, CPack will only look for the menu + files and use the same license file for all languages. + +.. variable:: CPACK_DMG_SLA_LANGUAGES + + Languages for which a license agreement is provided when mounting the + generated DMG. A menu file consists of 9 lines of text. The first line is + is the name of the language itself, uppercase, in English (e.g. German). + The other lines are translations of the following strings: + + - Agree + - Disagree + - Print + - Save... + - You agree to the terms of the License Agreement when you click the + "Agree" button. + - Software License Agreement + - This text cannot be saved. The disk may be full or locked, or the file + may be locked. + - Unable to print. Make sure you have selected a printer. + + For every language in this list, CPack will try to find files + ``<language>.menu.txt`` and ``<language>.license.txt`` in the directory + specified by the :variable:`CPACK_DMG_SLA_DIR` variable. + +.. variable:: CPACK_COMMAND_HDIUTIL + + Path to the hdiutil(1) command used to operate on disk image files on Mac + OS X. This variable can be used to override the automatically detected + command (or specify its location if the auto-detection fails to find it.) + +.. variable:: CPACK_COMMAND_SETFILE + + Path to the SetFile(1) command used to set extended attributes on files and + directories on Mac OS X. This variable can be used to override the + automatically detected command (or specify its location if the + auto-detection fails to find it.) + +.. variable:: CPACK_COMMAND_REZ + + Path to the Rez(1) command used to compile resources on Mac OS X. This + variable can be used to override the automatically detected command (or + specify its location if the auto-detection fails to find it.) diff --git a/Help/cpack_gen/external.rst b/Help/cpack_gen/external.rst new file mode 100644 index 0000000..a69866d --- /dev/null +++ b/Help/cpack_gen/external.rst @@ -0,0 +1,249 @@ +CPack External Generator +------------------------ + +CPack provides many generators to create packages for a variety of platforms +and packaging systems. The intention is for CMake/CPack to be a complete +end-to-end solution for building and packaging a software project. However, it +may not always be possible to use CPack for the entire packaging process, due +to either technical limitations or policies that require the use of certain +tools. For this reason, CPack provides the "External" generator, which allows +external packaging software to take advantage of some of the functionality +provided by CPack, such as component installation and the dependency graph. + +The CPack External generator doesn't actually package any files. Instead, it +generates a .json file containing the CPack internal metadata, which gives +external software information on how to package the software. This metadata +file contains a list of CPack components and component groups, the various +options passed to :command:`cpack_add_component` and +:command:`cpack_add_component_group`, the dependencies between the components +and component groups, and various other options passed to CPack. + +Format +^^^^^^ + +The file produced by the CPack External generator is a .json file with an +object as its root. This root object will always provide two fields: +``formatVersionMajor`` and ``formatVersionMinor``, which are always integers +that describe the output format of the generator. Backwards-compatible changes +to the output format (for example, adding a new field that didn't exist before) +cause the minor version to be incremented, and backwards-incompatible changes +(for example, deleting a field or changing its meaning) cause the major version +to be incremented and the minor version reset to 0. The format version is +always of the format ``major.minor``. In other words, it always has exactly two +parts, separated by a period. + +You can request one or more specific versions of the output format as described +below with :variable:`CPACK_EXT_REQUESTED_VERSIONS`. The output format will +have a major version that exactly matches the requested major version, and a +minor version that is greater than or equal to the requested minor version. If +no version is requested with :variable:`CPACK_EXT_REQUESTED_VERSIONS`, the +latest known major version is used by default. Currently, the only supported +format is 1.0, which is described below. + +Version 1.0 +*********** + +In addition to the standard format fields, format version 1.0 provides the +following fields in the root: + +``components`` + The ``components`` field is an object with component names as the keys and + objects describing the components as the values. The component objects have + the following fields: + + ``name`` + The name of the component. This is always the same as the key in the + ``components`` object. + + ``displayName`` + The value of the ``DISPLAY_NAME`` field passed to + :command:`cpack_add_component`. + + ``description`` + The value of the ``DESCRIPTION`` field passed to + :command:`cpack_add_component`. + + ``isHidden`` + True if ``HIDDEN`` was passed to :command:`cpack_add_component`, false if + it was not. + + ``isRequired`` + True if ``REQUIRED`` was passed to :command:`cpack_add_component`, false if + it was not. + + ``isDisabledByDefault`` + True if ``DISABLED`` was passed to :command:`cpack_add_component`, false if + it was not. + + ``group`` + Only present if ``GROUP`` was passed to :command:`cpack_add_component`. If + so, this field is a string value containing the component's group. + + ``dependencies`` + An array of components the component depends on. This contains the values + in the ``DEPENDS`` argument passed to :command:`cpack_add_component`. If no + ``DEPENDS`` argument was passed, this is an empty list. + + ``installationTypes`` + An array of installation types the component is part of. This contains the + values in the ``INSTALL_TYPES`` argument passed to + :command:`cpack_add_component`. If no ``INSTALL_TYPES`` argument was + passed, this is an empty list. + + ``isDownloaded`` + True if ``DOWNLOADED`` was passed to :command:`cpack_add_component`, false + if it was not. + + ``archiveFile`` + The name of the archive file passed with the ``ARCHIVE_FILE`` argument to + :command:`cpack_add_component`. If no ``ARCHIVE_FILE`` argument was passed, + this is an empty string. + +``componentGroups`` + The ``componentGroups`` field is an object with component group names as the + keys and objects describing the component groups as the values. The component + group objects have the following fields: + + ``name`` + The name of the component group. This is always the same as the key in the + ``componentGroups`` object. + + ``displayName`` + The value of the ``DISPLAY_NAME`` field passed to + :command:`cpack_add_component_group`. + + ``description`` + The value of the ``DESCRIPTION`` field passed to + :command:`cpack_add_component_group`. + + ``parentGroup`` + Only present if ``PARENT_GROUP`` was passed to + :command:`cpack_add_component_group`. If so, this field is a string value + containing the component group's parent group. + + ``isExpandedByDefault`` + True if ``EXPANDED`` was passed to :command:`cpack_add_component_group`, + false if it was not. + + ``isBold`` + True if ``BOLD_TITLE`` was passed to :command:`cpack_add_component_group`, + false if it was not. + + ``components`` + An array of names of components that are direct members of the group + (components that have this group as their ``GROUP``). Components of + subgroups are not included. + + ``subgroups`` + An array of names of component groups that are subgroups of the group + (groups that have this group as their ``PARENT_GROUP``). + +``installationTypes`` + The ``installationTypes`` field is an object with installation type names as + the keys and objects describing the installation types as the values. The + installation type objects have the following fields: + + ``name`` + The name of the installation type. This is always the same as the key in + the ``installationTypes`` object. + + ``displayName`` + The value of the ``DISPLAY_NAME`` field passed to + :command:`cpack_add_install_type`. + + ``index`` + The integer index of the installation type in the list. + +``projects`` + The ``projects`` field is an array of objects describing CMake projects which + comprise the CPack project. The values in this field are derived from + :variable:`CPACK_INSTALL_CMAKE_PROJECTS`. In most cases, this will be only a + single project. The project objects have the following fields: + + ``projectName`` + The project name passed to :variable:`CPACK_INSTALL_CMAKE_PROJECTS`. + + ``component`` + The name of the component or component set which comprises the project. + + ``directory`` + The build directory of the CMake project. This is the directory which + contains the ``cmake_install.cmake`` script. + + ``subDirectory`` + The subdirectory to install the project into inside the CPack package. + +``packageName`` + The package name given in :variable:`CPACK_PACKAGE_NAME`. Only present if + this option is set. + +``packageVersion`` + The package version given in :variable:`CPACK_PACKAGE_VERSION`. Only present + if this option is set. + +``packageDescriptionFile`` + The package description file given in + :variable:`CPACK_PACKAGE_DESCRIPTION_FILE`. Only present if this option is + set. + +``packageDescriptionSummary`` + The package description summary given in + :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`. Only present if this option is + set. + +``buildConfig`` + The build configuration given to CPack with the ``-C`` option. Only present + if this option is set. + +``defaultDirectoryPermissions`` + The default directory permissions given in + :variable:`CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS`. Only present if this + option is set. + +``setDestdir`` + True if :variable:`CPACK_SET_DESTDIR` is true, false if it is not. + +``packagingInstallPrefix`` + The install prefix given in :variable:`CPACK_PACKAGING_INSTALL_PREFIX`. Only + present if :variable:`CPACK_SET_DESTDIR` is true. + +``stripFiles`` + True if :variable:`CPACK_STRIP_FILES` is true, false if it is not. + +``warnOnAbsoluteInstallDestination`` + True if :variable:`CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION` is true, false + if it is not. + +``errorOnAbsoluteInstallDestination`` + True if :variable:`CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION` is true, + false if it is not. + +Variables specific to CPack External generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. variable:: CPACK_EXT_REQUESTED_VERSIONS + + This variable is used to request a specific version of the CPack External + generator. It is a list of ``major.minor`` values, separated by semicolons. + + If this variable is set to a non-empty value, the CPack External generator + will iterate through each item in the list to search for a version that it + knows how to generate. Requested versions should be listed in order of + descending preference by the client software, as the first matching version + in the list will be generated. + + The generator knows how to generate the version if it has a versioned + generator whose major version exactly matches the requested major version, + and whose minor version is greater than or equal to the requested minor + version. For example, if ``CPACK_EXT_REQUESTED_VERSIONS`` contains 1.0, and + the CPack External generator knows how to generate 1.1, it will generate 1.1. + If the generator doesn't know how to generate a version in the list, it skips + the version and looks at the next one. If it doesn't know how to generate any + of the requested versions, an error is thrown. + + If this variable is not set, or is empty, the CPack External generator will + generate the highest major and minor version that it knows how to generate. + + If an invalid version is encountered in ``CPACK_EXT_REQUESTED_VERSIONS`` (one + that doesn't match ``major.minor``, where ``major`` and ``minor`` are + integers), it is ignored. diff --git a/Help/cpack_gen/freebsd.rst b/Help/cpack_gen/freebsd.rst new file mode 100644 index 0000000..2419057 --- /dev/null +++ b/Help/cpack_gen/freebsd.rst @@ -0,0 +1,138 @@ +CPack FreeBSD Generator +----------------------- + +The built in (binary) CPack FreeBSD (pkg) generator (Unix only) + +Variables specific to CPack FreeBSD (pkg) generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The CPack FreeBSD generator may be used to create pkg(8) packages -- these may +be used on FreeBSD, DragonflyBSD, NetBSD, OpenBSD, but also on Linux or OSX, +depending on the installed package-management tools -- using :module:`CPack`. + +The CPack FreeBSD generator is a :module:`CPack` generator and uses the +``CPACK_XXX`` variables used by :module:`CPack`. It tries to re-use packaging +information that may already be specified for Debian packages for the +:cpack_gen:`CPack Deb Generator`. It also tries to re-use RPM packaging +information when Debian does not specify. + +The CPack FreeBSD generator should work on any host with libpkg installed. The +packages it produces are specific to the host architecture and ABI. + +The CPack FreeBSD generator sets package-metadata through +:code:`CPACK_FREEBSD_XXX` variables. The CPack FreeBSD generator, unlike the +CPack Deb generator, does not specially support componentized packages; a +single package is created from all the software artifacts created through +CMake. + +All of the variables can be set specifically for FreeBSD packaging in +the CPackConfig file or in CMakeLists.txt, but most of them have defaults +that use general settings (e.g. CMAKE_PROJECT_NAME) or Debian-specific +variables when those make sense (e.g. the homepage of an upstream project +is usually unchanged by the flavor of packaging). When there is no Debian +information to fall back on, but the RPM packaging has it, fall back to +the RPM information (e.g. package license). + +.. variable:: CPACK_FREEBSD_PACKAGE_NAME + + Sets the package name (in the package manifest, but also affects the + output filename). + + * Mandatory: YES + * Default: + + - :variable:`CPACK_PACKAGE_NAME` (this is always set by CPack itself, + based on CMAKE_PROJECT_NAME). + +.. variable:: CPACK_FREEBSD_PACKAGE_COMMENT + + Sets the package comment. This is the short description displayed by + pkg(8) in standard "pkg info" output. + + * Mandatory: YES + * Default: + + - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` (this is always set + by CPack itself, if nothing else sets it explicitly). + - :variable:`PROJECT_DESCRIPTION` (this can be set with the DESCRIPTION + parameter for :command:`project`). + +.. variable:: CPACK_FREEBSD_PACKAGE_DESCRIPTION + + Sets the package description. This is the long description of the package, + given by "pkg info" with a specific package as argument. + + * Mandatory: YES + * Default: + + - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` (this may be set already + for Debian packaging, so we may as well re-use it). + +.. variable:: CPACK_FREEBSD_PACKAGE_WWW + + The URL of the web site for this package, preferably (when applicable) the + site from which the original source can be obtained and any additional + upstream documentation or information may be found. + + * Mandatory: YES + * Default: + + - :variable:`CMAKE_PROJECT_HOMEPAGE_URL`, or if that is not set, + :variable:`CPACK_DEBIAN_PACKAGE_HOMEPAGE` (this may be set already + for Debian packaging, so we may as well re-use it). + +.. variable:: CPACK_FREEBSD_PACKAGE_LICENSE + + The license, or licenses, which apply to this software package. This must + be one or more license-identifiers that pkg recognizes as acceptable license + identifiers (e.g. "GPLv2"). + + * Mandatory: YES + * Default: + + - :variable:`CPACK_RPM_PACKAGE_LICENSE` + +.. variable:: CPACK_FREEBSD_PACKAGE_LICENSE_LOGIC + + This variable is only of importance if there is more than one license. + The default is "single", which is only applicable to a single license. + Other acceptable values are determined by pkg -- those are "dual" or "multi" -- + meaning choice (OR) or simultaneous (AND) application of the licenses. + + * Mandatory: NO + * Default: single + +.. variable:: CPACK_FREEBSD_PACKAGE_MAINTAINER + + The FreeBSD maintainer (e.g. kde@freebsd.org) of this package. + + * Mandatory: YES + * Default: none + +.. variable:: CPACK_FREEBSD_PACKAGE_ORIGIN + + The origin (ports label) of this package; for packages built by CPack + outside of the ports system this is of less importance. The default + puts the package somewhere under misc/, as a stopgap. + + * Mandatory: YES + * Default: misc/<package name> + +.. variable:: CPACK_FREEBSD_PACKAGE_CATEGORIES + + The ports categories where this package lives (if it were to be built + from ports). If none is set a single category is determined based on + the package origin. + + * Mandatory: YES + * Default: derived from ORIGIN + +.. variable:: CPACK_FREEBSD_PACKAGE_DEPS + + A list of package origins that should be added as package dependencies. + These are in the form <category>/<packagename>, e.g. x11/libkonq. + No version information needs to be provided (this is not included + in the manifest). + + * Mandatory: NO + * Default: empty diff --git a/Help/cpack_gen/ifw.rst b/Help/cpack_gen/ifw.rst new file mode 100644 index 0000000..68776e1 --- /dev/null +++ b/Help/cpack_gen/ifw.rst @@ -0,0 +1,335 @@ +CPack IFW Generator +------------------- + +See :module:`CPackIFW` for details on the CPackIFW module. + +.. _QtIFW: http://doc.qt.io/qtinstallerframework/index.html + + +Overview +^^^^^^^^ + +CPack ``IFW`` generator helps you to create online and offline +binary cross-platform installers with a graphical user interface. + +CPack IFW generator prepares project installation and generates configuration +and meta information for QtIFW_ tools. + +The QtIFW_ provides a set of tools and utilities to create +installers for the supported desktop Qt platforms: Linux, Microsoft Windows, +and Mac OS X. + +You should also install QtIFW_ to use CPack ``IFW`` generator. + +Hints +^^^^^ + +Generally, the CPack ``IFW`` generator automatically finds QtIFW_ tools, +but if you don't use a default path for installation of the QtIFW_ tools, +the path may be specified in either a CMake or an environment variable: + +.. variable:: CPACK_IFW_ROOT + + An CMake variable which specifies the location of the QtIFW_ tool suite. + + The variable will be cached in the ``CPackConfig.cmake`` file and used at + CPack runtime. + +.. variable:: QTIFWDIR + + An environment variable which specifies the location of the QtIFW_ tool + suite. + +.. note:: + The specified path should not contain "bin" at the end + (for example: "D:\\DevTools\\QtIFW2.0.5"). + +The :variable:`CPACK_IFW_ROOT` variable has a higher priority and overrides +the value of the :variable:`QTIFWDIR` variable. + +Internationalization +^^^^^^^^^^^^^^^^^^^^ + +Some variables and command arguments support internationalization via +CMake script. This is an optional feature. + +Installers created by QtIFW_ tools have built-in support for +internationalization and many phrases are localized to many languages, +but this does not apply to the description of the your components and groups +that will be distributed. + +Localization of the description of your components and groups is useful for +users of your installers. + +A localized variable or argument can contain a single default value, and a +set of pairs the name of the locale and the localized value. + +For example: + +.. code-block:: cmake + + set(LOCALIZABLE_VARIABLE "Default value" + en "English value" + en_US "American value" + en_GB "Great Britain value" + ) + +Variables +^^^^^^^^^ + +You can use the following variables to change behavior of CPack ``IFW`` +generator. + +Debug +""""" + +.. variable:: CPACK_IFW_VERBOSE + + Set to ``ON`` to enable addition debug output. + By default is ``OFF``. + +Package +""""""" + +.. variable:: CPACK_IFW_PACKAGE_TITLE + + Name of the installer as displayed on the title bar. + By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`. + +.. variable:: CPACK_IFW_PACKAGE_PUBLISHER + + Publisher of the software (as shown in the Windows Control Panel). + By default used :variable:`CPACK_PACKAGE_VENDOR`. + +.. variable:: CPACK_IFW_PRODUCT_URL + + URL to a page that contains product information on your web site. + +.. variable:: CPACK_IFW_PACKAGE_ICON + + Filename for a custom installer icon. The actual file is '.icns' (Mac OS X), + '.ico' (Windows). No functionality on Unix. + +.. variable:: CPACK_IFW_PACKAGE_WINDOW_ICON + + Filename for a custom window icon in PNG format for the Installer + application. + +.. variable:: CPACK_IFW_PACKAGE_LOGO + + Filename for a logo is used as QWizard::LogoPixmap. + +.. variable:: CPACK_IFW_PACKAGE_WATERMARK + + Filename for a watermark is used as QWizard::WatermarkPixmap. + +.. variable:: CPACK_IFW_PACKAGE_BANNER + + Filename for a banner is used as QWizard::BannerPixmap. + +.. variable:: CPACK_IFW_PACKAGE_BACKGROUND + + Filename for an image used as QWizard::BackgroundPixmap (only used by MacStyle). + +.. variable:: CPACK_IFW_PACKAGE_WIZARD_STYLE + + Wizard style to be used ("Modern", "Mac", "Aero" or "Classic"). + +.. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH + + Default width of the wizard in pixels. Setting a banner image will override this. + +.. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT + + Default height of the wizard in pixels. Setting a watermark image will override this. + +.. variable:: CPACK_IFW_PACKAGE_TITLE_COLOR + + Color of the titles and subtitles (takes an HTML color code, such as "#88FF33"). + +.. variable:: CPACK_IFW_PACKAGE_START_MENU_DIRECTORY + + Name of the default program group for the product in the Windows Start menu. + + By default used :variable:`CPACK_IFW_PACKAGE_NAME`. + +.. variable:: CPACK_IFW_TARGET_DIRECTORY + + Default target directory for installation. + By default used + "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`" + + You can use predefined variables. + +.. variable:: CPACK_IFW_ADMIN_TARGET_DIRECTORY + + Default target directory for installation with administrator rights. + + You can use predefined variables. + +.. variable:: CPACK_IFW_PACKAGE_GROUP + + The group, which will be used to configure the root package + +.. variable:: CPACK_IFW_PACKAGE_NAME + + The root package name, which will be used if configuration group is not + specified + +.. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME + + Filename of the generated maintenance tool. + The platform-specific executable file extension is appended. + + By default used QtIFW_ defaults (``maintenancetool``). + +.. variable:: CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR + + Set to ``OFF`` if the target directory should not be deleted when uninstalling. + + Is ``ON`` by default + +.. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE + + Filename for the configuration of the generated maintenance tool. + + By default used QtIFW_ defaults (``maintenancetool.ini``). + +.. variable:: CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS + + Set to ``ON`` if the installation path can contain non-ASCII characters. + + Is ``ON`` for QtIFW_ less 2.0 tools. + +.. variable:: CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH + + Set to ``OFF`` if the installation path cannot contain space characters. + + Is ``ON`` for QtIFW_ less 2.0 tools. + +.. variable:: CPACK_IFW_PACKAGE_CONTROL_SCRIPT + + Filename for a custom installer control script. + +.. variable:: CPACK_IFW_PACKAGE_RESOURCES + + List of additional resources ('.qrc' files) to include in the installer + binary. + + You can use :command:`cpack_ifw_add_package_resources` command to resolve + relative paths. + +.. variable:: CPACK_IFW_PACKAGE_FILE_EXTENSION + + The target binary extension. + + On Linux, the name of the target binary is automatically extended with + '.run', if you do not specify the extension. + + On Windows, the target is created as an application with the extension + '.exe', which is automatically added, if not supplied. + + On Mac, the target is created as an DMG disk image with the extension + '.dmg', which is automatically added, if not supplied. + +.. variable:: CPACK_IFW_REPOSITORIES_ALL + + The list of remote repositories. + + The default value of this variable is computed by CPack and contains + all repositories added with command :command:`cpack_ifw_add_repository` + or updated with command :command:`cpack_ifw_update_repository`. + +.. variable:: CPACK_IFW_DOWNLOAD_ALL + + If this is ``ON`` all components will be downloaded. + By default is ``OFF`` or used value + from ``CPACK_DOWNLOAD_ALL`` if set + +Components +"""""""""" + +.. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES + + Resolve duplicate names when installing components with groups. + +.. variable:: CPACK_IFW_PACKAGES_DIRECTORIES + + Additional prepared packages dirs that will be used to resolve + dependent components. + +.. variable:: CPACK_IFW_REPOSITORIES_DIRECTORIES + + Additional prepared repository dirs that will be used to resolve and + repack dependent components. This feature available only + since QtIFW_ 3.1. + +Tools +""""" + +.. variable:: CPACK_IFW_FRAMEWORK_VERSION + + The version of used QtIFW_ tools. + +.. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE + + The path to "binarycreator" command line client. + + This variable is cached and may be configured if needed. + +.. variable:: CPACK_IFW_REPOGEN_EXECUTABLE + + The path to "repogen" command line client. + + This variable is cached and may be configured if needed. + +.. variable:: CPACK_IFW_INSTALLERBASE_EXECUTABLE + + The path to "installerbase" installer executable base. + + This variable is cached and may be configured if needed. + +.. variable:: CPACK_IFW_DEVTOOL_EXECUTABLE + + The path to "devtool" command line client. + + This variable is cached and may be configured if needed. + + +Online installer +^^^^^^^^^^^^^^^^ + +By default CPack IFW generator makes offline installer. This means that all +components will be packaged into a binary file. + +To make a component downloaded, you must set the ``DOWNLOADED`` option in +:command:`cpack_add_component`. + +Then you would use the command :command:`cpack_configure_downloads`. +If you set ``ALL`` option all components will be downloaded. + +You also can use command :command:`cpack_ifw_add_repository` and +variable :variable:`CPACK_IFW_DOWNLOAD_ALL` for more specific configuration. + +CPack IFW generator creates "repository" dir in current binary dir. You +would copy content of this dir to specified ``site`` (``url``). + +See Also +^^^^^^^^ + +Qt Installer Framework Manual: + +* Index page: + http://doc.qt.io/qtinstallerframework/index.html + +* Component Scripting: + http://doc.qt.io/qtinstallerframework/scripting.html + +* Predefined Variables: + http://doc.qt.io/qtinstallerframework/scripting.html#predefined-variables + +* Promoting Updates: + http://doc.qt.io/qtinstallerframework/ifw-updates.html + +Download Qt Installer Framework for you platform from Qt site: + http://download.qt.io/official_releases/qt-installer-framework diff --git a/Help/cpack_gen/nsis.rst b/Help/cpack_gen/nsis.rst new file mode 100644 index 0000000..9f82a04 --- /dev/null +++ b/Help/cpack_gen/nsis.rst @@ -0,0 +1,130 @@ +CPack NSIS Generator +-------------------- + +CPack NSIS generator specific options + +Variables specific to CPack NSIS generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following variables are specific to the graphical installers built +on Windows using the Nullsoft Installation System. + +.. variable:: CPACK_NSIS_INSTALL_ROOT + + The default installation directory presented to the end user by the NSIS + installer is under this root dir. The full directory presented to the end + user is: ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY} + +.. variable:: CPACK_NSIS_MUI_ICON + + An icon filename. The name of a ``*.ico`` file used as the main icon for the + generated install program. + +.. variable:: CPACK_NSIS_MUI_UNIICON + + An icon filename. The name of a ``*.ico`` file used as the main icon for the + generated uninstall program. + +.. variable:: CPACK_NSIS_INSTALLER_MUI_ICON_CODE + + undocumented. + +.. variable:: CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP + + The filename of a bitmap to use as the NSIS MUI_WELCOMEFINISHPAGE_BITMAP. + +.. variable:: CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP + + The filename of a bitmap to use as the NSIS MUI_UNWELCOMEFINISHPAGE_BITMAP. + +.. variable:: CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS + + Extra NSIS commands that will be added to the beginning of the install + Section, before your install tree is available on the target system. + +.. variable:: CPACK_NSIS_EXTRA_INSTALL_COMMANDS + + Extra NSIS commands that will be added to the end of the install Section, + after your install tree is available on the target system. + +.. variable:: CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS + + Extra NSIS commands that will be added to the uninstall Section, before + your install tree is removed from the target system. + +.. variable:: CPACK_NSIS_COMPRESSOR + + The arguments that will be passed to the NSIS SetCompressor command. + +.. variable:: CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL + + Ask about uninstalling previous versions first. If this is set to "ON", + then an installer will look for previous installed versions and if one is + found, ask the user whether to uninstall it before proceeding with the + install. + +.. variable:: CPACK_NSIS_MODIFY_PATH + + Modify PATH toggle. If this is set to "ON", then an extra page will appear + in the installer that will allow the user to choose whether the program + directory should be added to the system PATH variable. + +.. variable:: CPACK_NSIS_DISPLAY_NAME + + The display name string that appears in the Windows Add/Remove Program + control panel + +.. variable:: CPACK_NSIS_PACKAGE_NAME + + The title displayed at the top of the installer. + +.. variable:: CPACK_NSIS_INSTALLED_ICON_NAME + + A path to the executable that contains the installer icon. + +.. variable:: CPACK_NSIS_HELP_LINK + + URL to a web site providing assistance in installing your application. + +.. variable:: CPACK_NSIS_URL_INFO_ABOUT + + URL to a web site providing more information about your application. + +.. variable:: CPACK_NSIS_CONTACT + + Contact information for questions and comments about the installation + process. + +.. variable:: CPACK_NSIS_<compName>_INSTALL_DIRECTORY + + Custom install directory for the specified component <compName> instead + of $INSTDIR. + +.. variable:: CPACK_NSIS_CREATE_ICONS_EXTRA + + Additional NSIS commands for creating start menu shortcuts. + +.. variable:: CPACK_NSIS_DELETE_ICONS_EXTRA + + Additional NSIS commands to uninstall start menu shortcuts. + +.. variable:: CPACK_NSIS_EXECUTABLES_DIRECTORY + + Creating NSIS start menu links assumes that they are in 'bin' unless this + variable is set. For example, you would set this to 'exec' if your + executables are in an exec directory. + +.. variable:: CPACK_NSIS_MUI_FINISHPAGE_RUN + + Specify an executable to add an option to run on the finish page of the + NSIS installer. + +.. variable:: CPACK_NSIS_MENU_LINKS + + Specify links in [application] menu. This should contain a list of pair + "link" "link name". The link may be a URL or a path relative to + installation prefix. Like:: + + set(CPACK_NSIS_MENU_LINKS + "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html" + "CMake Help" "https://cmake.org" "CMake Web Site") diff --git a/Help/cpack_gen/nuget.rst b/Help/cpack_gen/nuget.rst new file mode 100644 index 0000000..c8c481f --- /dev/null +++ b/Help/cpack_gen/nuget.rst @@ -0,0 +1,189 @@ +CPack NuGet Generator +--------------------- + +When build a NuGet package 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 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The CPack NuGet generator may be used to create NuGet packages using +:module:`CPack`. The CPack NuGet generator is a :module:`CPack` generator thus +it uses the ``CPACK_XXX`` variables used by :module:`CPack`. + +The CPack NuGet generator 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 CPack NuGet generator specific variables: + +.. variable:: CPACK_NUGET_COMPONENT_INSTALL + + Enable component packaging for CPack NuGet generator + + * 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 CPack NuGet generator. + + * 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 diff --git a/Help/cpack_gen/packagemaker.rst b/Help/cpack_gen/packagemaker.rst new file mode 100644 index 0000000..f9abdd8 --- /dev/null +++ b/Help/cpack_gen/packagemaker.rst @@ -0,0 +1,23 @@ +CPack PackageMaker Generator +---------------------------- + +PackageMaker CPack generator (Mac OS X). + +Variables specific to CPack PackageMaker generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following variable is specific to installers built on Mac +OS X using PackageMaker: + +.. variable:: CPACK_OSX_PACKAGE_VERSION + + The version of Mac OS X that the resulting PackageMaker archive should be + compatible with. Different versions of Mac OS X support different + features. For example, CPack can only build component-based installers for + Mac OS X 10.4 or newer, and can only build installers that download + component son-the-fly for Mac OS X 10.5 or newer. If left blank, this value + will be set to the minimum version of Mac OS X that supports the requested + features. Set this variable to some value (e.g., 10.4) only if you want to + guarantee that your installer will work on that version of Mac OS X, and + don't mind missing extra features available in the installer shipping with + later versions of Mac OS X. diff --git a/Help/cpack_gen/productbuild.rst b/Help/cpack_gen/productbuild.rst new file mode 100644 index 0000000..1a6e0f8 --- /dev/null +++ b/Help/cpack_gen/productbuild.rst @@ -0,0 +1,68 @@ +CPack productbuild Generator +---------------------------- + +productbuild CPack generator (Mac OS X). + +Variables specific to CPack productbuild generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following variable is specific to installers built on Mac +OS X using ProductBuild: + +.. variable:: CPACK_COMMAND_PRODUCTBUILD + + Path to the productbuild(1) command used to generate a product archive for + the OS X Installer or Mac App Store. This variable can be used to override + the automatically detected command (or specify its location if the + auto-detection fails to find it.) + +.. variable:: CPACK_PRODUCTBUILD_IDENTITY_NAME + + Adds a digital signature to the resulting package. + + +.. variable:: CPACK_PRODUCTBUILD_KEYCHAIN_PATH + + Specify a specific keychain to search for the signing identity. + + +.. variable:: CPACK_COMMAND_PKGBUILD + + Path to the pkgbuild(1) command used to generate an OS X component package + on OS X. This variable can be used to override the automatically detected + command (or specify its location if the auto-detection fails to find it.) + + +.. variable:: CPACK_PKGBUILD_IDENTITY_NAME + + Adds a digital signature to the resulting package. + + +.. variable:: CPACK_PKGBUILD_KEYCHAIN_PATH + + Specify a specific keychain to search for the signing identity. + + +.. variable:: CPACK_PREFLIGHT_<COMP>_SCRIPT + + Full path to a file that will be used as the ``preinstall`` script for the + named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased + component name. No ``preinstall`` script is added if this variable is not + defined for a given component. + + +.. variable:: CPACK_POSTFLIGHT_<COMP>_SCRIPT + + Full path to a file that will be used as the ``postinstall`` script for the + named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased + component name. No ``postinstall`` script is added if this variable is not + defined for a given component. + + +.. variable:: CPACK_PRODUCTBUILD_RESOURCES_DIR + + If specified the productbuild generator copies files from this directory + (including subdirectories) to the ``Resources`` directory. This is done + before the :variable:`CPACK_RESOURCE_FILE_WELCOME`, + :variable:`CPACK_RESOURCE_FILE_README`, and + :variable:`CPACK_RESOURCE_FILE_LICENSE` files are copied. diff --git a/Help/cpack_gen/rpm.rst b/Help/cpack_gen/rpm.rst new file mode 100644 index 0000000..0214766 --- /dev/null +++ b/Help/cpack_gen/rpm.rst @@ -0,0 +1,955 @@ +CPack RPM Generator +------------------- + +The built in (binary) CPack RPM generator (Unix only) + +Variables specific to CPack RPM generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The CPack RPM generator may be used to create RPM packages using :module:`CPack`. +The CPack RPM generator is a :module:`CPack` generator thus it uses the +``CPACK_XXX`` variables used by :module:`CPack`. + +The CPack RPM generator has specific features which are controlled by the specifics +:code:`CPACK_RPM_XXX` variables. + +:code:`CPACK_RPM_<COMPONENT>_XXXX` variables may be used in order to have +**component** specific values. Note however that ``<COMPONENT>`` refers to the +**grouping name** written in upper case. It may be either a component name or +a component GROUP name. Usually those variables correspond to RPM spec file +entities. One may find information about spec files here +http://www.rpm.org/wiki/Docs + +.. note:: + + `<COMPONENT>` part of variables is preferred to be in upper case (for e.g. if + component is named `foo` then use `CPACK_RPM_FOO_XXXX` variable name format) + as is with other `CPACK_<COMPONENT>_XXXX` variables. + For the purposes of back compatibility (CMake/CPack version 3.5 and lower) + support for same cased component (e.g. `fOo` would be used as + `CPACK_RPM_fOo_XXXX`) is still supported for variables defined in older + versions of CMake/CPack but is not guaranteed for variables that + will be added in the future. For the sake of back compatibility same cased + component variables also override upper cased versions where both are + present. + +Here are some CPack RPM generator wiki resources that are here for historic reasons and +are no longer maintained but may still prove useful: + + - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration + - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#rpm-unix-only + +List of CPack RPM generator specific variables: + +.. variable:: CPACK_RPM_COMPONENT_INSTALL + + Enable component packaging for CPack RPM generator + + * Mandatory : NO + * Default : OFF + + If enabled (ON) multiple packages are generated. By default a single package + containing files of all components is generated. + +.. variable:: CPACK_RPM_PACKAGE_SUMMARY + CPACK_RPM_<component>_PACKAGE_SUMMARY + + The RPM package summary. + + * Mandatory : YES + * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` + +.. variable:: CPACK_RPM_PACKAGE_NAME + CPACK_RPM_<component>_PACKAGE_NAME + + The RPM package name. + + * Mandatory : YES + * Default : :variable:`CPACK_PACKAGE_NAME` + +.. variable:: CPACK_RPM_FILE_NAME + CPACK_RPM_<component>_FILE_NAME + + Package file name. + + * Mandatory : YES + * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].rpm`` with spaces + replaced by '-' + + This may be set to ``RPM-DEFAULT`` to allow rpmbuild tool to generate package + file name by itself. + Alternatively provided package file name must end with ``.rpm`` suffix. + + .. note:: + + By using user provided spec file, rpm macro extensions such as for + generating debuginfo packages or by simply using multiple components more + than one rpm file may be generated, either from a single spec file or from + multiple spec files (each component execution produces it's own spec file). + In such cases duplicate file names may occur as a result of this variable + setting or spec file content structure. Duplicate files get overwritten + and it is up to the packager to set the variables in a manner that will + prevent such errors. + +.. variable:: CPACK_RPM_MAIN_COMPONENT + + Main component that is packaged without component suffix. + + * Mandatory : NO + * Default : - + + This variable can be set to any component or group name so that component or + group rpm package is generated without component suffix in filename and + package name. + +.. variable:: CPACK_RPM_PACKAGE_EPOCH + + The RPM package epoch + + * Mandatory : No + * Default : - + + Optional number that should be incremented when changing versioning schemas + or fixing mistakes in the version numbers of older packages. + +.. variable:: CPACK_RPM_PACKAGE_VERSION + + The RPM package version. + + * Mandatory : YES + * Default : :variable:`CPACK_PACKAGE_VERSION` + +.. variable:: CPACK_RPM_PACKAGE_ARCHITECTURE + CPACK_RPM_<component>_PACKAGE_ARCHITECTURE + + The RPM package architecture. + + * Mandatory : YES + * Default : Native architecture output by ``uname -m`` + + This may be set to ``noarch`` if you know you are building a noarch package. + +.. variable:: CPACK_RPM_PACKAGE_RELEASE + + The RPM package release. + + * Mandatory : YES + * Default : 1 + + This is the numbering of the RPM package itself, i.e. the version of the + packaging and not the version of the content (see + :variable:`CPACK_RPM_PACKAGE_VERSION`). One may change the default value if + the previous packaging was buggy and/or you want to put here a fancy Linux + distro specific numbering. + +.. note:: + + This is the string that goes into the RPM ``Release:`` field. Some distros + (e.g. Fedora, CentOS) require ``1%{?dist}`` format and not just a number. + ``%{?dist}`` part can be added by setting :variable:`CPACK_RPM_PACKAGE_RELEASE_DIST`. + +.. variable:: CPACK_RPM_PACKAGE_RELEASE_DIST + + The dist tag that is added RPM ``Release:`` field. + + * Mandatory : NO + * Default : OFF + + This is the reported ``%{dist}`` tag from the current distribution or empty + ``%{dist}`` if RPM macro is not set. If this variable is set then RPM + ``Release:`` field value is set to ``${CPACK_RPM_PACKAGE_RELEASE}%{?dist}``. + +.. variable:: CPACK_RPM_PACKAGE_LICENSE + + The RPM package license policy. + + * Mandatory : YES + * Default : "unknown" + +.. variable:: CPACK_RPM_PACKAGE_GROUP + CPACK_RPM_<component>_PACKAGE_GROUP + + The RPM package group. + + * Mandatory : YES + * Default : "unknown" + +.. variable:: CPACK_RPM_PACKAGE_VENDOR + + The RPM package vendor. + + * Mandatory : YES + * Default : CPACK_PACKAGE_VENDOR if set or "unknown" + +.. variable:: CPACK_RPM_PACKAGE_URL + CPACK_RPM_<component>_PACKAGE_URL + + The projects URL. + + * Mandatory : NO + * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL` + +.. variable:: CPACK_RPM_PACKAGE_DESCRIPTION + CPACK_RPM_<component>_PACKAGE_DESCRIPTION + + RPM package description. + + * Mandatory : YES + * Default : :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION` (component + based installers only) if set, :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` + if set or "no package description available" + +.. variable:: CPACK_RPM_COMPRESSION_TYPE + + RPM compression type. + + * Mandatory : NO + * Default : - + + May be used to override RPM compression type to be used to build the + RPM. For example some Linux distribution now default to lzma or xz + compression whereas older cannot use such RPM. Using this one can enforce + compression type to be used. + + Possible values are: + + - lzma + - xz + - bzip2 + - gzip + +.. variable:: CPACK_RPM_PACKAGE_AUTOREQ + CPACK_RPM_<component>_PACKAGE_AUTOREQ + + RPM spec autoreq field. + + * Mandatory : NO + * Default : - + + May be used to enable (1, yes) or disable (0, no) automatic shared libraries + dependency detection. Dependencies are added to requires list. + + .. note:: + + By default automatic dependency detection is enabled by rpm generator. + +.. variable:: CPACK_RPM_PACKAGE_AUTOPROV + CPACK_RPM_<component>_PACKAGE_AUTOPROV + + RPM spec autoprov field. + + * Mandatory : NO + * Default : - + + May be used to enable (1, yes) or disable (0, no) automatic listing of shared + libraries that are provided by the package. Shared libraries are added to + provides list. + + .. note:: + + By default automatic provides detection is enabled by rpm generator. + +.. variable:: CPACK_RPM_PACKAGE_AUTOREQPROV + CPACK_RPM_<component>_PACKAGE_AUTOREQPROV + + RPM spec autoreqprov field. + + * Mandatory : NO + * Default : - + + Variable enables/disables autoreq and autoprov at the same time. + See :variable:`CPACK_RPM_PACKAGE_AUTOREQ` and :variable:`CPACK_RPM_PACKAGE_AUTOPROV` + for more details. + + .. note:: + + By default automatic detection feature is enabled by rpm. + +.. variable:: CPACK_RPM_PACKAGE_REQUIRES + CPACK_RPM_<component>_PACKAGE_REQUIRES + + RPM spec requires field. + + * Mandatory : NO + * Default : - + + May be used to set RPM dependencies (requires). Note that you must enclose + the complete requires string between quotes, for example:: + + set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8") + + The required package list of an RPM file could be printed with:: + + rpm -qp --requires file.rpm + +.. variable:: CPACK_RPM_PACKAGE_CONFLICTS + CPACK_RPM_<component>_PACKAGE_CONFLICTS + + RPM spec conflicts field. + + * Mandatory : NO + * Default : - + + May be used to set negative RPM dependencies (conflicts). Note that you must + enclose the complete requires string between quotes, for example:: + + set(CPACK_RPM_PACKAGE_CONFLICTS "libxml2") + + The conflicting package list of an RPM file could be printed with:: + + rpm -qp --conflicts file.rpm + +.. variable:: CPACK_RPM_PACKAGE_REQUIRES_PRE + CPACK_RPM_<component>_PACKAGE_REQUIRES_PRE + + RPM spec requires(pre) field. + + * Mandatory : NO + * Default : - + + May be used to set RPM preinstall dependencies (requires(pre)). Note that + you must enclose the complete requires string between quotes, for example:: + + set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts") + +.. variable:: CPACK_RPM_PACKAGE_REQUIRES_POST + CPACK_RPM_<component>_PACKAGE_REQUIRES_POST + + RPM spec requires(post) field. + + * Mandatory : NO + * Default : - + + May be used to set RPM postinstall dependencies (requires(post)). Note that + you must enclose the complete requires string between quotes, for example:: + + set(CPACK_RPM_PACKAGE_REQUIRES_POST "shadow-utils, initscripts") + +.. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN + CPACK_RPM_<component>_PACKAGE_REQUIRES_POSTUN + + RPM spec requires(postun) field. + + * Mandatory : NO + * Default : - + + May be used to set RPM postuninstall dependencies (requires(postun)). Note + that you must enclose the complete requires string between quotes, for + example:: + + set(CPACK_RPM_PACKAGE_REQUIRES_POSTUN "shadow-utils, initscripts") + +.. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN + CPACK_RPM_<component>_PACKAGE_REQUIRES_PREUN + + RPM spec requires(preun) field. + + * Mandatory : NO + * Default : - + + May be used to set RPM preuninstall dependencies (requires(preun)). Note that + you must enclose the complete requires string between quotes, for example:: + + set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts") + +.. variable:: CPACK_RPM_PACKAGE_SUGGESTS + CPACK_RPM_<component>_PACKAGE_SUGGESTS + + RPM spec suggest field. + + * Mandatory : NO + * Default : - + + May be used to set weak RPM dependencies (suggests). Note that you must + enclose the complete requires string between quotes. + +.. variable:: CPACK_RPM_PACKAGE_PROVIDES + CPACK_RPM_<component>_PACKAGE_PROVIDES + + RPM spec provides field. + + * Mandatory : NO + * Default : - + + May be used to set RPM dependencies (provides). The provided package list + of an RPM file could be printed with:: + + rpm -qp --provides file.rpm + +.. variable:: CPACK_RPM_PACKAGE_OBSOLETES + CPACK_RPM_<component>_PACKAGE_OBSOLETES + + RPM spec obsoletes field. + + * Mandatory : NO + * Default : - + + May be used to set RPM packages that are obsoleted by this one. + +.. variable:: CPACK_RPM_PACKAGE_RELOCATABLE + + build a relocatable RPM. + + * Mandatory : NO + * Default : CPACK_PACKAGE_RELOCATABLE + + If this variable is set to TRUE or ON, the CPack RPM generator will try + to build a relocatable RPM package. A relocatable RPM may + be installed using:: + + rpm --prefix or --relocate + + in order to install it at an alternate place see rpm(8). Note that + currently this may fail if :variable:`CPACK_SET_DESTDIR` is set to ``ON``. If + :variable:`CPACK_SET_DESTDIR` is set then you will get a warning message but + if there is file installed with absolute path you'll get unexpected behavior. + +.. variable:: CPACK_RPM_SPEC_INSTALL_POST + + Deprecated - use :variable:`CPACK_RPM_SPEC_MORE_DEFINE` instead. + + * Mandatory : NO + * Default : - + * Deprecated: YES + + 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 + + RPM extended spec definitions lines. + + * Mandatory : NO + * Default : - + + 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 + + Toggle CPack RPM generator debug output. + + * Mandatory : NO + * Default : - + + May be set when invoking cpack in order to trace debug information + during CPack RPM run. For example you may launch CPack like this:: + + cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM + +.. variable:: CPACK_RPM_USER_BINARY_SPECFILE + CPACK_RPM_<componentName>_USER_BINARY_SPECFILE + + A user provided spec file. + + * Mandatory : NO + * Default : - + + May be set by the user in order to specify a USER binary spec file + to be used by the CPack RPM generator instead of generating the file. + The specified file will be processed by configure_file( @ONLY). + +.. variable:: CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE + + Spec file template. + + * Mandatory : NO + * Default : - + + If set CPack will generate a template for USER specified binary + spec file and stop with an error. For example launch CPack like this:: + + cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM + + The user may then use this file in order to hand-craft is own + binary spec file which may be used with + :variable:`CPACK_RPM_USER_BINARY_SPECFILE`. + +.. variable:: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE + CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE + + Path to file containing pre (un)install script. + + * Mandatory : NO + * Default : - + + May be used to embed a pre (un)installation script in the spec file. + The referred script file (or both) will be read and directly + put after the ``%pre`` or ``%preun`` section + If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install + script for each component can be overridden with + ``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE`` and + ``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``. + One may verify which scriptlet has been included with:: + + rpm -qp --scripts package.rpm + +.. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE + CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE + + Path to file containing post (un)install script. + + * Mandatory : NO + * Default : - + + May be used to embed a post (un)installation script in the spec file. + The referred script file (or both) will be read and directly + put after the ``%post`` or ``%postun`` section. + If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install + script for each component can be overridden with + ``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE`` and + ``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``. + One may verify which scriptlet has been included with:: + + rpm -qp --scripts package.rpm + +.. variable:: CPACK_RPM_USER_FILELIST + CPACK_RPM_<COMPONENT>_USER_FILELIST + + * Mandatory : NO + * Default : - + + May be used to explicitly specify ``%(<directive>)`` file line + in the spec file. Like ``%config(noreplace)`` or any other directive + that be found in the ``%files`` section. You can have multiple directives + per line, as in ``%attr(600,root,root) %config(noreplace)``. Since + the CPack RPM generator is generating the list of files (and directories) the + user specified files of the ``CPACK_RPM_<COMPONENT>_USER_FILELIST`` list will + be removed from the generated list. If referring to directories do + not add a trailing slash. + +.. variable:: CPACK_RPM_CHANGELOG_FILE + + RPM changelog file. + + * Mandatory : NO + * Default : - + + May be used to embed a changelog in the spec file. + The referred file will be read and directly put after the ``%changelog`` + section. + +.. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST + + list of path to be excluded. + + * Mandatory : NO + * Default : /etc /etc/init.d /usr /usr/bin /usr/include /usr/lib + /usr/libx32 /usr/lib64 /usr/share /usr/share/aclocal + /usr/share/doc + + May be used to exclude path (directories or files) from the auto-generated + list of paths discovered by CPack RPM. The default value contains a + reasonable set of values if the variable is not defined by the user. If the + variable is defined by the user then the CPack RPM generator will NOT any of + the default path. If you want to add some path to the default list then you + can use :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION` variable. + +.. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION + + additional list of path to be excluded. + + * Mandatory : NO + * Default : - + + May be used to add more exclude path (directories or files) from the initial + default list of excluded paths. See + :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST`. + +.. variable:: CPACK_RPM_RELOCATION_PATHS + + Packages relocation paths list. + + * Mandatory : NO + * Default : - + + May be used to specify more than one relocation path per relocatable RPM. + Variable contains a list of relocation paths that if relative are prefixed + by the value of :variable:`CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX` or by the + value of :variable:`CPACK_PACKAGING_INSTALL_PREFIX` if the component version + is not provided. + Variable is not component based as its content can be used to set a different + path prefix for e.g. binary dir and documentation dir at the same time. + Only prefixes that are required by a certain component are added to that + component - component must contain at least one file/directory/symbolic link + with :variable:`CPACK_RPM_RELOCATION_PATHS` prefix for a certain relocation + path to be added. Package will not contain any relocation paths if there are + no files/directories/symbolic links on any of the provided prefix locations. + Packages that either do not contain any relocation paths or contain + files/directories/symbolic links that are outside relocation paths print + out an ``AUTHOR_WARNING`` that RPM will be partially relocatable. + +.. variable:: CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX + + Per component relocation path install prefix. + + * Mandatory : NO + * Default : CPACK_PACKAGING_INSTALL_PREFIX + + May be used to set per component :variable:`CPACK_PACKAGING_INSTALL_PREFIX` + for relocatable RPM packages. + +.. variable:: CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION + CPACK_RPM_NO_<COMPONENT>_INSTALL_PREFIX_RELOCATION + + Removal of default install prefix from relocation paths list. + + * Mandatory : NO + * Default : CPACK_PACKAGING_INSTALL_PREFIX or CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX + are treated as one of relocation paths + + May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX + from relocatable RPM prefix paths. + +.. variable:: CPACK_RPM_ADDITIONAL_MAN_DIRS + + * Mandatory : NO + * Default : - + + May be used to set additional man dirs that could potentially be compressed + by brp-compress RPM macro. Variable content must be a list of regular + expressions that point to directories containing man files or to man files + directly. Note that in order to compress man pages a path must also be + present in brp-compress RPM script and that brp-compress script must be + added to RPM configuration by the operating system. + + Regular expressions that are added by default were taken from brp-compress + RPM macro: + + - /usr/man/man.* + - /usr/man/.*/man.* + - /usr/info.* + - /usr/share/man/man.* + - /usr/share/man/.*/man.* + - /usr/share/info.* + - /usr/kerberos/man.* + - /usr/X11R6/man/man.* + - /usr/lib/perl5/man/man.* + - /usr/share/doc/.*/man/man.* + - /usr/lib/.*/man/man.* + +.. variable:: CPACK_RPM_DEFAULT_USER + CPACK_RPM_<compName>_DEFAULT_USER + + default user ownership of RPM content + + * Mandatory : NO + * Default : root + + Value should be user name and not UID. + Note that <compName> must be in upper-case. + +.. variable:: CPACK_RPM_DEFAULT_GROUP + CPACK_RPM_<compName>_DEFAULT_GROUP + + default group ownership of RPM content + + * Mandatory : NO + * Default : root + + Value should be group name and not GID. + Note that <compName> must be in upper-case. + +.. variable:: CPACK_RPM_DEFAULT_FILE_PERMISSIONS + CPACK_RPM_<compName>_DEFAULT_FILE_PERMISSIONS + + default permissions used for packaged files + + * Mandatory : NO + * Default : - (system default) + + Accepted values are lists with ``PERMISSIONS``. Valid permissions + are: + + - OWNER_READ + - OWNER_WRITE + - OWNER_EXECUTE + - GROUP_READ + - GROUP_WRITE + - GROUP_EXECUTE + - WORLD_READ + - WORLD_WRITE + - WORLD_EXECUTE + + Note that <compName> must be in upper-case. + +.. variable:: CPACK_RPM_DEFAULT_DIR_PERMISSIONS + CPACK_RPM_<compName>_DEFAULT_DIR_PERMISSIONS + + default permissions used for packaged directories + + * Mandatory : NO + * Default : - (system default) + + Accepted values are lists with PERMISSIONS. Valid permissions + are the same as for :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`. + Note that <compName> must be in upper-case. + +.. variable:: CPACK_RPM_INSTALL_WITH_EXEC + + force execute permissions on programs and shared libraries + + * Mandatory : NO + * Default : - (system default) + + Force set owner, group and world execute permissions on programs and shared + libraries. This can be used for creating valid rpm packages on systems such + as Debian where shared libraries do not have execute permissions set. + +.. note:: + + Programs and shared libraries without execute permissions are ignored during + separation of debug symbols from the binary for debuginfo packages. + +Packaging of Symbolic Links +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The CPack RPM generator supports packaging of symbolic links:: + + execute_process(COMMAND ${CMAKE_COMMAND} + -E create_symlink <relative_path_location> <symlink_name>) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/<symlink_name> + DESTINATION <symlink_location> COMPONENT libraries) + +Symbolic links will be optimized (paths will be shortened if possible) +before being added to the package or if multiple relocation paths are +detected, a post install symlink relocation script will be generated. + +Symbolic links may point to locations that are not packaged by the same +package (either a different component or even not packaged at all) but +those locations will be treated as if they were a part of the package +while determining if symlink should be either created or present in a +post install script - depending on relocation paths. + +Symbolic links that point to locations outside packaging path produce a +warning and are treated as non relocatable permanent symbolic links. + +Currently there are a few limitations though: + +* For component based packaging component interdependency is not checked + when processing symbolic links. Symbolic links pointing to content of + a different component are treated the same way as if pointing to location + that will not be packaged. + +* Symbolic links pointing to a location through one or more intermediate + symbolic links will not be handled differently - if the intermediate + symbolic link(s) is also on a relocatable path, relocating it during + package installation may cause initial symbolic link to point to an + invalid location. + +Packaging of debug information +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Debuginfo packages contain debug symbols and sources for debugging packaged +binaries. + +Debuginfo RPM packaging has it's own set of variables: + +.. variable:: CPACK_RPM_DEBUGINFO_PACKAGE + CPACK_RPM_<component>_DEBUGINFO_PACKAGE + + Enable generation of debuginfo RPM package(s). + + * Mandatory : NO + * Default : OFF + +.. note:: + + Binaries must contain debug symbols before packaging so use either ``Debug`` + or ``RelWithDebInfo`` for :variable:`CMAKE_BUILD_TYPE` variable value. + +.. note:: + + Packages generated from packages without binary files, with binary files but + without execute permissions or without debug symbols will cause packaging + termination. + +.. variable:: CPACK_BUILD_SOURCE_DIRS + + Provides locations of root directories of source files from which binaries + were built. + + * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set + * Default : - + +.. note:: + + For CMake project :variable:`CPACK_BUILD_SOURCE_DIRS` is set by default to + point to :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR` paths. + +.. note:: + + Sources with path prefixes that do not fall under any location provided with + :variable:`CPACK_BUILD_SOURCE_DIRS` will not be present in debuginfo package. + +.. variable:: CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX + CPACK_RPM_<component>_BUILD_SOURCE_DIRS_PREFIX + + Prefix of location where sources will be placed during package installation. + + * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set + * Default : "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>" and + for component packaging "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>-<component>" + +.. note:: + + Each source path prefix is additionally suffixed by ``src_<index>`` where + index is index of the path used from :variable:`CPACK_BUILD_SOURCE_DIRS` + variable. This produces ``<CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX>/src_<index>`` + replacement path. + Limitation is that replaced path part must be shorter or of equal + length than the length of its replacement. If that is not the case either + :variable:`CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX` variable has to be set to + a shorter path or source directories must be placed on a longer path. + +.. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS + + Directories containing sources that should be excluded from debuginfo packages. + + * Mandatory : NO + * Default : "/usr /usr/src /usr/src/debug" + + Listed paths are owned by other RPM packages and should therefore not be + deleted on debuginfo package uninstallation. + +.. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION + + Paths that should be appended to :variable:`CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS` + for exclusion. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE + + Create a single debuginfo package even if components packaging is set. + + * Mandatory : NO + * Default : OFF + + When this variable is enabled it produces a single debuginfo package even if + component packaging is enabled. + + When using this feature in combination with components packaging and there is + more than one component this variable requires :variable:`CPACK_RPM_MAIN_COMPONENT` + to be set. + +.. note:: + + If none of the :variable:`CPACK_RPM_<component>_DEBUGINFO_PACKAGE` variables + is set then :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is automatically set to + ``ON`` when :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` is set. + +.. variable:: CPACK_RPM_DEBUGINFO_FILE_NAME + CPACK_RPM_<component>_DEBUGINFO_FILE_NAME + + Debuginfo package file name. + + * Mandatory : NO + * Default : rpmbuild tool generated package file name + + Alternatively provided debuginfo package file name must end with ``.rpm`` + suffix and should differ from file names of other generated packages. + + Variable may contain ``@cpack_component@`` placeholder which will be + replaced by component name if component packaging is enabled otherwise it + deletes the placeholder. + + Setting the variable to ``RPM-DEFAULT`` may be used to explicitly set + filename generation to default. + +.. note:: + + :variable:`CPACK_RPM_FILE_NAME` also supports rpmbuild tool generated package + file name - disabled by default but can be enabled by setting the variable to + ``RPM-DEFAULT``. + +Packaging of sources (SRPM) +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +SRPM packaging is enabled by setting :variable:`CPACK_RPM_PACKAGE_SOURCES` +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 produced by executing:: + + cpack -G RPM --config ./CPackSourceConfig.cmake + +.. note:: + + Produced SRPM package is expected to be built with :manual:`cmake(1)` executable + and packaged with :manual:`cpack(1)` executable so CMakeLists.txt has to be + located in root source directory and must be able to generate binary rpm + packages by executing ``cpack -G`` command. The two executables as well as + rpmbuild must also be present when generating binary rpm packages from the + produced SRPM package. + +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:: + + 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. + +.. note:: + + SRPM package internally uses CPack/RPM generator to generate binary packages + so CMakeScripts.txt can decide during the SRPM to binary rpm generation step + what content the package(s) should have as well as how they should be packaged + (monolithic or components). CMake can decide this for e.g. by reading environment + variables set by the package manager before starting the process of generating + binary rpm packages. This way a single SRPM package can be used to produce + different binary rpm packages on different platforms depending on the platform's + packaging rules. + +Source RPM packaging has it's own set of variables: + +.. variable:: CPACK_RPM_PACKAGE_SOURCES + + Should the content be packaged as a source rpm (default is binary rpm). + + * Mandatory : NO + * Default : OFF + +.. note:: + + For cmake projects :variable:`CPACK_RPM_PACKAGE_SOURCES` variable is set + to ``OFF`` in CPackConfig.cmake and ``ON`` in CPackSourceConfig.cmake + generated files. + +.. variable:: CPACK_RPM_SOURCE_PKG_BUILD_PARAMS + + Additional command-line parameters provided to :manual:`cmake(1)` executable. + + * Mandatory : NO + * Default : - + +.. variable:: CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX + + Packaging install prefix that would be provided in :variable:`CPACK_PACKAGING_INSTALL_PREFIX` + variable for producing binary RPM packages. + + * Mandatory : YES + * Default : "/" + +.. VARIABLE:: CPACK_RPM_BUILDREQUIRES + + List of source rpm build dependencies. + + * Mandatory : NO + * Default : - + + May be used to set source RPM build dependencies (BuildRequires). Note that + you must enclose the complete build requirements string between quotes, for + example:: + + set(CPACK_RPM_BUILDREQUIRES "python >= 2.5.0, cmake >= 2.8") diff --git a/Help/cpack_gen/wix.rst b/Help/cpack_gen/wix.rst new file mode 100644 index 0000000..3822fa0 --- /dev/null +++ b/Help/cpack_gen/wix.rst @@ -0,0 +1,284 @@ +CPack WiX Generator +------------------- + +CPack WiX generator specific options + +Variables specific to CPack WiX generator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following variables are specific to the installers built on +Windows using WiX. + +.. variable:: CPACK_WIX_UPGRADE_GUID + + Upgrade GUID (``Product/@UpgradeCode``) + + Will be automatically generated unless explicitly provided. + + It should be explicitly set to a constant generated globally unique + identifier (GUID) to allow your installers to replace existing + installations that use the same GUID. + + You may for example explicitly set this variable in your + CMakeLists.txt to the value that has been generated per default. You + should not use GUIDs that you did not generate yourself or which may + belong to other projects. + + A GUID shall have the following fixed length syntax:: + + XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + + (each X represents an uppercase hexadecimal digit) + +.. variable:: CPACK_WIX_PRODUCT_GUID + + Product GUID (``Product/@Id``) + + Will be automatically generated unless explicitly provided. + + If explicitly provided this will set the Product Id of your installer. + + The installer will abort if it detects a pre-existing installation that + uses the same GUID. + + The GUID shall use the syntax described for CPACK_WIX_UPGRADE_GUID. + +.. variable:: CPACK_WIX_LICENSE_RTF + + RTF License File + + If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension it is used as-is. + + If CPACK_RESOURCE_FILE_LICENSE has an .txt extension it is implicitly + converted to RTF by the WiX Generator. + The expected encoding of the .txt file is UTF-8. + + With CPACK_WIX_LICENSE_RTF you can override the license file used by the + WiX Generator in case CPACK_RESOURCE_FILE_LICENSE is in an unsupported + format or the .txt -> .rtf conversion does not work as expected. + +.. variable:: CPACK_WIX_PRODUCT_ICON + + The Icon shown next to the program name in Add/Remove programs. + + If set, this icon is used in place of the default icon. + +.. variable:: CPACK_WIX_UI_REF + + This variable allows you to override the Id of the ``<UIRef>`` element + in the WiX template. + + The default is ``WixUI_InstallDir`` in case no CPack components have + been defined and ``WixUI_FeatureTree`` otherwise. + +.. variable:: CPACK_WIX_UI_BANNER + + The bitmap will appear at the top of all installer pages other than the + welcome and completion dialogs. + + If set, this image will replace the default banner image. + + This image must be 493 by 58 pixels. + +.. variable:: CPACK_WIX_UI_DIALOG + + Background bitmap used on the welcome and completion dialogs. + + If this variable is set, the installer will replace the default dialog + image. + + This image must be 493 by 312 pixels. + +.. variable:: CPACK_WIX_PROGRAM_MENU_FOLDER + + Start menu folder name for launcher. + + If this variable is not set, it will be initialized with CPACK_PACKAGE_NAME + +.. variable:: CPACK_WIX_CULTURES + + Language(s) of the installer + + Languages are compiled into the WixUI extension library. To use them, + simply provide the name of the culture. If you specify more than one + culture identifier in a comma or semicolon delimited list, the first one + that is found will be used. You can find a list of supported languages at: + http://wix.sourceforge.net/manual-wix3/WixUI_localization.htm + +.. variable:: CPACK_WIX_TEMPLATE + + Template file for WiX generation + + If this variable is set, the specified template will be used to generate + the WiX wxs file. This should be used if further customization of the + output is required. + + If this variable is not set, the default MSI template included with CMake + will be used. + +.. variable:: CPACK_WIX_PATCH_FILE + + Optional list of XML files with fragments to be inserted into + generated WiX sources + + This optional variable can be used to specify an XML file that the + WiX generator will use to inject fragments into its generated + source files. + + Patch files understood by the CPack WiX generator + roughly follow this RELAX NG compact schema: + + .. code-block:: none + + start = CPackWiXPatch + + CPackWiXPatch = element CPackWiXPatch { CPackWiXFragment* } + + CPackWiXFragment = element CPackWiXFragment + { + attribute Id { string }, + fragmentContent* + } + + fragmentContent = element * - CPackWiXFragment + { + (attribute * { text } | text | fragmentContent)* + } + + Currently fragments can be injected into most + Component, File, Directory and Feature elements. + + The following additional special Ids can be used: + + * ``#PRODUCT`` for the ``<Product>`` element. + * ``#PRODUCTFEATURE`` for the root ``<Feature>`` element. + + The following example illustrates how this works. + + Given that the WiX generator creates the following XML element: + + .. code-block:: xml + + <Component Id="CM_CP_applications.bin.my_libapp.exe" Guid="*"/> + + The following XML patch file may be used to inject an Environment element + into it: + + .. code-block:: xml + + <CPackWiXPatch> + <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe"> + <Environment Id="MyEnvironment" Action="set" + Name="MyVariableName" Value="MyVariableValue"/> + </CPackWiXFragment> + </CPackWiXPatch> + +.. variable:: CPACK_WIX_EXTRA_SOURCES + + Extra WiX source files + + This variable provides an optional list of extra WiX source files (.wxs) + that should be compiled and linked. The full path to source files is + required. + +.. variable:: CPACK_WIX_EXTRA_OBJECTS + + Extra WiX object files or libraries + + This variable provides an optional list of extra WiX object (.wixobj) + and/or WiX library (.wixlib) files. The full path to objects and libraries + is required. + +.. variable:: CPACK_WIX_EXTENSIONS + + This variable provides a list of additional extensions for the WiX + tools light and candle. + +.. variable:: CPACK_WIX_<TOOL>_EXTENSIONS + + This is the tool specific version of CPACK_WIX_EXTENSIONS. + ``<TOOL>`` can be either LIGHT or CANDLE. + +.. variable:: CPACK_WIX_<TOOL>_EXTRA_FLAGS + + This list variable allows you to pass additional + flags to the WiX tool ``<TOOL>``. + + Use it at your own risk. + Future versions of CPack may generate flags which may be in conflict + with your own flags. + + ``<TOOL>`` can be either LIGHT or CANDLE. + +.. variable:: CPACK_WIX_CMAKE_PACKAGE_REGISTRY + + If this variable is set the generated installer will create + an entry in the windows registry key + ``HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<package>`` + The value for ``<package>`` is provided by this variable. + + Assuming you also install a CMake configuration file this will + allow other CMake projects to find your package with + the :command:`find_package` command. + +.. variable:: CPACK_WIX_PROPERTY_<PROPERTY> + + This variable can be used to provide a value for + the Windows Installer property ``<PROPERTY>`` + + The following list contains some example properties that can be used to + customize information under + "Programs and Features" (also known as "Add or Remove Programs") + + * ARPCOMMENTS - Comments + * ARPHELPLINK - Help and support information URL + * ARPURLINFOABOUT - General information URL + * ARPURLUPDATEINFO - Update information URL + * ARPHELPTELEPHONE - Help and support telephone number + * ARPSIZE - Size (in kilobytes) of the application + +.. variable:: CPACK_WIX_ROOT_FEATURE_TITLE + + Sets the name of the root install feature in the WIX installer. Same as + CPACK_COMPONENT_<compName>_DISPLAY_NAME for components. + +.. variable:: CPACK_WIX_ROOT_FEATURE_DESCRIPTION + + Sets the description of the root install feature in the WIX installer. Same as + CPACK_COMPONENT_<compName>_DESCRIPTION for components. + +.. variable:: CPACK_WIX_SKIP_PROGRAM_FOLDER + + If this variable is set to true, the default install location + of the generated package will be CPACK_PACKAGE_INSTALL_DIRECTORY directly. + The install location will not be located relatively below + ProgramFiles or ProgramFiles64. + + .. note:: + Installers created with this feature do not take differences + between the system on which the installer is created + and the system on which the installer might be used into account. + + It is therefore possible that the installer e.g. might try to install + onto a drive that is unavailable or unintended or a path that does not + follow the localization or convention of the system on which the + installation is performed. + +.. variable:: CPACK_WIX_ROOT_FOLDER_ID + + This variable allows specification of a custom root folder ID. + The generator specific ``<64>`` token can be used for + folder IDs that come in 32-bit and 64-bit variants. + In 32-bit builds the token will expand empty while in 64-bit builds + it will expand to ``64``. + + When unset generated installers will default installing to + ``ProgramFiles<64>Folder``. + +.. variable:: CPACK_WIX_ROOT + + This variable can optionally be set to the root directory + of a custom WiX Toolset installation. + + When unspecified CPack will try to locate a WiX Toolset + installation via the ``WIX`` environment variable instead. diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 4d31690..1b4960d 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -3,12 +3,48 @@ Green Hills MULTI Generates Green Hills MULTI project files (experimental, work-in-progress). -Customizations are available through the following cache variables: +Customizations that are used to pick toolset and target system: + +The ``-A <arch>`` can be supplied for setting the target architecture. +``<arch>`` usually is one of "arm", "ppc", "86", etcetera. If the target architecture +is not specified then the default architecture of "arm" will be used. + +The ``-T <toolset>`` can be supplied for setting the toolset to be used. +All toolsets are expected to be located at ``GHS_TOOLSET_ROOT``. +If the toolset is not specified then the latest toolset will be used. + +* ``GHS_TARGET_PLATFORM`` + +Default to ``integrity``. +Usual values are ``integrity``, ``threadx``, ``uvelosity``, +``velosity``, ``vxworks``, ``standalone``. + +* ``GHS_PRIMARY_TARGET`` + +Sets ``primaryTarget`` field in project file. +Defaults to ``<arch>_<GHS_TARGET_PLATFORM>.tgt``. + +* ``GHS_TOOLSET_ROOT`` + +Default to ``C:/ghs``. Root path for ``toolset``. + +* ``GHS_OS_ROOT`` + +Default to ``C:/ghs``. Root path for RTOS searches. + +* ``GHS_OS_DIR`` + +Default to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if +a specific RTOS is to be used. * ``GHS_BSP_NAME`` + +Defaults to ``sim<arch>`` if not set by user. + +Customizations are available through the following cache variables: + * ``GHS_CUSTOMIZATION`` * ``GHS_GPJ_MACROS`` -* ``GHS_OS_DIR`` .. note:: This generator is deemed experimental as of CMake |release| diff --git a/Help/index.rst b/Help/index.rst index fa5273c..fe1b73c 100644 --- a/Help/index.rst +++ b/Help/index.rst @@ -41,6 +41,7 @@ Reference Manuals /manual/cmake-server.7 /manual/cmake-toolchains.7 /manual/cmake-variables.7 + /manual/cpack-generators.7 .. only:: html or text diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 49375e9..dd7934a 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -784,7 +784,7 @@ A *library* output artifact of a buildsystem target may be: with the ``MODULE`` option. * On non-DLL platforms: the shared library file (e.g. ``.so`` or ``.dylib``) - of a shared shared library target created by the :command:`add_library` + of a shared library target created by the :command:`add_library` command with the ``SHARED`` option. The :prop_tgt:`LIBRARY_OUTPUT_DIRECTORY` and :prop_tgt:`LIBRARY_OUTPUT_NAME` diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index 408a3a0..753647d 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -78,6 +78,7 @@ These commands are available only in CMake projects. /command/add_dependencies /command/add_executable /command/add_library + /command/add_link_options /command/add_subdirectory /command/add_test /command/aux_source_directory @@ -111,6 +112,7 @@ These commands are available only in CMake projects. /command/target_compile_options /command/target_include_directories /command/target_link_libraries + /command/target_link_options /command/target_sources /command/try_compile /command/try_run diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 8ef4d7d..b7276b6 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -54,22 +54,10 @@ All Modules /module/CMakePrintSystemInformation /module/CMakePushCheckState /module/CMakeVerifyManifest - /module/CPackArchive - /module/CPackBundle /module/CPackComponent - /module/CPackCygwin - /module/CPackDeb - /module/CPackDMG - /module/CPackFreeBSD /module/CPackIFW /module/CPackIFWConfigureFile - /module/CPackNSIS - /module/CPackNuGet - /module/CPackPackageMaker - /module/CPackProductBuild - /module/CPackRPM /module/CPack - /module/CPackWIX /module/CSharpUtilities /module/CTest /module/CTestCoverageCollectGCOV @@ -263,3 +251,26 @@ All Modules /module/Use_wxWindows /module/WriteBasicConfigVersionFile /module/WriteCompilerDetectionHeader + +Legacy CPack Modules +==================== + +These modules used to be mistakenly exposed to the user, and have been moved +out of user visibility. They are for CPack internal use, and should never be +used directly. + +.. toctree:: + :maxdepth: 1 + + /module/CPackArchive + /module/CPackBundle + /module/CPackCygwin + /module/CPackDeb + /module/CPackDMG + /module/CPackFreeBSD + /module/CPackNSIS + /module/CPackNuGet + /module/CPackPackageMaker + /module/CPackProductBuild + /module/CPackRPM + /module/CPackWIX diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 631f75b..b2eeb3a 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -51,6 +51,15 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used to determine whether to report an error on use of deprecated macros or functions. +Policies Introduced by CMake 3.13 +================================= + +.. toctree:: + :maxdepth: 1 + + CMP0077: option() honors normal variables. </policy/CMP0077> + CMP0076: target_sources() command converts relative paths to absolute. </policy/CMP0076> + Policies Introduced by CMake 3.12 ================================= diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 9f9c53f..274206f 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -77,6 +77,7 @@ Properties on Directories /prop_dir/INTERPROCEDURAL_OPTIMIZATION /prop_dir/LABELS /prop_dir/LINK_DIRECTORIES + /prop_dir/LINK_OPTIONS /prop_dir/LISTFILE_STACK /prop_dir/MACROS /prop_dir/PARENT_DIRECTORY @@ -172,6 +173,7 @@ Properties on Targets /prop_tgt/DEBUG_POSTFIX /prop_tgt/DEFINE_SYMBOL /prop_tgt/DEPLOYMENT_REMOTE_DIRECTORY + /prop_tgt/DEPLOYMENT_ADDITIONAL_FILES /prop_tgt/DOTNET_TARGET_FRAMEWORK_VERSION /prop_tgt/EchoString /prop_tgt/ENABLE_EXPORTS @@ -197,6 +199,7 @@ Properties on Targets /prop_tgt/IMPORTED_LIBNAME_CONFIG /prop_tgt/IMPORTED_LIBNAME /prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG + /prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES_CONFIG /prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES /prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES_CONFIG /prop_tgt/IMPORTED_LINK_INTERFACE_LANGUAGES @@ -224,7 +227,9 @@ Properties on Targets /prop_tgt/INTERFACE_COMPILE_FEATURES /prop_tgt/INTERFACE_COMPILE_OPTIONS /prop_tgt/INTERFACE_INCLUDE_DIRECTORIES + /prop_tgt/INTERFACE_LINK_DEPENDS /prop_tgt/INTERFACE_LINK_LIBRARIES + /prop_tgt/INTERFACE_LINK_OPTIONS /prop_tgt/INTERFACE_POSITION_INDEPENDENT_CODE /prop_tgt/INTERFACE_SOURCES /prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES @@ -254,6 +259,7 @@ Properties on Targets /prop_tgt/LINK_INTERFACE_MULTIPLICITY_CONFIG /prop_tgt/LINK_INTERFACE_MULTIPLICITY /prop_tgt/LINK_LIBRARIES + /prop_tgt/LINK_OPTIONS /prop_tgt/LINK_SEARCH_END_STATIC /prop_tgt/LINK_SEARCH_START_STATIC /prop_tgt/LINK_WHAT_YOU_USE @@ -300,8 +306,10 @@ Properties on Targets /prop_tgt/VERSION /prop_tgt/VISIBILITY_INLINES_HIDDEN /prop_tgt/VS_CONFIGURATION_TYPE - /prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY /prop_tgt/VS_DEBUGGER_COMMAND + /prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS + /prop_tgt/VS_DEBUGGER_ENVIRONMENT + /prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY /prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION /prop_tgt/VS_DOTNET_REFERENCE_refname /prop_tgt/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index f6bf0bd..48b1f20 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -291,6 +291,7 @@ Variables that Control the Build /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_AUTOGEN_PARALLEL + /variable/CMAKE_AUTOGEN_VERBOSE /variable/CMAKE_AUTOMOC /variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES /variable/CMAKE_AUTOMOC_DEPEND_FILTERS @@ -461,6 +462,8 @@ Variables for Languages /variable/CMAKE_LANG_LIBRARY_ARCHITECTURE /variable/CMAKE_LANG_LINKER_PREFERENCE /variable/CMAKE_LANG_LINKER_PREFERENCE_PROPAGATES + /variable/CMAKE_LANG_LINKER_WRAPPER_FLAG + /variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP /variable/CMAKE_LANG_LINK_EXECUTABLE /variable/CMAKE_LANG_OUTPUT_EXTENSION /variable/CMAKE_LANG_PLATFORM_ID diff --git a/Help/manual/cpack-generators.7.rst b/Help/manual/cpack-generators.7.rst new file mode 100644 index 0000000..ade9149 --- /dev/null +++ b/Help/manual/cpack-generators.7.rst @@ -0,0 +1,29 @@ +.. cmake-manual-description: CPack Generator Reference + +cpack-generators(7) +******************* + +.. only:: html + + .. contents:: + +Generators +========== + +.. toctree:: + :maxdepth: 1 + + /cpack_gen/archive + /cpack_gen/bundle + /cpack_gen/cygwin + /cpack_gen/deb + /cpack_gen/dmg + /cpack_gen/external + /cpack_gen/freebsd + /cpack_gen/ifw + /cpack_gen/nsis + /cpack_gen/nuget + /cpack_gen/packagemaker + /cpack_gen/productbuild + /cpack_gen/rpm + /cpack_gen/wix diff --git a/Help/module/CPackArchive.rst b/Help/module/CPackArchive.rst index eb8d9d2..8616098 100644 --- a/Help/module/CPackArchive.rst +++ b/Help/module/CPackArchive.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackArchive.cmake +CPackArchive +------------ + +The documentation for the CPack Archive generator has moved here: :cpack_gen:`CPack Archive Generator` diff --git a/Help/module/CPackBundle.rst b/Help/module/CPackBundle.rst index 651e874..5134884 100644 --- a/Help/module/CPackBundle.rst +++ b/Help/module/CPackBundle.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackBundle.cmake +CPackBundle +----------- + +The documentation for the CPack Bundle generator has moved here: :cpack_gen:`CPack Bundle Generator` diff --git a/Help/module/CPackCygwin.rst b/Help/module/CPackCygwin.rst index 21f4473..719dfce 100644 --- a/Help/module/CPackCygwin.rst +++ b/Help/module/CPackCygwin.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackCygwin.cmake +CPackCygwin +----------- + +The documentation for the CPack Cygwin generator has moved here: :cpack_gen:`CPack Cygwin Generator` diff --git a/Help/module/CPackDMG.rst b/Help/module/CPackDMG.rst index 784262c..a597002 100644 --- a/Help/module/CPackDMG.rst +++ b/Help/module/CPackDMG.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackDMG.cmake +CPackDMG +-------- + +The documentation for the CPack DMG generator has moved here: :cpack_gen:`CPack DMG Generator` diff --git a/Help/module/CPackDeb.rst b/Help/module/CPackDeb.rst index d1526ee..73e59a2 100644 --- a/Help/module/CPackDeb.rst +++ b/Help/module/CPackDeb.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackDeb.cmake +CPackDeb +-------- + +The documentation for the CPack Deb generator has moved here: :cpack_gen:`CPack Deb Generator` diff --git a/Help/module/CPackFreeBSD.rst b/Help/module/CPackFreeBSD.rst index 083f0cb..69701b8 100644 --- a/Help/module/CPackFreeBSD.rst +++ b/Help/module/CPackFreeBSD.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackFreeBSD.cmake +CPackFreeBSD +------------ + +The documentation for the CPack FreeBSD generator has moved here: :cpack_gen:`CPack FreeBSD Generator` diff --git a/Help/module/CPackNSIS.rst b/Help/module/CPackNSIS.rst index bb35ed6..2cb407a 100644 --- a/Help/module/CPackNSIS.rst +++ b/Help/module/CPackNSIS.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackNSIS.cmake +CPackNSIS +--------- + +The documentation for the CPack NSIS generator has moved here: :cpack_gen:`CPack NSIS Generator` diff --git a/Help/module/CPackNuGet.rst b/Help/module/CPackNuGet.rst index a4cbb59..4f39b3a 100644 --- a/Help/module/CPackNuGet.rst +++ b/Help/module/CPackNuGet.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackNuGet.cmake +CPackNuGet +---------- + +The documentation for the CPack NuGet generator has moved here: :cpack_gen:`CPack NuGet Generator` diff --git a/Help/module/CPackPackageMaker.rst b/Help/module/CPackPackageMaker.rst index de55448..226b6fd 100644 --- a/Help/module/CPackPackageMaker.rst +++ b/Help/module/CPackPackageMaker.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackPackageMaker.cmake +CPackPackageMaker +----------------- + +The documentation for the CPack PackageMaker generator has moved here: :cpack_gen:`CPack PackageMaker Generator` diff --git a/Help/module/CPackProductBuild.rst b/Help/module/CPackProductBuild.rst index 6081fe4..8cd9198 100644 --- a/Help/module/CPackProductBuild.rst +++ b/Help/module/CPackProductBuild.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackProductBuild.cmake +CPackProductBuild +----------------- + +The documentation for the CPack productbuild generator has moved here: :cpack_gen:`CPack productbuild Generator` diff --git a/Help/module/CPackRPM.rst b/Help/module/CPackRPM.rst index 28d0e69..00b7e0a 100644 --- a/Help/module/CPackRPM.rst +++ b/Help/module/CPackRPM.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackRPM.cmake +CPackRPM +-------- + +The documentation for the CPack RPM generator has moved here: :cpack_gen:`CPack RPM Generator` diff --git a/Help/module/CPackWIX.rst b/Help/module/CPackWIX.rst index 1f5e451..e1d4a03 100644 --- a/Help/module/CPackWIX.rst +++ b/Help/module/CPackWIX.rst @@ -1 +1,4 @@ -.. cmake-module:: ../../Modules/CPackWIX.cmake +CPackWIX +-------- + +The documentation for the CPack WiX generator has moved here: :cpack_gen:`CPack WiX Generator` diff --git a/Help/policy/CMP0076.rst b/Help/policy/CMP0076.rst new file mode 100644 index 0000000..dd25f80 --- /dev/null +++ b/Help/policy/CMP0076.rst @@ -0,0 +1,26 @@ +CMP0076 +------- + +The :command:`target_sources` command converts relative paths to absolute. + +In CMake 3.13 and above, the :command:`target_sources` command now converts +relative source file paths to absolute paths in the following cases: + +* Source files are added to the target's :prop_tgt:`INTERFACE_SOURCES` + property. +* The target's :prop_tgt:`SOURCE_DIR` property differs from + :variable:`CMAKE_CURRENT_SOURCE_DIR`. + +A path that begins with a generator expression is always left unmodified. + +This policy provides compatibility with projects that have not been updated +to expect this behavior. The ``OLD`` behavior for this policy is to leave +all relative source file paths unmodified. The ``NEW`` behavior of this +policy is to convert relative paths to absolute according to above rules. + +This policy was introduced in CMake version 3.13. CMake version +|release| warns when the policy is not set and uses ``OLD`` behavior. +Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` +explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/policy/CMP0077.rst b/Help/policy/CMP0077.rst new file mode 100644 index 0000000..8efe198 --- /dev/null +++ b/Help/policy/CMP0077.rst @@ -0,0 +1,16 @@ +CMP0077 +------- + +:command:`option` honors normal variables. + +The ``OLD`` behavior for this policy is to clear any existing normal variables +with the same name. The ``NEW`` behavior for this policy is to not create +a cache entry or modify any existing normal variables if a normal variable +with the same name already exists. + +This policy was introduced in CMake version 3.13. CMake version +|release| warns when the policy is not set and uses ``OLD`` behavior. +Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` +explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/prop_dir/LINK_OPTIONS.rst b/Help/prop_dir/LINK_OPTIONS.rst new file mode 100644 index 0000000..04b9e08 --- /dev/null +++ b/Help/prop_dir/LINK_OPTIONS.rst @@ -0,0 +1,16 @@ +LINK_OPTIONS +------------ + +List of options to use for the link step. + +This property holds a :ref:`;-list <CMake Language Lists>` of options +given so far to the :command:`add_link_options` command. + +This property is used to initialize the :prop_tgt:`LINK_OPTIONS` target +property when a target is created, which is used by the generators to set +the options for the compiler. + +Contents of ``LINK_OPTIONS`` may use "generator expressions" with the +syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual +for available expressions. See the :manual:`cmake-buildsystem(7)` manual +for more on defining buildsystem properties. diff --git a/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst b/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst new file mode 100644 index 0000000..5e9c191 --- /dev/null +++ b/Help/prop_tgt/DEPLOYMENT_ADDITIONAL_FILES.rst @@ -0,0 +1,18 @@ +DEPLOYMENT_ADDITIONAL_FILES +--------------------------- + +Set the WinCE project ``AdditionalFiles`` in ``DeploymentTool`` in ``.vcproj`` +files generated by the :generator:`Visual Studio 9 2008` generator. +This is useful when you want to debug on remote WinCE device. +Specify additional files that will be copied to the device. +For example: + +.. code-block:: cmake + + set_property(TARGET ${TARGET} PROPERTY + DEPLOYMENT_ADDITIONAL_FILES "english.lng|local_folder|remote_folder|0" + "german.lng|local_folder|remote_folder|0") + +produces:: + + <DeploymentTool AdditionalFiles="english.lng|local_folder|remote_folder|0;german.lng|local_folder|remote_folder|0" ... /> diff --git a/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst b/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst new file mode 100644 index 0000000..d07f8ea --- /dev/null +++ b/Help/prop_tgt/INTERFACE_LINK_DEPENDS.rst @@ -0,0 +1,31 @@ +INTERFACE_LINK_DEPENDS +---------------------- + +Additional public interface files on which a target binary depends for linking. + +This property is supported only by Makefile and Ninja generators. It is +intended to specify dependencies on "linker scripts" for custom Makefile link +rules. + +When target dependencies are specified using :command:`target_link_libraries`, +CMake will read this property from all target dependencies to determine the +build properties of the consumer. + +Contents of ``INTERFACE_LINK_DEPENDS`` may use "generator expressions" +with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. See the :manual:`cmake-buildsystem(7)` +-manual for more on defining buildsystem properties. + +Link dependency files usage requirements commonly differ between the build-tree +and the install-tree. The ``BUILD_INTERFACE`` and ``INSTALL_INTERFACE`` +generator expressions can be used to describe separate usage requirements +based on the usage location. Relative paths are allowed within the +``INSTALL_INTERFACE`` expression and are interpreted relative to the +installation prefix. For example: + +.. code-block:: cmake + + set_property(TARGET mylib PROPERTY INTERFACE_LINK_DEPENDS + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/mylinkscript> + $<INSTALL_INTERFACE:mylinkscript> # <prefix>/mylinkscript + ) diff --git a/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst b/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst new file mode 100644 index 0000000..c293b98 --- /dev/null +++ b/Help/prop_tgt/INTERFACE_LINK_OPTIONS.rst @@ -0,0 +1,9 @@ +INTERFACE_LINK_OPTIONS +---------------------- + +.. |property_name| replace:: link options +.. |command_name| replace:: :command:`target_link_options` +.. |PROPERTY_INTERFACE_NAME| replace:: ``INTERFACE_LINK_OPTIONS`` +.. |PROPERTY_LINK| replace:: :prop_tgt:`LINK_OPTIONS` +.. |PROPERTY_GENEX| replace:: ``$<TARGET_PROPERTY:foo,INTERFACE_LINK_OPTIONS>`` +.. include:: INTERFACE_BUILD_PROPERTY.txt diff --git a/Help/prop_tgt/LINK_DEPENDS.rst b/Help/prop_tgt/LINK_DEPENDS.rst index 5576b85..3ab8658 100644 --- a/Help/prop_tgt/LINK_DEPENDS.rst +++ b/Help/prop_tgt/LINK_DEPENDS.rst @@ -7,6 +7,11 @@ Specifies a semicolon-separated list of full-paths to files on which the link rule for this target depends. The target binary will be linked if any of the named files is newer than it. -This property is ignored by non-Makefile generators. It is intended -to specify dependencies on "linker scripts" for custom Makefile link +This property is supported only by Makefile and Ninja generators. It is +intended to specify dependencies on "linker scripts" for custom Makefile link rules. + +Contents of ``LINK_DEPENDS`` may use "generator expressions" with +the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. See the :manual:`cmake-buildsystem(7)` +manual for more on defining buildsystem properties. diff --git a/Help/prop_tgt/LINK_FLAGS.rst b/Help/prop_tgt/LINK_FLAGS.rst index b09e7c1..e0b72b5 100644 --- a/Help/prop_tgt/LINK_FLAGS.rst +++ b/Help/prop_tgt/LINK_FLAGS.rst @@ -3,7 +3,11 @@ LINK_FLAGS Additional flags to use when linking this target. -The LINK_FLAGS property can be used to add extra flags to the link -step of a target. :prop_tgt:`LINK_FLAGS_<CONFIG>` will add to the +The LINK_FLAGS property, managed as a string, can be used to add extra flags +to the link step of a target. :prop_tgt:`LINK_FLAGS_<CONFIG>` will add to the configuration ``<CONFIG>``, for example, ``DEBUG``, ``RELEASE``, ``MINSIZEREL``, ``RELWITHDEBINFO``, ... + +.. note:: + + This property has been superseded by :prop_tgt:`LINK_OPTIONS` property. diff --git a/Help/prop_tgt/LINK_FLAGS_CONFIG.rst b/Help/prop_tgt/LINK_FLAGS_CONFIG.rst index ba7adc8..1f2910b 100644 --- a/Help/prop_tgt/LINK_FLAGS_CONFIG.rst +++ b/Help/prop_tgt/LINK_FLAGS_CONFIG.rst @@ -4,3 +4,7 @@ LINK_FLAGS_<CONFIG> Per-configuration linker flags for a target. This is the configuration-specific version of LINK_FLAGS. + +.. note:: + + This property has been superseded by :prop_tgt:`LINK_OPTIONS` property. diff --git a/Help/prop_tgt/LINK_OPTIONS.rst b/Help/prop_tgt/LINK_OPTIONS.rst new file mode 100644 index 0000000..c5263a2 --- /dev/null +++ b/Help/prop_tgt/LINK_OPTIONS.rst @@ -0,0 +1,21 @@ +LINK_OPTIONS +------------ + +List of options to use when linking this target. + +This property holds a :ref:`;-list <CMake Language Lists>` of options +specified so far for its target. Use the :command:`target_link_options` +command to append more options. + +This property is initialized by the :prop_dir:`LINK_OPTIONS` directory +property when a target is created, and is used by the generators to set +the options for the compiler. + +Contents of ``LINK_OPTIONS`` may use "generator expressions" with the +syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual +for available expressions. See the :manual:`cmake-buildsystem(7)` manual +for more on defining buildsystem properties. + +.. note:: + + This property must be used in preference to :prop_tgt:`LINK_FLAGS` property. diff --git a/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst index f898750..ba5fd0a 100644 --- a/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst +++ b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst @@ -2,6 +2,8 @@ VS_DEBUGGER_COMMAND ------------------- Sets the local debugger command for Visual Studio C++ targets. +The property value may use +:manual:`generator expressions <cmake-generator-expressions(7)>`. This is defined in ``<LocalDebuggerCommand>`` in the Visual Studio project file. diff --git a/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst b/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst new file mode 100644 index 0000000..06ef5d5 --- /dev/null +++ b/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst @@ -0,0 +1,11 @@ +VS_DEBUGGER_COMMAND_ARGUMENTS +----------------------------- + +Sets the local debugger command line arguments for Visual Studio C++ targets. +The property value may use +:manual:`generator expressions <cmake-generator-expressions(7)>`. +This is defined in ``<LocalDebuggerCommandArguments>`` in the Visual Studio +project file. + +This property only works for Visual Studio 2010 and above; +it is ignored on other generators. diff --git a/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst b/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst new file mode 100644 index 0000000..f55ac7b --- /dev/null +++ b/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst @@ -0,0 +1,11 @@ +VS_DEBUGGER_ENVIRONMENT +----------------------- + +Sets the local debugger environment for Visual Studio C++ targets. +The property value may use +:manual:`generator expressions <cmake-generator-expressions(7)>`. +This is defined in ``<LocalDebuggerEnvironment>`` in the Visual Studio +project file. + +This property only works for Visual Studio 2010 and above; +it is ignored on other generators. diff --git a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst index fb0389e..008bbf6 100644 --- a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst +++ b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst @@ -2,6 +2,8 @@ VS_DEBUGGER_WORKING_DIRECTORY ----------------------------- Sets the local debugger working directory for Visual Studio C++ targets. +The property value may use +:manual:`generator expressions <cmake-generator-expressions(7)>`. This is defined in ``<LocalDebuggerWorkingDirectory>`` in the Visual Studio project file. diff --git a/Help/release/3.1.rst b/Help/release/3.1.rst index dca42cd..8278353 100644 --- a/Help/release/3.1.rst +++ b/Help/release/3.1.rst @@ -289,12 +289,12 @@ CPack ----- * :manual:`cpack(1)` gained an ``IFW`` generator to package using - Qt Framework Installer tools. See the :module:`CPackIFW` module. + Qt Framework Installer tools. See the :cpack_gen:`CPack IFW Generator`. * :manual:`cpack(1)` gained ``7Z`` and ``TXZ`` generators supporting lzma-compressed archives. -* The :module:`CPackDeb` module learned a new +* The :cpack_gen:`CPack Deb Generator` learned a new :variable:`CPACK_DEBIAN_COMPRESSION_TYPE` variable to set the tarball compression type. diff --git a/Help/release/3.10.rst b/Help/release/3.10.rst index 1205b17..66a1d09 100644 --- a/Help/release/3.10.rst +++ b/Help/release/3.10.rst @@ -184,37 +184,35 @@ CTest CPack ----- -* CPack gained a ``FREEBSD`` generator for FreeBSD ``pkg(8)``, configured - by the :module:`CPackFreeBSD` module. +* A :cpack_gen:`CPack FreeBSD Generator` was added for FreeBSD ``pkg(8)``. -* The CPack ``DEB`` generator, configured by the :module:`CPackDeb` module, - was enabled on Windows. While not fully featured (due to the lack of - external UNIX tools) this will allow building basic cross-platform Debian - packages. +* The :cpack_gen:`CPack Deb Generator` was enabled on Windows. While not + fully featured (due to the lack of external UNIX tools) this will allow + building basic cross-platform Debian packages. -* The :module:`CPackDeb` module learned to set package release version in - ``Version`` info property. +* The :cpack_gen:`CPack Deb Generator` learned to set package release + version in ``Version`` info property. See the :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` variable. -* The :module:`CPackDeb` module learned more strict package version checking - that complies with Debian rules. +* The :cpack_gen:`CPack Deb Generator` learned more strict package + version checking that complies with Debian rules. * The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and :command:`cpack_ifw_configure_component_group` commands gained a new ``REPLACES`` and ``CHECKABLE`` options. -* The :module:`CPackIFW` module gained new +* The :cpack_gen:`CPack IFW Generator` gained new :variable:`CPACK_IFW_PACKAGE_FILE_EXTENSION` variable to customize target binary format. -* The :module:`CPackIFW` module gained new +* The :cpack_gen:`CPack IFW Generator` gained new :variable:`CPACK_IFW_REPOSITORIES_DIRECTORIES` variable to specify additional repositories dirs that will be used to resolve and repack dependent components. This feature is only available when using QtIFW 3.1 or later. -* Modules :module:`CPackRPM` and :module:`CPackDeb` learned to set package epoch - version. +* The :cpack_gen:`CPack RPM Generator` and :cpack_gen:`CPack Deb Generator` + learned to set the package epoch version. See :variable:`CPACK_RPM_PACKAGE_EPOCH` and :variable:`CPACK_DEBIAN_PACKAGE_EPOCH` variables. diff --git a/Help/release/3.11.rst b/Help/release/3.11.rst index 214da0d..a80657d 100644 --- a/Help/release/3.11.rst +++ b/Help/release/3.11.rst @@ -200,11 +200,11 @@ CPack * :manual:`cpack(1)` gained ``--trace`` and ``--trace-expand`` options. -* The :module:`CPackIFW` module gained new +* The :cpack_gen:`CPack IFW Generator` gained new :variable:`CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR` variable to control if the target directory should not be deleted when uninstalling. -* The :module:`CPackRPM` module learned to enable enforcing of execute +* The :cpack_gen:`CPack RPM Generator` learned to enable enforcing of execute privileges on programs and shared libraries. See :variable:`CPACK_RPM_INSTALL_WITH_EXEC` variable. diff --git a/Help/release/3.12.rst b/Help/release/3.12.rst index f00be3e..481027e 100644 --- a/Help/release/3.12.rst +++ b/Help/release/3.12.rst @@ -239,8 +239,8 @@ CPack :variable:`CMAKE_PROJECT_VERSION_PATCH` to initialize corresponding CPack variables. -* :manual:`cpack(1)` gained basic support for `NuGet`_. - See the :module:`CPackNuGet` module. +* A :cpack_gen:`CPack NuGet Generator` was was added with basic + support for `NuGet`_. .. _NuGet: https://docs.microsoft.com/en-us/nuget/what-is-nuget diff --git a/Help/release/3.2.rst b/Help/release/3.2.rst index 8abb1ca..992d44b 100644 --- a/Help/release/3.2.rst +++ b/Help/release/3.2.rst @@ -156,27 +156,27 @@ CTest CPack ----- -* The :module:`CPackRPM` module learned options to set per-component +* The :cpack_gen:`CPack RPM Generator` learned options to set per-component descriptions and summaries. See the :variable:`CPACK_RPM_<component>_PACKAGE_DESCRIPTION` and :variable:`CPACK_RPM_<component>_PACKAGE_SUMMARY` variables. -* The :module:`CPackRPM` module learned options to specify +* The :cpack_gen:`CPack RPM Generator` learned options to specify requirements for pre- and post-install scripts. See the :variable:`CPACK_RPM_PACKAGE_REQUIRES_PRE` and :variable:`CPACK_RPM_PACKAGE_REQUIRES_POST` variables. -* The :module:`CPackRPM` module learned options to specify +* The :cpack_gen:`CPack RPM Generator` learned options to specify requirements for pre- and post-uninstall scripts. See the :variable:`CPACK_RPM_PACKAGE_REQUIRES_PREUN` and :variable:`CPACK_RPM_PACKAGE_REQUIRES_POSTUN` variables. -* The :module:`CPackRPM` module learned a new +* The :cpack_gen:`CPack RPM Generator` learned a new :variable:`CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX` variable to specify a component-specific value to use instead of :variable:`CPACK_PACKAGING_INSTALL_PREFIX`. -* The :module:`CPackRPM` module learned a new +* The :cpack_gen:`CPack RPM Generator` learned a new :variable:`CPACK_RPM_RELOCATION_PATHS` variable to specify multiple relocation prefixes for a single rpm package. diff --git a/Help/release/3.3.rst b/Help/release/3.3.rst index 0beb354..11f0c60 100644 --- a/Help/release/3.3.rst +++ b/Help/release/3.3.rst @@ -169,26 +169,26 @@ CTest CPack ----- -* The :manual:`cpack(1)` ``IFW`` generator and the :module:`CPackIFW` - module learned to support Qt Framework Installer 2.0 tools. +* The :cpack_gen:`CPack IFW Generator` learned to support + Qt Framework Installer 2.0 tools. -* The :module:`CPackDeb` module learned a new +* The :cpack_gen:`CPack Deb Generator` learned a new :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS` variable to specify per-component use of ``dpkg-shlibdeps``. -* The :module:`CPackDeb` module learned a new +* The :cpack_gen:`CPack Deb Generator` learned a new :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` option to specify per-component dependencies. -* The :module:`CPackRPM` module learned to package symbolic links +* The :cpack_gen:`CPack RPM Generator` learned to package symbolic links more cleanly and now supports directory symlinks with recent ``rpmbuild`` versions. -* The :module:`CPackRPM` module learned a new +* The :cpack_gen:`CPack RPM Generator` learned a new :variable:`CPACK_RPM_ADDITIONAL_MAN_DIRS` variable to specify directories containing man pages for the brp-compress RPM macro. -* The :module:`CPackRPM` module learned a new +* The :cpack_gen:`CPack RPM Generator` learned a new :variable:`CPACK_RPM_<component>_PACKAGE_ARCHITECTURE` variable to specify a component-specific package architecture. diff --git a/Help/release/3.4.rst b/Help/release/3.4.rst index 468627e..0a0e6df 100644 --- a/Help/release/3.4.rst +++ b/Help/release/3.4.rst @@ -197,7 +197,7 @@ CTest CPack ----- -* The :module:`CPackDeb` module learned to set package dependencies +* The :cpack_gen:`CPack Deb Generator` learned to set package dependencies per component. See variables: * :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS` @@ -249,11 +249,11 @@ Other Changes :module:`CheckSymbolExists`, and :module:`FindThreads` modules learned to work in environments where only CXX is enabled. -* The :module:`CPackDeb` module now correctly excludes symlinks during package - checksum calculation. +* The :cpack_gen:`CPack Deb Generator` now correctly excludes symlinks + during package checksum calculation. -* The :module:`CPackDeb` no longer uses fakeroot and system tar program for - packaging. +* The :cpack_gen:`CPack Deb Generator` no longer uses fakeroot and + system tar program for packaging. * The :module:`CPack` module no longer mangles settings with CMake-special characters when they're used as defaults for other settings. The macro diff --git a/Help/release/3.5.rst b/Help/release/3.5.rst index 009eb3c..f988908 100644 --- a/Help/release/3.5.rst +++ b/Help/release/3.5.rst @@ -120,31 +120,33 @@ Platforms CPack ----- -* The :module:`CPackDMG` module learned new variable to specify AppleScript - file run to customize appearance of ``DragNDrop`` installer folder, - including background image setting using supplied PNG or multi-resolution - TIFF file. See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and +* The :cpack_gen:`CPack DMG Generator` learned new variable to + specify AppleScript file run to customize appearance of ``DragNDrop`` + installer folder, including background image setting using supplied + PNG or multi-resolution TIFF file. + See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and :variable:`CPACK_DMG_BACKGROUND_IMAGE` variables. -* The :module:`CPackDeb` module learned to set the optional config +* The :cpack_gen:`CPack Deb Generator` learned to set the optional config file ``Source`` field using a monolithic or per-component variable. See :variable:`CPACK_DEBIAN_PACKAGE_SOURCE`. -* The :module:`CPackDeb` module learned to set Package, Section +* The :cpack_gen:`CPack Deb Generator` learned to set Package, Section and Priority control fields per-component. See variables :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION` and :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY`. -* The :module:`CPack DragNDrop generator <CPackDMG>` learned to add +* The :cpack_gen:`CPack DMG Generator` learned to add multi-lingual SLAs to a DMG which is presented to the user when they try to mount the DMG. See the :variable:`CPACK_DMG_SLA_LANGUAGES` and :variable:`CPACK_DMG_SLA_DIR` variables for details. -* The :module:`CPackNSIS` module learned new variables to add bitmaps to the - installer. See the :variable:`CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP` +* The :cpack_gen:`CPack NSIS Generator` learned new variables to + add bitmaps to the installer. + See the :variable:`CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP` and :variable:`CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP` variables. -* The :module:`CPackRPM` module learned to set Name and Group +* The :cpack_gen:`CPack RPM Generator` learned to set Name and Group control fields per-component. See :variable:`CPACK_RPM_<component>_PACKAGE_NAME` and :variable:`CPACK_RPM_<component>_PACKAGE_GROUP`. diff --git a/Help/release/3.6.rst b/Help/release/3.6.rst index a542b77..c796d70 100644 --- a/Help/release/3.6.rst +++ b/Help/release/3.6.rst @@ -165,25 +165,25 @@ CTest CPack ----- -* The :module:`CPackDeb` module learned how to handle ``$ORIGIN`` +* The :cpack_gen:`CPack Deb Generator` learned how to handle ``$ORIGIN`` in ``CMAKE_INSTALL_RPATH`` when :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` is used for dependency auto detection. -* The :module:`CPackDeb` module learned how to generate ``DEBIAN/shlibs`` - contorl file when package contains shared libraries. +* The :cpack_gen:`CPack Deb Generator` learned how to generate + ``DEBIAN/shlibs`` contorl file when package contains shared libraries. -* The :module:`CPackDeb` module learned how to generate ``DEBIAN/postinst`` and - ``DEBIAN/postrm`` files if the package installs libraries in - ldconfig-controlled locations (e.g. ``/lib/``, ``/usr/lib/``). +* The :cpack_gen:`CPack Deb Generator` learned how to generate + ``DEBIAN/postinst`` and ``DEBIAN/postrm`` files if the package installs + libraries in ldconfig-controlled locations (e.g. ``/lib/``, ``/usr/lib/``). -* The :module:`CPackDeb` module learned how to generate dependencies between - Debian packages if multi-component setup is used and +* The :cpack_gen:`CPack Deb Generator` learned how to generate dependencies + between Debian packages if multi-component setup is used and :variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables are set. For backward compatibility this feature is disabled by default. See :variable:`CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS`. -* The :module:`CPackDeb` module learned how to set custom package file names - including how to generate properly-named Debian packages:: +* The :cpack_gen:`CPack Deb Generator` learned how to set custom package + file names including how to generate properly-named Debian packages:: <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb @@ -191,42 +191,44 @@ CPack :variable:`CPACK_DEBIAN_FILE_NAME` and :variable:`CPACK_DEBIAN_<COMPONENT>_FILE_NAME`. -* The :module:`CPackDeb` module learned how to set the package release number - (``DebianRevisionNumber`` in package file name when used in combination with - ``DEB-DEFAULT`` value set by :variable:`CPACK_DEBIAN_FILE_NAME`). See - :variable:`CPACK_DEBIAN_PACKAGE_RELEASE`. +* The :cpack_gen:`CPack Deb Generator` learned how to set the package + release number (``DebianRevisionNumber`` in package file name when + used in combination with ``DEB-DEFAULT`` value set by + :variable:`CPACK_DEBIAN_FILE_NAME`). + See :variable:`CPACK_DEBIAN_PACKAGE_RELEASE`. -* The :module:`CPackDeb` module learned how to set the package architecture - per-component. See :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE`. +* The :cpack_gen:`CPack Deb Generator` learned how to set the package + architecture per-component. + See :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE`. -* The :module:`CPackDMG` module learned a new option to tell the CPack - ``DragNDrop`` generaor to skip the ``/Applications`` symlink. +* The :cpack_gen:`CPack DMG Generator` learned a new option to skip the + ``/Applications`` symlink. See the :variable:`CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK` variable. * The :module:`CPackIFW` module gained a new :command:`cpack_ifw_update_repository` command to update a QtIFW-specific repository from a remote repository. -* The :module:`CPackRPM` module learned how to set RPM ``dist`` tag as part of - RPM ``Release:`` tag when enabled (mandatory on some Linux distributions for - e.g. on Fedora). +* The :cpack_gen:`CPack RPM Generator` learned how to set RPM ``dist`` tag + as part of RPM ``Release:`` tag when enabled (mandatory on some Linux + distributions for e.g. on Fedora). See :variable:`CPACK_RPM_PACKAGE_RELEASE_DIST`. -* The :module:`CPackRPM` module learned how to set default values for owning - user/group and file/directory permissions of package content. +* The :cpack_gen:`CPack RPM Generator` learned how to set default values + for owning user/group and file/directory permissions of package content. See :variable:`CPACK_RPM_DEFAULT_USER`, :variable:`CPACK_RPM_DEFAULT_GROUP`, :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`, :variable:`CPACK_RPM_DEFAULT_DIR_PERMISSIONS` and their per component counterparts. -* The :module:`CPackRPM` module learned how to set user defined package file - names, how to specify that rpmbuild should decide on file name format as - well as handling of multiple rpm packages generated by a single user defined - spec file. +* The :cpack_gen:`CPack RPM Generator` learned how to set user defined + package file names, how to specify that rpmbuild should decide on file + name format as well as handling of multiple rpm packages generated by a + single user defined spec file. See :variable:`CPACK_RPM_PACKAGE_NAME` and :variable:`CPACK_RPM_<component>_PACKAGE_NAME`. -* The :module:`CPackRPM` module learned how to correctly handle symlinks +* The :cpack_gen:`CPack RPM Generator` learned how to correctly handle symlinks that are pointing outside generated packages. Other @@ -296,7 +298,7 @@ Other Changes Input variables of the old case will be honored if provided, and output variables of the old case are always provided. -* The :module:`CPackRPM` module now supports upper cased component +* The :cpack_gen:`CPack RPM Generator` now supports upper cased component names in per component CPackRPM specific variables. E.g. component named ``foo`` now expects component specific variable to be ``CPACK_RPM_FOO_PACKAGE_NAME`` while before diff --git a/Help/release/3.7.rst b/Help/release/3.7.rst index d4d374b..fae10f5 100644 --- a/Help/release/3.7.rst +++ b/Help/release/3.7.rst @@ -221,13 +221,12 @@ CTest CPack ----- -* CPack gained a ``productbuild`` generator on OS X, configured by - the :module:`CPackProductBuild` module. +* CPack gained a :cpack_gen:`CPack productbuild Generator` on OS X. * CPack gained a new :variable:`CPACK_PACKAGE_CHECKSUM` variable to enable generation of a checksum file for each package file. -* The :module:`CPackDeb` module learned to support long file names +* The :cpack_gen:`CPack Deb Generator` learned to support long file names when archive format is set to GNU tar. See :variable:`CPACK_DEBIAN_ARCHIVE_TYPE` @@ -240,32 +239,32 @@ CPack ``USER_INTERFACES`` option to add a list of additional pages to the IFW installer. -* The :module:`CPackRPM` module learned to generate debuginfo +* The :cpack_gen:`CPack RPM Generator` learned to generate debuginfo packages on demand. See :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` and its per component version. -* The :module:`CPackRPM` module learned to generate source rpm +* The :cpack_gen:`CPack RPM Generator` learned to generate source rpm (SRPM) packages on demand. See :variable:`CPACK_RPM_PACKAGE_SOURCES`, :variable:`CPACK_RPM_SOURCE_PKG_BUILD_PARAMS` and :variable:`CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX`. -* The CPack NSIS generator now supports +* The :cpack_gen:`CPack NSIS Generator` now supports :variable:`CPACK_NSIS_<compName>_INSTALL_DIRECTORY`. This can be used to set component specific installation directories. -* The CPack WIX generator now supports +* The :cpack_gen:`CPack WiX Generator` now supports :variable:`CPACK_WIX_SKIP_PROGRAM_FOLDER` to allow specification of a custom absolute installation prefix outside of the ProgramFiles folders. -* The CPack WIX generator now supports +* The :cpack_gen:`CPack WiX Generator` now supports :variable:`CPACK_COMPONENT_<compName>_DISABLED`. This can be used to deselect a component from being installed by default. -* The CPack WIX generator now supports :variable:`CPACK_WIX_PATCH_FILE` - fragments for Feature elements. +* The :cpack_gen:`CPack WiX Generator` now supports + :variable:`CPACK_WIX_PATCH_FILE` fragments for Feature elements. -* The CPack WIX generator now supports +* The :cpack_gen:`CPack WiX Generator` now supports :variable:`CPACK_WIX_ROOT_FEATURE_TITLE` and :variable:`CPACK_WIX_ROOT_FEATURE_DESCRIPTION` to allow the specification of a custom title and description for the root feature element. diff --git a/Help/release/3.8.rst b/Help/release/3.8.rst index efb2aa5..de51a7b 100644 --- a/Help/release/3.8.rst +++ b/Help/release/3.8.rst @@ -307,7 +307,7 @@ CPack option now is deprecated and will be removed in a future version of CMake. Please use new ``SORTING_PRIORITY`` option instead. -* The :module:`CPackIFW` module gained new +* The :cpack_gen:`CPack IFW Generator` gained new :variable:`CPACK_IFW_PACKAGE_WATERMARK`, :variable:`CPACK_IFW_PACKAGE_BANNER`, :variable:`CPACK_IFW_PACKAGE_BACKGROUND`, @@ -317,26 +317,26 @@ CPack :variable:`CPACK_IFW_PACKAGE_TITLE_COLOR` variables to customize a QtIFW installer look. -* The :module:`CPackProductBuild` module gained options to sign packages. +* The :cpack_gen:`CPack productbuild Generator` gained options to sign packages. See the variables :variable:`CPACK_PRODUCTBUILD_IDENTITY_NAME`, :variable:`CPACK_PRODUCTBUILD_KEYCHAIN_PATH`, :variable:`CPACK_PKGBUILD_IDENTITY_NAME`, and :variable:`CPACK_PKGBUILD_KEYCHAIN_PATH`. -* The :module:`CPackRPM` module learned to omit tags that are not supported by - provided ``rpmbuild`` tool. If unsupported tags are set they are ignored - and a developer warning is printed out. +* The :cpack_gen:`CPack RPM Generator` learned to omit tags that are not + supported by provided ``rpmbuild`` tool. If unsupported tags are set they + are ignored and a developer warning is printed out. -* The :module:`CPackRPM` module learned to generate main component package - which forces generation of a rpm for defined component without component - suffix in filename and package name. +* The :cpack_gen:`CPack RPM Generator` learned to generate main component + package which forces generation of a rpm for defined component without + component suffix in filename and package name. See :variable:`CPACK_RPM_MAIN_COMPONENT` variable. -* The :module:`CPackRPM` module learned to generate a single ``debuginfo`` - package on demand even if components packaging is used. +* The :cpack_gen:`CPack RPM Generator` learned to generate a single + ``debuginfo`` package on demand even if components packaging is used. See :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` variable. -* The :module:`CPackRPM` module learned to support +* The :cpack_gen:`CPack RPM Generator` learned to support multiple directives per file when using :variable:`CPACK_RPM_USER_FILELIST` variable. diff --git a/Help/release/3.9.rst b/Help/release/3.9.rst index 897e268..5001e90 100644 --- a/Help/release/3.9.rst +++ b/Help/release/3.9.rst @@ -206,7 +206,7 @@ CTest CPack ----- -* The :module:`CPackArchive` module learned to modify the filename +* The :cpack_gen:`CPack Archive Generator` learned to modify the filename per-component. See the :variable:`CPACK_ARCHIVE_FILE_NAME` variable and its per-component version :variable:`CPACK_ARCHIVE_<component>_FILE_NAME`. @@ -220,23 +220,24 @@ CPack internationalization support for ``DISPLAY_NAME`` and ``DESCRIPTION`` options. -* The :module:`CPackIFW` module learned the new hint :variable:`CPACK_IFW_ROOT` - variable for finding the QtIFW tool suite installed in a non-standard place. +* The :cpack_gen:`CPack IFW Generator` learned the new hint + :variable:`CPACK_IFW_ROOT` variable for finding the QtIFW tool suite + installed in a non-standard place. -* The :module:`CPackProductBuild` module gained a new +* The :cpack_gen:`CPack productbuild Generator` gained a new :variable:`CPACK_PRODUCTBUILD_RESOURCES_DIR` variable to specify resources to be copied into the ``Resources`` directory. -* The :module:`CPackRPM` module learned to modify the ``debuginfo`` package - name. See the :variable:`CPACK_RPM_DEBUGINFO_FILE_NAME` variable. +* The :cpack_gen:`CPack RPM Generator` learned to modify the ``debuginfo`` + package name. See the :variable:`CPACK_RPM_DEBUGINFO_FILE_NAME` variable. -* The :module:`CPackWIX` module patching system now has the ability to set - additional attributes. This can be done by specifying attributes with - the ``CPackWiXFragment`` XML tag after the ``Id`` attribute. +* The :cpack_gen:`CPack WiX Generator` patching system now has the + ability to set additional attributes. This can be done by specifying + attributes with the ``CPackWiXFragment`` XML tag after the ``Id`` attribute. See the :variable:`CPACK_WIX_PATCH_FILE` variable. -* The CPack WIX generator implemented a new +* The :cpack_gen:`CPack WiX Generator` implemented a new :variable:`CPACK_WIX_ROOT_FOLDER_ID` variable which allows using a custom root folder ID instead of the default ``ProgramFilesFolder`` / ``ProgramFiles64Folder``. diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 0000000..e4cc01e --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/dev/CMAKE_AUTOGEN_VERBOSE.rst b/Help/release/dev/CMAKE_AUTOGEN_VERBOSE.rst new file mode 100644 index 0000000..da559cc --- /dev/null +++ b/Help/release/dev/CMAKE_AUTOGEN_VERBOSE.rst @@ -0,0 +1,6 @@ +CMAKE_AUTOGEN_VERBOSE +--------------------- + +* The new variable :variable:`CMAKE_AUTOGEN_VERBOSE` allows + to increase the verbosity of :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC` and + :prop_tgt:`AUTORCC` from within CMakeLists.txt. diff --git a/Help/release/dev/FindCURL-per-config.rst b/Help/release/dev/FindCURL-per-config.rst new file mode 100644 index 0000000..5ba1425 --- /dev/null +++ b/Help/release/dev/FindCURL-per-config.rst @@ -0,0 +1,5 @@ +FindCURL-per-config +------------------- + +* The :module:`FindCURL` module learned to find debug and release variants + separately. diff --git a/Help/release/dev/INTERFACE_LINK_DEPENDS-property.rst b/Help/release/dev/INTERFACE_LINK_DEPENDS-property.rst new file mode 100644 index 0000000..9527c97 --- /dev/null +++ b/Help/release/dev/INTERFACE_LINK_DEPENDS-property.rst @@ -0,0 +1,4 @@ +INTERFACE_LINK_DEPENDS-property +------------------------------- + +* Binary targets gained new :prop_tgt:`INTERFACE_LINK_DEPENDS` property. diff --git a/Help/release/dev/LINK_DEPENDS-property.rst b/Help/release/dev/LINK_DEPENDS-property.rst new file mode 100644 index 0000000..83beba8 --- /dev/null +++ b/Help/release/dev/LINK_DEPENDS-property.rst @@ -0,0 +1,5 @@ +LINK_DEPENDS-property +--------------------- + +* The :prop_tgt:`LINK_DEPENDS` target property learned to support + :manual:`generator expressions <cmake-generator-expressions(7)>`. diff --git a/Help/release/dev/LINK_OPTIONS.rst b/Help/release/dev/LINK_OPTIONS.rst new file mode 100644 index 0000000..e40dab2 --- /dev/null +++ b/Help/release/dev/LINK_OPTIONS.rst @@ -0,0 +1,11 @@ +LINK_OPTIONS +------------ + +* CMake gained new capabilities to manage link step: + + * :prop_dir:`LINK_OPTIONS` directory property. + * :prop_tgt:`LINK_OPTIONS` and :prop_tgt:`INTERFACE_LINK_OPTIONS` target + properties. + * :command:`add_link_options` command to add link options in the current + directory. + * :command:`target_link_options` command to add link options to targets. diff --git a/Help/release/dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst b/Help/release/dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst new file mode 100644 index 0000000..2a2721f --- /dev/null +++ b/Help/release/dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst @@ -0,0 +1,5 @@ +UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES +-------------------------------------- + +* Module ``UseSWIG`` gains capability to manage target property + :prop_tgt:`INCLUDE_DIRECTORIES` for ``SWIG`` compilation. diff --git a/Help/release/dev/cpack-external.rst b/Help/release/dev/cpack-external.rst new file mode 100644 index 0000000..fb9a061 --- /dev/null +++ b/Help/release/dev/cpack-external.rst @@ -0,0 +1,8 @@ +cpack-external +-------------- + +* CPack gained a new :cpack_gen:`CPack External Generator` which is used to + export the CPack metadata in a format that other software can understand. The + intention of this generator is to allow external packaging software to take + advantage of CPack's features when it may not be possible to use CPack for + the entire packaging process. diff --git a/Help/release/dev/cpack-generator-documentation.rst b/Help/release/dev/cpack-generator-documentation.rst new file mode 100644 index 0000000..c3c5193 --- /dev/null +++ b/Help/release/dev/cpack-generator-documentation.rst @@ -0,0 +1,9 @@ +cpack-generator-documentation +----------------------------- + +* The CPack generators have been moved into their own separate section in the + documentation, rather than having the documentation in their internal + implementation modules. +* These internal implementation modules are also no longer available to scripts + that may have been incorrectly including them, because they should never have + been available in the first place. diff --git a/Help/release/dev/ghs.rst b/Help/release/dev/ghs.rst new file mode 100644 index 0000000..d3bec95 --- /dev/null +++ b/Help/release/dev/ghs.rst @@ -0,0 +1,20 @@ +ghs +--- + +* The :generator:`Green Hills MULTI` generator is updated: + + - Added support for architecture selection through + :variable:`CMAKE_GENERATOR_PLATFORM`: + e.g. ``arm``, ``ppc``, and ``86``. + + - Added support for toolset selection through + :variable:`CMAKE_GENERATOR_TOOLSET`, + e.g. ``comp_201205``, ``comp_201510``, ``comp_201722_beta``. + + - Added support for platform selection through ``GHS_TARGET_PLATFORM``, + e.g. ``integrity``, ``linux``, ``standalone``, etc. + + - No longer checks that ``arm`` based compilers are installed but ensures + that the correct ``gbuild.exe`` exists. + + - No longer hard-codes ARM files, BSP, toolset, or OS locations. diff --git a/Help/release/dev/install-code-script-genex.rst b/Help/release/dev/install-code-script-genex.rst new file mode 100644 index 0000000..6532e7b --- /dev/null +++ b/Help/release/dev/install-code-script-genex.rst @@ -0,0 +1,5 @@ +install-code-script-genex +------------------------- + +* The :command:`install(CODE)` and :command:`install(SCRIPT)` commands + learned to support generator expressions. diff --git a/Help/release/dev/list_sort.rst b/Help/release/dev/list_sort.rst new file mode 100644 index 0000000..8971b78 --- /dev/null +++ b/Help/release/dev/list_sort.rst @@ -0,0 +1,5 @@ +list_sort +--------- + +* The :command:`list(SORT)` command gained options to control the + comparison operation used to order the entries. diff --git a/Help/release/dev/math-hex.rst b/Help/release/dev/math-hex.rst new file mode 100644 index 0000000..16e21ec --- /dev/null +++ b/Help/release/dev/math-hex.rst @@ -0,0 +1,4 @@ +math-hex +-------- + +* The :command:`math` command gained options for hexadecimal. diff --git a/Help/release/dev/option-normal-variable.rst b/Help/release/dev/option-normal-variable.rst new file mode 100644 index 0000000..19b9a64 --- /dev/null +++ b/Help/release/dev/option-normal-variable.rst @@ -0,0 +1,5 @@ +option-normal-variable +---------------------- + +* The :command:`option` command now honors existing normal variables instead + of replacing them with a cache entry. See policy :policy:`CMP0077`. diff --git a/Help/release/dev/subdirectory-installing.rst b/Help/release/dev/subdirectory-installing.rst new file mode 100644 index 0000000..04e4676 --- /dev/null +++ b/Help/release/dev/subdirectory-installing.rst @@ -0,0 +1,5 @@ +subdirectory-installing +----------------------- + +* The :command:`install(TARGETS)` command may now be used + to install targets created outside the current directory. diff --git a/Help/release/dev/subdirectory-sources.rst b/Help/release/dev/subdirectory-sources.rst new file mode 100644 index 0000000..880b321 --- /dev/null +++ b/Help/release/dev/subdirectory-sources.rst @@ -0,0 +1,8 @@ +subdirectory-sources +-------------------- + +* The :command:`target_sources` command now interprets relative source file + paths as relative to the current source directory. This simplifies + incrementally building up a target's sources from subdirectories. The + :policy:`CMP0076` policy was added to provide backward compatibility with + the old behavior where required. diff --git a/Help/release/dev/vs-debugger-improvements.rst b/Help/release/dev/vs-debugger-improvements.rst new file mode 100644 index 0000000..f1944bb --- /dev/null +++ b/Help/release/dev/vs-debugger-improvements.rst @@ -0,0 +1,14 @@ +vs-debugger-improvements +------------------------ + +* A :prop_tgt:`VS_DEBUGGER_COMMAND_ARGUMENTS` target property was created to + set the debugging command line arguments with + :ref:`Visual Studio Generators` for VS 2010 and above. +* A :prop_tgt:`VS_DEBUGGER_ENVIRONMENT` target property was created to + set the debugging environment with + :ref:`Visual Studio Generators` for VS 2010 and above. +* :prop_tgt:`VS_DEBUGGER_COMMAND` + :prop_tgt:`VS_DEBUGGER_COMMAND_ARGUMENTS` + :prop_tgt:`VS_DEBUGGER_ENVIRONMENT` + :prop_tgt:`VS_DEBUGGER_WORKING_DIRECTORY` + target properties can use generator expressions. diff --git a/Help/release/dev/vs-deployment-files.rst b/Help/release/dev/vs-deployment-files.rst new file mode 100644 index 0000000..1590ed9 --- /dev/null +++ b/Help/release/dev/vs-deployment-files.rst @@ -0,0 +1,7 @@ +vs-deployment-files +------------------- + +* The :prop_tgt:`DEPLOYMENT_ADDITIONAL_FILES` target property was + added to tell the :generator:`Visual Studio 9 2008` generator + to specify additional files for deployment to WinCE devices + for remote debugging. diff --git a/Help/release/index.rst b/Help/release/index.rst index 4b32eab..4c9e96a 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -7,6 +7,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Help/variable/CMAKE_AUTOGEN_VERBOSE.rst b/Help/variable/CMAKE_AUTOGEN_VERBOSE.rst new file mode 100644 index 0000000..bad9cf2 --- /dev/null +++ b/Help/variable/CMAKE_AUTOGEN_VERBOSE.rst @@ -0,0 +1,13 @@ +CMAKE_AUTOGEN_VERBOSE +--------------------- + +Sets the verbosity of :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC` and +:prop_tgt:`AUTORCC`. A positive integer value or a true boolean value +lets the ``AUTO*`` generators output additional processing information. + +Setting :variable:`CMAKE_AUTOGEN_VERBOSE` has the same effect +as setting the ``VERBOSE`` environment variable during +generation (e.g. by calling ``make VERBOSE=1``). +The extra verbosity is limited to the ``AUTO*`` generators though. + +By default :variable:`CMAKE_AUTOGEN_VERBOSE` is unset. diff --git a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst index 50412ff..963f0a4 100644 --- a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst +++ b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst @@ -19,6 +19,8 @@ Platform specification is supported only on specific generators: * For :ref:`Visual Studio Generators` with VS 2005 and above this specifies the target architecture. +* For :generator:`Green Hills MULTI` this specifies the target architecture. + See native build system documentation for allowed platform names. Visual Studio Platform Selection diff --git a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst index 3220244..e9bc28b 100644 --- a/Help/variable/CMAKE_GENERATOR_TOOLSET.rst +++ b/Help/variable/CMAKE_GENERATOR_TOOLSET.rst @@ -18,6 +18,7 @@ Toolset specification is supported only on specific generators: * :ref:`Visual Studio Generators` for VS 2010 and above * The :generator:`Xcode` generator for Xcode 3.0 and above +* The :generator:`Green Hills MULTI` generator See native build system documentation for allowed toolset names. diff --git a/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG.rst b/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG.rst new file mode 100644 index 0000000..0e52282 --- /dev/null +++ b/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG.rst @@ -0,0 +1,39 @@ +CMAKE_<LANG>_LINKER_WRAPPER_FLAG +-------------------------------- + +Defines the syntax of compiler driver option to pass options to the linker +tool. It will be used to translate the ``LINKER:`` prefix in the link options +(see :command:`add_link_options` and :command:`target_link_options`). + +This variable holds a :ref:`;-list <CMake Language Lists>` of tokens. +If a space (i.e. " ") is specified as last token, flag and ``LINKER:`` +arguments will be specified as separate arguments to the compiler driver. +The :variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP` variable can be specified +to manage concatenation of arguments. + +For example, for ``Clang`` we have: + +.. code-block:: cmake + + set (CMAKE_C_LINKER_WRAPPER_FLAG "-Xlinker" " ") + +Specifying ``"LINKER:-z defs"`` will be transformed in +``-Xlinker -z -Xlinker defs``. + +For ``GNU GCC``: + +.. code-block:: cmake + + set (CMAKE_C_LINKER_WRAPPER_FLAG "-Wl,") + set (CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",") + +Specifying ``"LINKER:-z defs"`` will be transformed in ``-Wl,-z,defs``. + +And for ``SunPro``: + +.. code-block:: cmake + + set (CMAKE_C_LINKER_WRAPPER_FLAG "-Qoption" "ld" " ") + set (CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",") + +Specifying ``"LINKER:-z defs"`` will be transformed in ``-Qoption ld -z,defs``. diff --git a/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP.rst b/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP.rst new file mode 100644 index 0000000..faf1481 --- /dev/null +++ b/Help/variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP.rst @@ -0,0 +1,9 @@ +CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP +------------------------------------ + +This variable is used with :variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG` +variable to format ``LINKER:`` prefix in the link options +(see :command:`add_link_options` and :command:`target_link_options`). + +When specified, arguments of the ``LINKER:`` prefix will be concatenated using +this value as separator. diff --git a/Help/variable/CMAKE_MAKE_PROGRAM.rst b/Help/variable/CMAKE_MAKE_PROGRAM.rst index a3b997a..4f5a50f 100644 --- a/Help/variable/CMAKE_MAKE_PROGRAM.rst +++ b/Help/variable/CMAKE_MAKE_PROGRAM.rst @@ -55,9 +55,11 @@ to configure the project: the CMake cache then CMake will use the specified value if possible. -* The :generator:`Green Hills MULTI` generator sets this to ``gbuild``. - If a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to - the CMake cache then CMake will use the specified value. +* The :generator:`Green Hills MULTI` generator sets this to the full + path to ``gbuild.exe`` based upon the toolset being used. + + Once the generator has initialized a particular value for this + variable, changing the value has undefined behavior. The ``CMAKE_MAKE_PROGRAM`` variable is set for use by project code. The value is also used by the :manual:`cmake(1)` ``--build`` and diff --git a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst index 09280de..8ad89f1 100644 --- a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst +++ b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst @@ -6,5 +6,3 @@ The name of the CPU CMake is building for. This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if you build for the host system instead of the target system when cross compiling. - -* The :generator:`Green Hills MULTI` generator sets this to ``ARM`` by default. diff --git a/Modules/CMakeCSharpCompiler.cmake.in b/Modules/CMakeCSharpCompiler.cmake.in index 5ecc480..3d49b6b 100644 --- a/Modules/CMakeCSharpCompiler.cmake.in +++ b/Modules/CMakeCSharpCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_CSharp_COMPILER "@CMAKE_CSharp_COMPILER@") set(CMAKE_CSharp_COMPILER_ID "@CMAKE_CSharp_COMPILER_ID@") set(CMAKE_CSharp_COMPILER_VERSION "@CMAKE_CSharp_COMPILER_VERSION@") +set(CMAKE_CSharp_COMPILER_LOADED 1) set(CMAKE_CSharp_COMPILER_WORKS "@CMAKE_CSharp_COMPILER_WORKS@") set(CMAKE_CSharp_COMPILER_ID_RUN "@CMAKE_CSharp_COMPILER_ID_RUN@") diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 935f92d..30659eb 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -1,6 +1,9 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. +cmake_policy(PUSH) +cmake_policy(SET CMP0053 NEW) +cmake_policy(SET CMP0054 NEW) # Function parse implicit linker options. # This is used internally by CMake and should not be included by user @@ -185,3 +188,5 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj set(${fwk_var} "${implicit_fwks}" PARENT_SCOPE) set(${log_var} "${log}" PARENT_SCOPE) endfunction() + +cmake_policy(POP) diff --git a/Modules/CPackArchive.cmake b/Modules/CPackArchive.cmake deleted file mode 100644 index 741fb1f..0000000 --- a/Modules/CPackArchive.cmake +++ /dev/null @@ -1,39 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CPackArchive -# ------------ -# -# Archive CPack generator that supports packaging of sources and binaries in -# different formats: -# -# - 7Z - 7zip - (.7z) -# - TBZ2 (.tar.bz2) -# - TGZ (.tar.gz) -# - TXZ (.tar.xz) -# - TZ (.tar.Z) -# - ZIP (.zip) -# -# Variables specific to CPack Archive generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# .. variable:: CPACK_ARCHIVE_FILE_NAME -# CPACK_ARCHIVE_<component>_FILE_NAME -# -# Package file name without extension which is added automatically depending -# on the archive format. -# -# * Mandatory : YES -# * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].<extension>`` with -# spaces replaced by '-' -# -# .. variable:: CPACK_ARCHIVE_COMPONENT_INSTALL -# -# Enable component packaging for CPackArchive -# -# * Mandatory : NO -# * Default : OFF -# -# If enabled (ON) multiple packages are generated. By default a single package -# containing files of all components is generated. diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake deleted file mode 100644 index 8f37ef8..0000000 --- a/Modules/CPackBundle.cmake +++ /dev/null @@ -1,70 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CPackBundle -# ----------- -# -# CPack Bundle generator (Mac OS X) specific options -# -# Variables specific to CPack Bundle generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# Installers built on Mac OS X using the Bundle generator use the -# aforementioned DragNDrop (CPACK_DMG_xxx) variables, plus the following -# Bundle-specific parameters (CPACK_BUNDLE_xxx). -# -# .. variable:: CPACK_BUNDLE_NAME -# -# The name of the generated bundle. This appears in the OSX finder as the -# bundle name. Required. -# -# .. variable:: CPACK_BUNDLE_PLIST -# -# Path to an OSX plist file that will be used for the generated bundle. This -# assumes that the caller has generated or specified their own Info.plist -# file. Required. -# -# .. variable:: CPACK_BUNDLE_ICON -# -# Path to an OSX icon file that will be used as the icon for the generated -# bundle. This is the icon that appears in the OSX finder for the bundle, and -# in the OSX dock when the bundle is opened. Required. -# -# .. variable:: CPACK_BUNDLE_STARTUP_COMMAND -# -# Path to a startup script. This is a path to an executable or script that -# will be run whenever an end-user double-clicks the generated bundle in the -# OSX Finder. Optional. -# -# .. variable:: CPACK_BUNDLE_APPLE_CERT_APP -# -# The name of your Apple supplied code signing certificate for the application. -# The name usually takes the form "Developer ID Application: [Name]" or -# "3rd Party Mac Developer Application: [Name]". If this variable is not set -# the application will not be signed. -# -# .. variable:: CPACK_BUNDLE_APPLE_ENTITLEMENTS -# -# The name of the plist file that contains your apple entitlements for sandboxing -# your application. This file is required for submission to the Mac App Store. -# -# .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_FILES -# -# A list of additional files that you wish to be signed. You do not need to -# list the main application folder, or the main executable. You should -# list any frameworks and plugins that are included in your app bundle. -# -# .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER -# -# Additional parameter that will passed to codesign. -# Default value: "--deep -f" -# -# .. variable:: CPACK_COMMAND_CODESIGN -# -# Path to the codesign(1) command used to sign applications with an -# Apple cert. This variable can be used to override the automatically -# detected command (or specify its location if the auto-detection fails -# to find it.) - -#Bundle Generator specific code should be put here diff --git a/Modules/CPackCygwin.cmake b/Modules/CPackCygwin.cmake deleted file mode 100644 index 6d203c3..0000000 --- a/Modules/CPackCygwin.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CPackCygwin -# ----------- -# -# Cygwin CPack generator (Cygwin). -# -# Variables specific to CPack Cygwin generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# The -# following variable is specific to installers build on and/or for -# Cygwin: -# -# .. variable:: CPACK_CYGWIN_PATCH_NUMBER -# -# The Cygwin patch number. FIXME: This documentation is incomplete. -# -# .. variable:: CPACK_CYGWIN_PATCH_FILE -# -# The Cygwin patch file. FIXME: This documentation is incomplete. -# -# .. variable:: CPACK_CYGWIN_BUILD_SCRIPT -# -# The Cygwin build script. FIXME: This documentation is incomplete. diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake deleted file mode 100644 index bda600f..0000000 --- a/Modules/CPackDMG.cmake +++ /dev/null @@ -1,105 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CPackDMG -# -------- -# -# DragNDrop CPack generator (Mac OS X). -# -# Variables specific to CPack DragNDrop generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# The following variables are specific to the DragNDrop installers built -# on Mac OS X: -# -# .. variable:: CPACK_DMG_VOLUME_NAME -# -# The volume name of the generated disk image. Defaults to -# CPACK_PACKAGE_FILE_NAME. -# -# .. variable:: CPACK_DMG_FORMAT -# -# The disk image format. Common values are UDRO (UDIF read-only), UDZO (UDIF -# zlib-compressed) or UDBZ (UDIF bzip2-compressed). Refer to hdiutil(1) for -# more information on other available formats. Defaults to UDZO. -# -# .. variable:: CPACK_DMG_DS_STORE -# -# Path to a custom DS_Store file. This .DS_Store file e.g. can be used to -# specify the Finder window position/geometry and layout (such as hidden -# toolbars, placement of the icons etc.). This file has to be generated by -# the Finder (either manually or through AppleScript) using a normal folder -# from which the .DS_Store file can then be extracted. -# -# .. variable:: CPACK_DMG_DS_STORE_SETUP_SCRIPT -# -# Path to a custom AppleScript file. This AppleScript is used to generate -# a .DS_Store file which specifies the Finder window position/geometry and -# layout (such as hidden toolbars, placement of the icons etc.). -# By specifying a custom AppleScript there is no need to use -# CPACK_DMG_DS_STORE, as the .DS_Store that is generated by the AppleScript -# will be packaged. -# -# .. variable:: CPACK_DMG_BACKGROUND_IMAGE -# -# Path to an image file to be used as the background. This file will be -# copied to .background/background.<ext>, where ext is the original image file -# extension. The background image is installed into the image before -# CPACK_DMG_DS_STORE_SETUP_SCRIPT is executed or CPACK_DMG_DS_STORE is -# installed. By default no background image is set. -# -# .. variable:: CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK -# -# Default behaviour is to include a symlink to ``/Applications`` in the DMG. -# Set this option to ``ON`` to avoid adding the symlink. -# -# .. variable:: CPACK_DMG_SLA_DIR -# -# Directory where license and menu files for different languages are stored. -# Setting this causes CPack to look for a ``<language>.menu.txt`` and -# ``<language>.license.txt`` file for every language defined in -# ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and -# ``CPACK_RESOURCE_FILE_LICENSE`` are set, CPack will only look for the menu -# files and use the same license file for all languages. -# -# .. variable:: CPACK_DMG_SLA_LANGUAGES -# -# Languages for which a license agreement is provided when mounting the -# generated DMG. A menu file consists of 9 lines of text. The first line is -# is the name of the language itself, uppercase, in English (e.g. German). -# The other lines are translations of the following strings: -# -# - Agree -# - Disagree -# - Print -# - Save... -# - You agree to the terms of the License Agreement when you click the -# "Agree" button. -# - Software License Agreement -# - This text cannot be saved. The disk may be full or locked, or the file -# may be locked. -# - Unable to print. Make sure you have selected a printer. -# -# For every language in this list, CPack will try to find files -# ``<language>.menu.txt`` and ``<language>.license.txt`` in the directory -# specified by the :variable:`CPACK_DMG_SLA_DIR` variable. -# -# .. variable:: CPACK_COMMAND_HDIUTIL -# -# Path to the hdiutil(1) command used to operate on disk image files on Mac -# OS X. This variable can be used to override the automatically detected -# command (or specify its location if the auto-detection fails to find it.) -# -# .. variable:: CPACK_COMMAND_SETFILE -# -# Path to the SetFile(1) command used to set extended attributes on files and -# directories on Mac OS X. This variable can be used to override the -# automatically detected command (or specify its location if the -# auto-detection fails to find it.) -# -# .. variable:: CPACK_COMMAND_REZ -# -# Path to the Rez(1) command used to compile resources on Mac OS X. This -# variable can be used to override the automatically detected command (or -# specify its location if the auto-detection fails to find it.) diff --git a/Modules/CPackFreeBSD.cmake b/Modules/CPackFreeBSD.cmake deleted file mode 100644 index b681d4f..0000000 --- a/Modules/CPackFreeBSD.cmake +++ /dev/null @@ -1,248 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -CPackFreeBSD ------------- - -The built in (binary) CPack FreeBSD (pkg) generator (Unix only) - -Variables specific to CPack FreeBSD (pkg) generator -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -CPackFreeBSD may be used to create pkg(8) packages -- these may be used -on FreeBSD, DragonflyBSD, NetBSD, OpenBSD, but also on Linux or OSX, -depending on the installed package-management tools -- using :module:`CPack`. - -CPackFreeBSD is a :module:`CPack` generator and uses the ``CPACK_XXX`` -variables used by :module:`CPack`. It tries to re-use packaging information -that may already be specified for Debian packages for the :module:`CPackDeb` -generator. it also tries to re-use RPM packaging information when Debian -does not specify. - -CPackFreeBSD generator should work on any host with libpkg installed. The -packages it produces are specific to the host architecture and ABI. - -CPackFreeBSD sets package-metadata through :code:`CPACK_FREEBSD_XXX` variables. -CPackFreeBSD, unlike CPackDeb, does not specially support componentized -packages; a single package is created from all the software artifacts -created through CMake. - -All of the variables can be set specifically for FreeBSD packaging in -the CPackConfig file or in CMakeLists.txt, but most of them have defaults -that use general settings (e.g. CMAKE_PROJECT_NAME) or Debian-specific -variables when those make sense (e.g. the homepage of an upstream project -is usually unchanged by the flavor of packaging). When there is no Debian -information to fall back on, but the RPM packaging has it, fall back to -the RPM information (e.g. package license). - -.. variable:: CPACK_FREEBSD_PACKAGE_NAME - - Sets the package name (in the package manifest, but also affects the - output filename). - - * Mandatory: YES - * Default: - - - :variable:`CPACK_PACKAGE_NAME` (this is always set by CPack itself, - based on CMAKE_PROJECT_NAME). - -.. variable:: CPACK_FREEBSD_PACKAGE_COMMENT - - Sets the package comment. This is the short description displayed by - pkg(8) in standard "pkg info" output. - - * Mandatory: YES - * Default: - - - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` (this is always set - by CPack itself, if nothing else sets it explicitly). - - :variable:`PROJECT_DESCRIPTION` (this can be set with the DESCRIPTION - parameter for :command:`project`). - -.. variable:: CPACK_FREEBSD_PACKAGE_DESCRIPTION - - Sets the package description. This is the long description of the package, - given by "pkg info" with a specific package as argument. - - * Mandatory: YES - * Default: - - - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` (this may be set already - for Debian packaging, so we may as well re-use it). - -.. variable:: CPACK_FREEBSD_PACKAGE_WWW - - The URL of the web site for this package, preferably (when applicable) the - site from which the original source can be obtained and any additional - upstream documentation or information may be found. - - * Mandatory: YES - * Default: - - - :variable:`CMAKE_PROJECT_HOMEPAGE_URL`, or if that is not set, - :variable:`CPACK_DEBIAN_PACKAGE_HOMEPAGE` (this may be set already - for Debian packaging, so we may as well re-use it). - -.. variable:: CPACK_FREEBSD_PACKAGE_LICENSE - - The license, or licenses, which apply to this software package. This must - be one or more license-identifiers that pkg recognizes as acceptable license - identifiers (e.g. "GPLv2"). - - * Mandatory: YES - * Default: - - - :variable:`CPACK_RPM_PACKAGE_LICENSE` - -.. variable:: CPACK_FREEBSD_PACKAGE_LICENSE_LOGIC - - This variable is only of importance if there is more than one license. - The default is "single", which is only applicable to a single license. - Other acceptable values are determined by pkg -- those are "dual" or "multi" -- - meaning choice (OR) or simultaneous (AND) application of the licenses. - - * Mandatory: NO - * Default: single - -.. variable:: CPACK_FREEBSD_PACKAGE_MAINTAINER - - The FreeBSD maintainer (e.g. kde@freebsd.org) of this package. - - * Mandatory: YES - * Default: none - -.. variable:: CPACK_FREEBSD_PACKAGE_ORIGIN - - The origin (ports label) of this package; for packages built by CPack - outside of the ports system this is of less importance. The default - puts the package somewhere under misc/, as a stopgap. - - * Mandatory: YES - * Default: misc/<package name> - -.. variable:: CPACK_FREEBSD_PACKAGE_CATEGORIES - - The ports categories where this package lives (if it were to be built - from ports). If none is set a single category is determined based on - the package origin. - - * Mandatory: YES - * Default: derived from ORIGIN - -.. variable:: CPACK_FREEBSD_PACKAGE_DEPS - - A list of package origins that should be added as package dependencies. - These are in the form <category>/<packagename>, e.g. x11/libkonq. - No version information needs to be provided (this is not included - in the manifest). - - * Mandatory: NO - * Default: empty -#]=======================================================================] - - - -if(CMAKE_BINARY_DIR) - message(FATAL_ERROR "CPackFreeBSD.cmake may only be used by CPack internally.") -endif() - -if(NOT UNIX) - message(FATAL_ERROR "CPackFreeBSD.cmake may only be used under UNIX.") -endif() - - -### -# -# These bits are copied from the Debian packaging file; slightly modified. -# They are used for filling in FreeBSD-packaging variables that can take -# on values from elsewhere -- e.g. the package description may as well be -# copied from Debian. -# -function(_cpack_freebsd_fallback_var OUTPUT_VAR_NAME) - set(FALLBACK_VAR_NAMES ${ARGN}) - - set(VALUE "${${OUTPUT_VAR_NAME}}") - if(VALUE) - return() - endif() - - foreach(variable_name IN LISTS FALLBACK_VAR_NAMES) - if(${variable_name}) - set(${OUTPUT_VAR_NAME} "${${variable_name}}" PARENT_SCOPE) - set(VALUE "${${variable_name}}") - break() - endif() - endforeach() - if(NOT VALUE) - message(WARNING "Variable ${OUTPUT_VAR_NAME} could not be given a fallback value from any variable ${FALLBACK_VAR_NAMES}.") - endif() -endfunction() - -function(check_required_var VAR_NAME) - if(NOT ${VAR_NAME}) - message(FATAL_ERROR "Variable ${VAR_NAME} is not set.") - endif() -endfunction() - -set(_cpack_freebsd_fallback_origin "misc/bogus") - -_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_NAME" - "CPACK_PACKAGE_NAME" - "CMAKE_PROJECT_NAME" - ) - -set(_cpack_freebsd_fallback_www "http://example.com/?pkg=${CPACK_FREEBSD_PACKAGE_NAME}") - -_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_COMMENT" - "CPACK_PACKAGE_DESCRIPTION_SUMMARY" - ) - -# TODO: maybe read the PACKAGE_DESCRIPTION file for the longer -# FreeBSD pkg-descr? -_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_DESCRIPTION" - "CPACK_DEBIAN_PACKAGE_DESCRIPTION" - "CPACK_PACKAGE_DESCRIPTION_SUMMARY" - "PACKAGE_DESCRIPTION" - ) - -# There's really only one homepage for a project, so -# re-use the Debian setting if it's there. -_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_WWW" - "CMAKE_PROJECT_HOMEPAGE_URL" - "CPACK_DEBIAN_PACKAGE_HOMEPAGE" - "_cpack_freebsd_fallback_www" - ) - -_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_VERSION" - "CMAKE_PROJECT_VERSION" - "${CMAKE_PROJECT_NAME}_VERSION" - "PROJECT_VERSION" - "CPACK_PACKAGE_VERSION" - "CPACK_PACKAGE_VERSION" - ) - -_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_MAINTAINER" - "CPACK_PACKAGE_CONTACT" - ) - -_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_LICENSE" - "CPACK_RPM_PACKAGE_LICENSE" - ) - -_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_ORIGIN" - "_cpack_freebsd_fallback_origin" - ) - -if(NOT CPACK_FREEBSD_PACKAGE_CATEGORIES) - string(REGEX REPLACE "/.*" "" CPACK_FREEBSD_PACKAGE_CATEGORIES ${CPACK_FREEBSD_PACKAGE_ORIGIN}) -endif() - -check_required_var("CPACK_FREEBSD_PACKAGE_NAME") -check_required_var("CPACK_FREEBSD_PACKAGE_ORIGIN") -check_required_var("CPACK_FREEBSD_PACKAGE_VERSION") -check_required_var("CPACK_FREEBSD_PACKAGE_MAINTAINER") -check_required_var("CPACK_FREEBSD_PACKAGE_COMMENT") -check_required_var("CPACK_FREEBSD_PACKAGE_DESCRIPTION") -check_required_var("CPACK_FREEBSD_PACKAGE_WWW") -check_required_var("CPACK_FREEBSD_PACKAGE_LICENSE") diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 9d733dc..141e842 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -1,677 +1,331 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -#.rst: -# CPackIFW -# -------- -# -# .. _QtIFW: http://doc.qt.io/qtinstallerframework/index.html -# -# This module looks for the location of the command line utilities supplied -# with the Qt Installer Framework (QtIFW_). -# -# The module also defines several commands to control the behavior of the -# CPack ``IFW`` generator. -# -# -# Overview -# ^^^^^^^^ -# -# CPack ``IFW`` generator helps you to create online and offline -# binary cross-platform installers with a graphical user interface. -# -# CPack IFW generator prepares project installation and generates configuration -# and meta information for QtIFW_ tools. -# -# The QtIFW_ provides a set of tools and utilities to create -# installers for the supported desktop Qt platforms: Linux, Microsoft Windows, -# and Mac OS X. -# -# You should also install QtIFW_ to use CPack ``IFW`` generator. -# -# Hints -# ^^^^^ -# -# Generally, the CPack ``IFW`` generator automatically finds QtIFW_ tools, -# but if you don't use a default path for installation of the QtIFW_ tools, -# the path may be specified in either a CMake or an environment variable: -# -# .. variable:: CPACK_IFW_ROOT -# -# An CMake variable which specifies the location of the QtIFW_ tool suite. -# -# The variable will be cached in the ``CPackConfig.cmake`` file and used at -# CPack runtime. -# -# .. variable:: QTIFWDIR -# -# An environment variable which specifies the location of the QtIFW_ tool -# suite. -# -# .. note:: -# The specified path should not contain "bin" at the end -# (for example: "D:\\DevTools\\QtIFW2.0.5"). -# -# The :variable:`CPACK_IFW_ROOT` variable has a higher priority and overrides -# the value of the :variable:`QTIFWDIR` variable. -# -# Internationalization -# ^^^^^^^^^^^^^^^^^^^^ -# -# Some variables and command arguments support internationalization via -# CMake script. This is an optional feature. -# -# Installers created by QtIFW_ tools have built-in support for -# internationalization and many phrases are localized to many languages, -# but this does not apply to the description of the your components and groups -# that will be distributed. -# -# Localization of the description of your components and groups is useful for -# users of your installers. -# -# A localized variable or argument can contain a single default value, and a -# set of pairs the name of the locale and the localized value. -# -# For example: -# -# .. code-block:: cmake -# -# set(LOCALIZABLE_VARIABLE "Default value" -# en "English value" -# en_US "American value" -# en_GB "Great Britain value" -# ) -# -# Variables -# ^^^^^^^^^ -# -# You can use the following variables to change behavior of CPack ``IFW`` -# generator. -# -# Debug -# """""" -# -# .. variable:: CPACK_IFW_VERBOSE -# -# Set to ``ON`` to enable addition debug output. -# By default is ``OFF``. -# -# Package -# """"""" -# -# .. variable:: CPACK_IFW_PACKAGE_TITLE -# -# Name of the installer as displayed on the title bar. -# By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`. -# -# .. variable:: CPACK_IFW_PACKAGE_PUBLISHER -# -# Publisher of the software (as shown in the Windows Control Panel). -# By default used :variable:`CPACK_PACKAGE_VENDOR`. -# -# .. variable:: CPACK_IFW_PRODUCT_URL -# -# URL to a page that contains product information on your web site. -# -# .. variable:: CPACK_IFW_PACKAGE_ICON -# -# Filename for a custom installer icon. The actual file is '.icns' (Mac OS X), -# '.ico' (Windows). No functionality on Unix. -# -# .. variable:: CPACK_IFW_PACKAGE_WINDOW_ICON -# -# Filename for a custom window icon in PNG format for the Installer -# application. -# -# .. variable:: CPACK_IFW_PACKAGE_LOGO -# -# Filename for a logo is used as QWizard::LogoPixmap. -# -# .. variable:: CPACK_IFW_PACKAGE_WATERMARK -# -# Filename for a watermark is used as QWizard::WatermarkPixmap. -# -# .. variable:: CPACK_IFW_PACKAGE_BANNER -# -# Filename for a banner is used as QWizard::BannerPixmap. -# -# .. variable:: CPACK_IFW_PACKAGE_BACKGROUND -# -# Filename for an image used as QWizard::BackgroundPixmap (only used by MacStyle). -# -# .. variable:: CPACK_IFW_PACKAGE_WIZARD_STYLE -# -# Wizard style to be used ("Modern", "Mac", "Aero" or "Classic"). -# -# .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH -# -# Default width of the wizard in pixels. Setting a banner image will override this. -# -# .. variable:: CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT -# -# Default height of the wizard in pixels. Setting a watermark image will override this. -# -# .. variable:: CPACK_IFW_PACKAGE_TITLE_COLOR -# -# Color of the titles and subtitles (takes an HTML color code, such as "#88FF33"). -# -# .. variable:: CPACK_IFW_PACKAGE_START_MENU_DIRECTORY -# -# Name of the default program group for the product in the Windows Start menu. -# -# By default used :variable:`CPACK_IFW_PACKAGE_NAME`. -# -# .. variable:: CPACK_IFW_TARGET_DIRECTORY -# -# Default target directory for installation. -# By default used -# "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`" -# -# You can use predefined variables. -# -# .. variable:: CPACK_IFW_ADMIN_TARGET_DIRECTORY -# -# Default target directory for installation with administrator rights. -# -# You can use predefined variables. -# -# .. variable:: CPACK_IFW_PACKAGE_GROUP -# -# The group, which will be used to configure the root package -# -# .. variable:: CPACK_IFW_PACKAGE_NAME -# -# The root package name, which will be used if configuration group is not -# specified -# -# .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME -# -# Filename of the generated maintenance tool. -# The platform-specific executable file extension is appended. -# -# By default used QtIFW_ defaults (``maintenancetool``). -# -# .. variable:: CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR -# -# Set to ``OFF`` if the target directory should not be deleted when uninstalling. -# -# Is ``ON`` by default -# -# .. variable:: CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE -# -# Filename for the configuration of the generated maintenance tool. -# -# By default used QtIFW_ defaults (``maintenancetool.ini``). -# -# .. variable:: CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS -# -# Set to ``ON`` if the installation path can contain non-ASCII characters. -# -# Is ``ON`` for QtIFW_ less 2.0 tools. -# -# .. variable:: CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH -# -# Set to ``OFF`` if the installation path cannot contain space characters. -# -# Is ``ON`` for QtIFW_ less 2.0 tools. -# -# .. variable:: CPACK_IFW_PACKAGE_CONTROL_SCRIPT -# -# Filename for a custom installer control script. -# -# .. variable:: CPACK_IFW_PACKAGE_RESOURCES -# -# List of additional resources ('.qrc' files) to include in the installer -# binary. -# -# You can use :command:`cpack_ifw_add_package_resources` command to resolve -# relative paths. -# -# .. variable:: CPACK_IFW_PACKAGE_FILE_EXTENSION -# -# The target binary extension. -# -# On Linux, the name of the target binary is automatically extended with -# '.run', if you do not specify the extension. -# -# On Windows, the target is created as an application with the extension -# '.exe', which is automatically added, if not supplied. -# -# On Mac, the target is created as an DMG disk image with the extension -# '.dmg', which is automatically added, if not supplied. -# -# .. variable:: CPACK_IFW_REPOSITORIES_ALL -# -# The list of remote repositories. -# -# The default value of this variable is computed by CPack and contains -# all repositories added with command :command:`cpack_ifw_add_repository` -# or updated with command :command:`cpack_ifw_update_repository`. -# -# .. variable:: CPACK_IFW_DOWNLOAD_ALL -# -# If this is ``ON`` all components will be downloaded. -# By default is ``OFF`` or used value -# from ``CPACK_DOWNLOAD_ALL`` if set -# -# Components -# """""""""" -# -# .. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES -# -# Resolve duplicate names when installing components with groups. -# -# .. variable:: CPACK_IFW_PACKAGES_DIRECTORIES -# -# Additional prepared packages dirs that will be used to resolve -# dependent components. -# -# .. variable:: CPACK_IFW_REPOSITORIES_DIRECTORIES -# -# Additional prepared repository dirs that will be used to resolve and -# repack dependent components. This feature available only -# since QtIFW_ 3.1. -# -# Tools -# """"" -# -# .. variable:: CPACK_IFW_FRAMEWORK_VERSION -# -# The version of used QtIFW_ tools. -# -# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE -# -# The path to "binarycreator" command line client. -# -# This variable is cached and may be configured if needed. -# -# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE -# -# The path to "repogen" command line client. -# -# This variable is cached and may be configured if needed. -# -# .. variable:: CPACK_IFW_INSTALLERBASE_EXECUTABLE -# -# The path to "installerbase" installer executable base. -# -# This variable is cached and may be configured if needed. -# -# .. variable:: CPACK_IFW_DEVTOOL_EXECUTABLE -# -# The path to "devtool" command line client. -# -# This variable is cached and may be configured if needed. -# -# Commands -# ^^^^^^^^^ -# -# The module defines the following commands: -# -# .. command:: cpack_ifw_configure_component -# -# Sets the arguments specific to the CPack IFW generator. -# -# :: -# -# cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] [VIRTUAL] -# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS] -# [NAME <name>] -# [DISPLAY_NAME <display_name>] # Note: Internationalization supported -# [DESCRIPTION <description>] # Note: Internationalization supported -# [UPDATE_TEXT <update_text>] -# [VERSION <version>] -# [RELEASE_DATE <release_date>] -# [SCRIPT <script>] -# [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated -# [DEPENDS|DEPENDENCIES <com_id> ...] -# [AUTO_DEPEND_ON <comp_id> ...] -# [LICENSES <display_name> <file_path> ...] -# [DEFAULT <value>] -# [USER_INTERFACES <file_path> <file_path> ...] -# [TRANSLATIONS <file_path> <file_path> ...] -# [REPLACES <comp_id> ...] -# [CHECKABLE <value>]) -# -# This command should be called after :command:`cpack_add_component` command. -# -# ``COMMON`` -# if set, then the component will be packaged and installed as part -# of a group to which it belongs. -# -# ``ESSENTIAL`` -# if set, then the package manager stays disabled until that -# component is updated. -# -# ``VIRTUAL`` -# if set, then the component will be hidden from the installer. -# It is a equivalent of the ``HIDDEN`` option from the -# :command:`cpack_add_component` command. -# -# ``FORCED_INSTALLATION`` -# if set, then the component must always be installed. -# It is a equivalent of the ``REQUARED`` option from the -# :command:`cpack_add_component` command. -# -# ``REQUIRES_ADMIN_RIGHTS`` -# set it if the component needs to be installed with elevated permissions. -# -# ``NAME`` -# is used to create domain-like identification for this component. -# By default used origin component name. -# -# ``DISPLAY_NAME`` -# set to rewrite original name configured by -# :command:`cpack_add_component` command. -# -# ``DESCRIPTION`` -# set to rewrite original description configured by -# :command:`cpack_add_component` command. -# -# ``UPDATE_TEXT`` -# will be added to the component description if this is an update to -# the component. -# -# ``VERSION`` -# is version of component. -# By default used :variable:`CPACK_PACKAGE_VERSION`. -# -# ``RELEASE_DATE`` -# keep empty to auto generate. -# -# ``SCRIPT`` -# is a relative or absolute path to operations script -# for this component. -# -# ``PRIORITY`` | ``SORTING_PRIORITY`` -# is priority of the component in the tree. -# The ``PRIORITY`` option is deprecated and will be removed in a future -# version of CMake. Please use ``SORTING_PRIORITY`` option instead. -# -# ``DEPENDS`` | ``DEPENDENCIES`` -# list of dependency component or component group identifiers in -# QtIFW_ style. -# -# ``AUTO_DEPEND_ON`` -# list of identifiers of component or component group in QtIFW_ style -# that this component has an automatic dependency on. -# -# ``LICENSES`` -# pair of <display_name> and <file_path> of license text for this -# component. You can specify more then one license. -# -# ``DEFAULT`` -# Possible values are: TRUE, FALSE, and SCRIPT. -# Set to FALSE to disable the component in the installer or to SCRIPT -# to resolved during runtime (don't forget add the file of the script -# as a value of the ``SCRIPT`` option). -# -# ``USER_INTERFACES`` -# is a list of <file_path> ('.ui' files) representing pages to load. -# -# ``TRANSLATIONS`` -# is a list of <file_path> ('.qm' files) representing translations to load. -# -# ``REPLACES`` -# list of identifiers of component or component group to replace. -# -# ``CHECKABLE`` -# Possible values are: TRUE, FALSE. -# Set to FALSE if you want to hide the checkbox for an item. -# This is useful when only a few subcomponents should be selected -# instead of all. -# -# -# .. command:: cpack_ifw_configure_component_group -# -# Sets the arguments specific to the CPack IFW generator. -# -# :: -# -# cpack_ifw_configure_component_group(<groupname> [VIRTUAL] -# [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS] -# [NAME <name>] -# [DISPLAY_NAME <display_name>] # Note: Internationalization supported -# [DESCRIPTION <description>] # Note: Internationalization supported -# [UPDATE_TEXT <update_text>] -# [VERSION <version>] -# [RELEASE_DATE <release_date>] -# [SCRIPT <script>] -# [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated -# [DEPENDS|DEPENDENCIES <com_id> ...] -# [AUTO_DEPEND_ON <comp_id> ...] -# [LICENSES <display_name> <file_path> ...] -# [DEFAULT <value>] -# [USER_INTERFACES <file_path> <file_path> ...] -# [TRANSLATIONS <file_path> <file_path> ...] -# [REPLACES <comp_id> ...] -# [CHECKABLE <value>]) -# -# This command should be called after :command:`cpack_add_component_group` -# command. -# -# ``VIRTUAL`` -# if set, then the group will be hidden from the installer. -# Note that setting this on a root component does not work. -# -# ``FORCED_INSTALLATION`` -# if set, then the group must always be installed. -# -# ``REQUIRES_ADMIN_RIGHTS`` -# set it if the component group needs to be installed with elevated -# permissions. -# -# ``NAME`` -# is used to create domain-like identification for this component group. -# By default used origin component group name. -# -# ``DISPLAY_NAME`` -# set to rewrite original name configured by -# :command:`cpack_add_component_group` command. -# -# ``DESCRIPTION`` -# set to rewrite original description configured by -# :command:`cpack_add_component_group` command. -# -# ``UPDATE_TEXT`` -# will be added to the component group description if this is an update to -# the component group. -# -# ``VERSION`` -# is version of component group. -# By default used :variable:`CPACK_PACKAGE_VERSION`. -# -# ``RELEASE_DATE`` -# keep empty to auto generate. -# -# ``SCRIPT`` -# is a relative or absolute path to operations script -# for this component group. -# -# ``PRIORITY`` | ``SORTING_PRIORITY`` -# is priority of the component group in the tree. -# The ``PRIORITY`` option is deprecated and will be removed in a future -# version of CMake. Please use ``SORTING_PRIORITY`` option instead. -# -# ``DEPENDS`` | ``DEPENDENCIES`` -# list of dependency component or component group identifiers in -# QtIFW_ style. -# -# ``AUTO_DEPEND_ON`` -# list of identifiers of component or component group in QtIFW_ style -# that this component group has an automatic dependency on. -# -# ``LICENSES`` -# pair of <display_name> and <file_path> of license text for this -# component group. You can specify more then one license. -# -# ``DEFAULT`` -# Possible values are: TRUE, FALSE, and SCRIPT. -# Set to TRUE to preselect the group in the installer -# (this takes effect only on groups that have no visible child components) -# or to SCRIPT to resolved during runtime (don't forget add the file of -# the script as a value of the ``SCRIPT`` option). -# -# ``USER_INTERFACES`` -# is a list of <file_path> ('.ui' files) representing pages to load. -# -# ``TRANSLATIONS`` -# is a list of <file_path> ('.qm' files) representing translations to load. -# -# ``REPLACES`` -# list of identifiers of component or component group to replace. -# -# ``CHECKABLE`` -# Possible values are: TRUE, FALSE. -# Set to FALSE if you want to hide the checkbox for an item. -# This is useful when only a few subcomponents should be selected -# instead of all. -# -# -# .. command:: cpack_ifw_add_repository -# -# Add QtIFW_ specific remote repository to binary installer. -# -# :: -# -# cpack_ifw_add_repository(<reponame> [DISABLED] -# URL <url> -# [USERNAME <username>] -# [PASSWORD <password>] -# [DISPLAY_NAME <display_name>]) -# -# This command will also add the <reponame> repository -# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`. -# -# ``DISABLED`` -# if set, then the repository will be disabled by default. -# -# ``URL`` -# is points to a list of available components. -# -# ``USERNAME`` -# is used as user on a protected repository. -# -# ``PASSWORD`` -# is password to use on a protected repository. -# -# ``DISPLAY_NAME`` -# is string to display instead of the URL. -# -# -# .. command:: cpack_ifw_update_repository -# -# Update QtIFW_ specific repository from remote repository. -# -# :: -# -# cpack_ifw_update_repository(<reponame> -# [[ADD|REMOVE] URL <url>]| -# [REPLACE OLD_URL <old_url> NEW_URL <new_url>]] -# [USERNAME <username>] -# [PASSWORD <password>] -# [DISPLAY_NAME <display_name>]) -# -# This command will also add the <reponame> repository -# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`. -# -# ``URL`` -# is points to a list of available components. -# -# ``OLD_URL`` -# is points to a list that will replaced. -# -# ``NEW_URL`` -# is points to a list that will replace to. -# -# ``USERNAME`` -# is used as user on a protected repository. -# -# ``PASSWORD`` -# is password to use on a protected repository. -# -# ``DISPLAY_NAME`` -# is string to display instead of the URL. -# -# -# .. command:: cpack_ifw_add_package_resources -# -# Add additional resources in the installer binary. -# -# :: -# -# cpack_ifw_add_package_resources(<file_path> <file_path> ...) -# -# This command will also add the specified files -# to a variable :variable:`CPACK_IFW_PACKAGE_RESOURCES`. -# -# -# Example usage -# ^^^^^^^^^^^^^ -# -# .. code-block:: cmake -# -# set(CPACK_PACKAGE_NAME "MyPackage") -# set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyPackage Installation Example") -# set(CPACK_PACKAGE_VERSION "1.0.0") # Version of installer -# -# include(CPack) -# include(CPackIFW) -# -# cpack_add_component(myapp -# DISPLAY_NAME "MyApp" -# DESCRIPTION "My Application") # Default description -# cpack_ifw_configure_component(myapp -# DESCRIPTION ru_RU "Мое Приложение" # Localized description -# VERSION "1.2.3" # Version of component -# SCRIPT "operations.qs") -# cpack_add_component(mybigplugin -# DISPLAY_NAME "MyBigPlugin" -# DESCRIPTION "My Big Downloadable Plugin" -# DOWNLOADED) -# cpack_ifw_add_repository(myrepo -# URL "http://example.com/ifw/repo/myapp" -# DISPLAY_NAME "My Application Repository") -# -# -# Online installer -# ^^^^^^^^^^^^^^^^ -# -# By default CPack IFW generator makes offline installer. This means that all -# components will be packaged into a binary file. -# -# To make a component downloaded, you must set the ``DOWNLOADED`` option in -# :command:`cpack_add_component`. -# -# Then you would use the command :command:`cpack_configure_downloads`. -# If you set ``ALL`` option all components will be downloaded. -# -# You also can use command :command:`cpack_ifw_add_repository` and -# variable :variable:`CPACK_IFW_DOWNLOAD_ALL` for more specific configuration. -# -# CPack IFW generator creates "repository" dir in current binary dir. You -# would copy content of this dir to specified ``site`` (``url``). -# -# See Also -# ^^^^^^^^ -# -# Qt Installer Framework Manual: -# -# * Index page: -# http://doc.qt.io/qtinstallerframework/index.html -# -# * Component Scripting: -# http://doc.qt.io/qtinstallerframework/scripting.html -# -# * Predefined Variables: -# http://doc.qt.io/qtinstallerframework/scripting.html#predefined-variables -# -# * Promoting Updates: -# http://doc.qt.io/qtinstallerframework/ifw-updates.html -# -# Download Qt Installer Framework for you platform from Qt site: -# http://download.qt.io/official_releases/qt-installer-framework -# +#[=======================================================================[.rst: +CPackIFW +-------- + +The documentation for the CPack IFW generator has moved here: :cpack_gen:`CPack IFW Generator` + +.. _QtIFW: http://doc.qt.io/qtinstallerframework/index.html + +This module looks for the location of the command line utilities supplied +with the Qt Installer Framework (QtIFW_). + +The module also defines several commands to control the behavior of the +CPack ``IFW`` generator. + +Commands +^^^^^^^^ + +The module defines the following commands: + +.. command:: cpack_ifw_configure_component + + Sets the arguments specific to the CPack IFW generator. + + :: + + cpack_ifw_configure_component(<compname> [COMMON] [ESSENTIAL] [VIRTUAL] + [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS] + [NAME <name>] + [DISPLAY_NAME <display_name>] # Note: Internationalization supported + [DESCRIPTION <description>] # Note: Internationalization supported + [UPDATE_TEXT <update_text>] + [VERSION <version>] + [RELEASE_DATE <release_date>] + [SCRIPT <script>] + [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated + [DEPENDS|DEPENDENCIES <com_id> ...] + [AUTO_DEPEND_ON <comp_id> ...] + [LICENSES <display_name> <file_path> ...] + [DEFAULT <value>] + [USER_INTERFACES <file_path> <file_path> ...] + [TRANSLATIONS <file_path> <file_path> ...] + [REPLACES <comp_id> ...] + [CHECKABLE <value>]) + + This command should be called after :command:`cpack_add_component` command. + + ``COMMON`` + if set, then the component will be packaged and installed as part + of a group to which it belongs. + + ``ESSENTIAL`` + if set, then the package manager stays disabled until that + component is updated. + + ``VIRTUAL`` + if set, then the component will be hidden from the installer. + It is a equivalent of the ``HIDDEN`` option from the + :command:`cpack_add_component` command. + + ``FORCED_INSTALLATION`` + if set, then the component must always be installed. + It is a equivalent of the ``REQUARED`` option from the + :command:`cpack_add_component` command. + + ``REQUIRES_ADMIN_RIGHTS`` + set it if the component needs to be installed with elevated permissions. + + ``NAME`` + is used to create domain-like identification for this component. + By default used origin component name. + + ``DISPLAY_NAME`` + set to rewrite original name configured by + :command:`cpack_add_component` command. + + ``DESCRIPTION`` + set to rewrite original description configured by + :command:`cpack_add_component` command. + + ``UPDATE_TEXT`` + will be added to the component description if this is an update to + the component. + + ``VERSION`` + is version of component. + By default used :variable:`CPACK_PACKAGE_VERSION`. + + ``RELEASE_DATE`` + keep empty to auto generate. + + ``SCRIPT`` + is a relative or absolute path to operations script + for this component. + + ``PRIORITY`` | ``SORTING_PRIORITY`` + is priority of the component in the tree. + The ``PRIORITY`` option is deprecated and will be removed in a future + version of CMake. Please use ``SORTING_PRIORITY`` option instead. + + ``DEPENDS`` | ``DEPENDENCIES`` + list of dependency component or component group identifiers in + QtIFW_ style. + + ``AUTO_DEPEND_ON`` + list of identifiers of component or component group in QtIFW_ style + that this component has an automatic dependency on. + + ``LICENSES`` + pair of <display_name> and <file_path> of license text for this + component. You can specify more then one license. + + ``DEFAULT`` + Possible values are: TRUE, FALSE, and SCRIPT. + Set to FALSE to disable the component in the installer or to SCRIPT + to resolved during runtime (don't forget add the file of the script + as a value of the ``SCRIPT`` option). + + ``USER_INTERFACES`` + is a list of <file_path> ('.ui' files) representing pages to load. + + ``TRANSLATIONS`` + is a list of <file_path> ('.qm' files) representing translations to load. + + ``REPLACES`` + list of identifiers of component or component group to replace. + + ``CHECKABLE`` + Possible values are: TRUE, FALSE. + Set to FALSE if you want to hide the checkbox for an item. + This is useful when only a few subcomponents should be selected + instead of all. + + +.. command:: cpack_ifw_configure_component_group + + Sets the arguments specific to the CPack IFW generator. + + :: + + cpack_ifw_configure_component_group(<groupname> [VIRTUAL] + [FORCED_INSTALLATION] [REQUIRES_ADMIN_RIGHTS] + [NAME <name>] + [DISPLAY_NAME <display_name>] # Note: Internationalization supported + [DESCRIPTION <description>] # Note: Internationalization supported + [UPDATE_TEXT <update_text>] + [VERSION <version>] + [RELEASE_DATE <release_date>] + [SCRIPT <script>] + [PRIORITY|SORTING_PRIORITY <sorting_priority>] # Note: PRIORITY is deprecated + [DEPENDS|DEPENDENCIES <com_id> ...] + [AUTO_DEPEND_ON <comp_id> ...] + [LICENSES <display_name> <file_path> ...] + [DEFAULT <value>] + [USER_INTERFACES <file_path> <file_path> ...] + [TRANSLATIONS <file_path> <file_path> ...] + [REPLACES <comp_id> ...] + [CHECKABLE <value>]) + + This command should be called after :command:`cpack_add_component_group` + command. + + ``VIRTUAL`` + if set, then the group will be hidden from the installer. + Note that setting this on a root component does not work. + + ``FORCED_INSTALLATION`` + if set, then the group must always be installed. + + ``REQUIRES_ADMIN_RIGHTS`` + set it if the component group needs to be installed with elevated + permissions. + + ``NAME`` + is used to create domain-like identification for this component group. + By default used origin component group name. + + ``DISPLAY_NAME`` + set to rewrite original name configured by + :command:`cpack_add_component_group` command. + + ``DESCRIPTION`` + set to rewrite original description configured by + :command:`cpack_add_component_group` command. + + ``UPDATE_TEXT`` + will be added to the component group description if this is an update to + the component group. + + ``VERSION`` + is version of component group. + By default used :variable:`CPACK_PACKAGE_VERSION`. + + ``RELEASE_DATE`` + keep empty to auto generate. + + ``SCRIPT`` + is a relative or absolute path to operations script + for this component group. + + ``PRIORITY`` | ``SORTING_PRIORITY`` + is priority of the component group in the tree. + The ``PRIORITY`` option is deprecated and will be removed in a future + version of CMake. Please use ``SORTING_PRIORITY`` option instead. + + ``DEPENDS`` | ``DEPENDENCIES`` + list of dependency component or component group identifiers in + QtIFW_ style. + + ``AUTO_DEPEND_ON`` + list of identifiers of component or component group in QtIFW_ style + that this component group has an automatic dependency on. + + ``LICENSES`` + pair of <display_name> and <file_path> of license text for this + component group. You can specify more then one license. + + ``DEFAULT`` + Possible values are: TRUE, FALSE, and SCRIPT. + Set to TRUE to preselect the group in the installer + (this takes effect only on groups that have no visible child components) + or to SCRIPT to resolved during runtime (don't forget add the file of + the script as a value of the ``SCRIPT`` option). + + ``USER_INTERFACES`` + is a list of <file_path> ('.ui' files) representing pages to load. + + ``TRANSLATIONS`` + is a list of <file_path> ('.qm' files) representing translations to load. + + ``REPLACES`` + list of identifiers of component or component group to replace. + + ``CHECKABLE`` + Possible values are: TRUE, FALSE. + Set to FALSE if you want to hide the checkbox for an item. + This is useful when only a few subcomponents should be selected + instead of all. + + +.. command:: cpack_ifw_add_repository + + Add QtIFW_ specific remote repository to binary installer. + + :: + + cpack_ifw_add_repository(<reponame> [DISABLED] + URL <url> + [USERNAME <username>] + [PASSWORD <password>] + [DISPLAY_NAME <display_name>]) + + This command will also add the <reponame> repository + to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`. + + ``DISABLED`` + if set, then the repository will be disabled by default. + + ``URL`` + is points to a list of available components. + + ``USERNAME`` + is used as user on a protected repository. + + ``PASSWORD`` + is password to use on a protected repository. + + ``DISPLAY_NAME`` + is string to display instead of the URL. + + +.. command:: cpack_ifw_update_repository + + Update QtIFW_ specific repository from remote repository. + + :: + + cpack_ifw_update_repository(<reponame> + [[ADD|REMOVE] URL <url>]| + [REPLACE OLD_URL <old_url> NEW_URL <new_url>]] + [USERNAME <username>] + [PASSWORD <password>] + [DISPLAY_NAME <display_name>]) + + This command will also add the <reponame> repository + to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`. + + ``URL`` + is points to a list of available components. + + ``OLD_URL`` + is points to a list that will replaced. + + ``NEW_URL`` + is points to a list that will replace to. + + ``USERNAME`` + is used as user on a protected repository. + + ``PASSWORD`` + is password to use on a protected repository. + + ``DISPLAY_NAME`` + is string to display instead of the URL. + + +.. command:: cpack_ifw_add_package_resources + + Add additional resources in the installer binary. + + :: + + cpack_ifw_add_package_resources(<file_path> <file_path> ...) + + This command will also add the specified files + to a variable :variable:`CPACK_IFW_PACKAGE_RESOURCES`. + +#]=======================================================================] + +# TODO: +# All of the internal implementation CMake modules for other CPack generators +# have been moved into the Internal/CPack directory. This one has not, because +# it contains user-facing macros which would be lost if it were moved. At some +# point, this module should be split into user-facing macros (which would live +# in this module) and internal implementation details (which would live in +# Internal/CPack/CPackIFW.cmake). #============================================================================= # Search Qt Installer Framework tools diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake deleted file mode 100644 index 5bc4395..0000000 --- a/Modules/CPackNSIS.cmake +++ /dev/null @@ -1,138 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CPackNSIS -# --------- -# -# CPack NSIS generator specific options -# -# Variables specific to CPack NSIS generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# The following variables are specific to the graphical installers built -# on Windows using the Nullsoft Installation System. -# -# .. variable:: CPACK_NSIS_INSTALL_ROOT -# -# The default installation directory presented to the end user by the NSIS -# installer is under this root dir. The full directory presented to the end -# user is: ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY} -# -# .. variable:: CPACK_NSIS_MUI_ICON -# -# An icon filename. The name of a ``*.ico`` file used as the main icon for the -# generated install program. -# -# .. variable:: CPACK_NSIS_MUI_UNIICON -# -# An icon filename. The name of a ``*.ico`` file used as the main icon for the -# generated uninstall program. -# -# .. variable:: CPACK_NSIS_INSTALLER_MUI_ICON_CODE -# -# undocumented. -# -# .. variable:: CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP -# -# The filename of a bitmap to use as the NSIS MUI_WELCOMEFINISHPAGE_BITMAP. -# -# .. variable:: CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP -# -# The filename of a bitmap to use as the NSIS MUI_UNWELCOMEFINISHPAGE_BITMAP. -# -# .. variable:: CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS -# -# Extra NSIS commands that will be added to the beginning of the install -# Section, before your install tree is available on the target system. -# -# .. variable:: CPACK_NSIS_EXTRA_INSTALL_COMMANDS -# -# Extra NSIS commands that will be added to the end of the install Section, -# after your install tree is available on the target system. -# -# .. variable:: CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS -# -# Extra NSIS commands that will be added to the uninstall Section, before -# your install tree is removed from the target system. -# -# .. variable:: CPACK_NSIS_COMPRESSOR -# -# The arguments that will be passed to the NSIS SetCompressor command. -# -# .. variable:: CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL -# -# Ask about uninstalling previous versions first. If this is set to "ON", -# then an installer will look for previous installed versions and if one is -# found, ask the user whether to uninstall it before proceeding with the -# install. -# -# .. variable:: CPACK_NSIS_MODIFY_PATH -# -# Modify PATH toggle. If this is set to "ON", then an extra page will appear -# in the installer that will allow the user to choose whether the program -# directory should be added to the system PATH variable. -# -# .. variable:: CPACK_NSIS_DISPLAY_NAME -# -# The display name string that appears in the Windows Add/Remove Program -# control panel -# -# .. variable:: CPACK_NSIS_PACKAGE_NAME -# -# The title displayed at the top of the installer. -# -# .. variable:: CPACK_NSIS_INSTALLED_ICON_NAME -# -# A path to the executable that contains the installer icon. -# -# .. variable:: CPACK_NSIS_HELP_LINK -# -# URL to a web site providing assistance in installing your application. -# -# .. variable:: CPACK_NSIS_URL_INFO_ABOUT -# -# URL to a web site providing more information about your application. -# -# .. variable:: CPACK_NSIS_CONTACT -# -# Contact information for questions and comments about the installation -# process. -# -# .. variable:: CPACK_NSIS_<compName>_INSTALL_DIRECTORY -# -# Custom install directory for the specified component <compName> instead -# of $INSTDIR. -# -# .. variable:: CPACK_NSIS_CREATE_ICONS_EXTRA -# -# Additional NSIS commands for creating start menu shortcuts. -# -# .. variable:: CPACK_NSIS_DELETE_ICONS_EXTRA -# -# Additional NSIS commands to uninstall start menu shortcuts. -# -# .. variable:: CPACK_NSIS_EXECUTABLES_DIRECTORY -# -# Creating NSIS start menu links assumes that they are in 'bin' unless this -# variable is set. For example, you would set this to 'exec' if your -# executables are in an exec directory. -# -# .. variable:: CPACK_NSIS_MUI_FINISHPAGE_RUN -# -# Specify an executable to add an option to run on the finish page of the -# NSIS installer. -# -# .. variable:: CPACK_NSIS_MENU_LINKS -# -# Specify links in [application] menu. This should contain a list of pair -# "link" "link name". The link may be a URL or a path relative to -# installation prefix. Like:: -# -# set(CPACK_NSIS_MENU_LINKS -# "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html" -# "CMake Help" "https://cmake.org" "CMake Web Site") -# - -#FIXME we should put NSIS specific code here -#FIXME but I'm not doing it because I'm not able to test it... diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake deleted file mode 100644 index c2ca4c6..0000000 --- a/Modules/CPackPackageMaker.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CPackPackageMaker -# ----------------- -# -# PackageMaker CPack generator (Mac OS X). -# -# Variables specific to CPack PackageMaker generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# The following variable is specific to installers built on Mac -# OS X using PackageMaker: -# -# .. variable:: CPACK_OSX_PACKAGE_VERSION -# -# The version of Mac OS X that the resulting PackageMaker archive should be -# compatible with. Different versions of Mac OS X support different -# features. For example, CPack can only build component-based installers for -# Mac OS X 10.4 or newer, and can only build installers that download -# component son-the-fly for Mac OS X 10.5 or newer. If left blank, this value -# will be set to the minimum version of Mac OS X that supports the requested -# features. Set this variable to some value (e.g., 10.4) only if you want to -# guarantee that your installer will work on that version of Mac OS X, and -# don't mind missing extra features available in the installer shipping with -# later versions of Mac OS X. diff --git a/Modules/CPackProductBuild.cmake b/Modules/CPackProductBuild.cmake deleted file mode 100644 index ee78d8d..0000000 --- a/Modules/CPackProductBuild.cmake +++ /dev/null @@ -1,72 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CPackProductBuild -# ----------------- -# -# productbuild CPack generator (Mac OS X). -# -# Variables specific to CPack productbuild generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# The following variable is specific to installers built on Mac -# OS X using productbuild: -# -# .. variable:: CPACK_COMMAND_PRODUCTBUILD -# -# Path to the productbuild(1) command used to generate a product archive for -# the OS X Installer or Mac App Store. This variable can be used to override -# the automatically detected command (or specify its location if the -# auto-detection fails to find it.) -# -# .. variable:: CPACK_PRODUCTBUILD_IDENTITY_NAME -# -# Adds a digital signature to the resulting package. -# -# -# .. variable:: CPACK_PRODUCTBUILD_KEYCHAIN_PATH -# -# Specify a specific keychain to search for the signing identity. -# -# -# .. variable:: CPACK_COMMAND_PKGBUILD -# -# Path to the pkgbuild(1) command used to generate an OS X component package -# on OS X. This variable can be used to override the automatically detected -# command (or specify its location if the auto-detection fails to find it.) -# -# -# .. variable:: CPACK_PKGBUILD_IDENTITY_NAME -# -# Adds a digital signature to the resulting package. -# -# -# .. variable:: CPACK_PKGBUILD_KEYCHAIN_PATH -# -# Specify a specific keychain to search for the signing identity. -# -# -# .. variable:: CPACK_PREFLIGHT_<COMP>_SCRIPT -# -# Full path to a file that will be used as the ``preinstall`` script for the -# named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased -# component name. No ``preinstall`` script is added if this variable is not -# defined for a given component. -# -# -# .. variable:: CPACK_POSTFLIGHT_<COMP>_SCRIPT -# -# Full path to a file that will be used as the ``postinstall`` script for the -# named ``<COMP>`` component's package, where ``<COMP>`` is the uppercased -# component name. No ``postinstall`` script is added if this variable is not -# defined for a given component. -# -# -# .. variable:: CPACK_PRODUCTBUILD_RESOURCES_DIR -# -# If specified the productbuild generator copies files from this directory -# (including subdirectories) to the ``Resources`` directory. This is done -# before the :variable:`CPACK_RESOURCE_FILE_WELCOME`, -# :variable:`CPACK_RESOURCE_FILE_README`, and -# :variable:`CPACK_RESOURCE_FILE_LICENSE` files are copied. diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake deleted file mode 100644 index 27737e5..0000000 --- a/Modules/CPackWIX.cmake +++ /dev/null @@ -1,307 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CPackWIX -# -------- -# -# CPack WiX generator specific options -# -# Variables specific to CPack WiX generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# The following variables are specific to the installers built on -# Windows using WiX. -# -# .. variable:: CPACK_WIX_UPGRADE_GUID -# -# Upgrade GUID (``Product/@UpgradeCode``) -# -# Will be automatically generated unless explicitly provided. -# -# It should be explicitly set to a constant generated globally unique -# identifier (GUID) to allow your installers to replace existing -# installations that use the same GUID. -# -# You may for example explicitly set this variable in your -# CMakeLists.txt to the value that has been generated per default. You -# should not use GUIDs that you did not generate yourself or which may -# belong to other projects. -# -# A GUID shall have the following fixed length syntax:: -# -# XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -# -# (each X represents an uppercase hexadecimal digit) -# -# .. variable:: CPACK_WIX_PRODUCT_GUID -# -# Product GUID (``Product/@Id``) -# -# Will be automatically generated unless explicitly provided. -# -# If explicitly provided this will set the Product Id of your installer. -# -# The installer will abort if it detects a pre-existing installation that -# uses the same GUID. -# -# The GUID shall use the syntax described for CPACK_WIX_UPGRADE_GUID. -# -# .. variable:: CPACK_WIX_LICENSE_RTF -# -# RTF License File -# -# If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension it is used as-is. -# -# If CPACK_RESOURCE_FILE_LICENSE has an .txt extension it is implicitly -# converted to RTF by the WiX Generator. -# The expected encoding of the .txt file is UTF-8. -# -# With CPACK_WIX_LICENSE_RTF you can override the license file used by the -# WiX Generator in case CPACK_RESOURCE_FILE_LICENSE is in an unsupported -# format or the .txt -> .rtf conversion does not work as expected. -# -# .. variable:: CPACK_WIX_PRODUCT_ICON -# -# The Icon shown next to the program name in Add/Remove programs. -# -# If set, this icon is used in place of the default icon. -# -# .. variable:: CPACK_WIX_UI_REF -# -# This variable allows you to override the Id of the ``<UIRef>`` element -# in the WiX template. -# -# The default is ``WixUI_InstallDir`` in case no CPack components have -# been defined and ``WixUI_FeatureTree`` otherwise. -# -# .. variable:: CPACK_WIX_UI_BANNER -# -# The bitmap will appear at the top of all installer pages other than the -# welcome and completion dialogs. -# -# If set, this image will replace the default banner image. -# -# This image must be 493 by 58 pixels. -# -# .. variable:: CPACK_WIX_UI_DIALOG -# -# Background bitmap used on the welcome and completion dialogs. -# -# If this variable is set, the installer will replace the default dialog -# image. -# -# This image must be 493 by 312 pixels. -# -# .. variable:: CPACK_WIX_PROGRAM_MENU_FOLDER -# -# Start menu folder name for launcher. -# -# If this variable is not set, it will be initialized with CPACK_PACKAGE_NAME -# -# .. variable:: CPACK_WIX_CULTURES -# -# Language(s) of the installer -# -# Languages are compiled into the WixUI extension library. To use them, -# simply provide the name of the culture. If you specify more than one -# culture identifier in a comma or semicolon delimited list, the first one -# that is found will be used. You can find a list of supported languages at: -# http://wix.sourceforge.net/manual-wix3/WixUI_localization.htm -# -# .. variable:: CPACK_WIX_TEMPLATE -# -# Template file for WiX generation -# -# If this variable is set, the specified template will be used to generate -# the WiX wxs file. This should be used if further customization of the -# output is required. -# -# If this variable is not set, the default MSI template included with CMake -# will be used. -# -# .. variable:: CPACK_WIX_PATCH_FILE -# -# Optional list of XML files with fragments to be inserted into -# generated WiX sources -# -# This optional variable can be used to specify an XML file that the -# WiX generator will use to inject fragments into its generated -# source files. -# -# Patch files understood by the CPack WiX generator -# roughly follow this RELAX NG compact schema: -# -# .. code-block:: none -# -# start = CPackWiXPatch -# -# CPackWiXPatch = element CPackWiXPatch { CPackWiXFragment* } -# -# CPackWiXFragment = element CPackWiXFragment -# { -# attribute Id { string }, -# fragmentContent* -# } -# -# fragmentContent = element * - CPackWiXFragment -# { -# (attribute * { text } | text | fragmentContent)* -# } -# -# Currently fragments can be injected into most -# Component, File, Directory and Feature elements. -# -# The following additional special Ids can be used: -# -# * ``#PRODUCT`` for the ``<Product>`` element. -# * ``#PRODUCTFEATURE`` for the root ``<Feature>`` element. -# -# The following example illustrates how this works. -# -# Given that the WiX generator creates the following XML element: -# -# .. code-block:: xml -# -# <Component Id="CM_CP_applications.bin.my_libapp.exe" Guid="*"/> -# -# The following XML patch file may be used to inject an Environment element -# into it: -# -# .. code-block:: xml -# -# <CPackWiXPatch> -# <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe"> -# <Environment Id="MyEnvironment" Action="set" -# Name="MyVariableName" Value="MyVariableValue"/> -# </CPackWiXFragment> -# </CPackWiXPatch> -# -# .. variable:: CPACK_WIX_EXTRA_SOURCES -# -# Extra WiX source files -# -# This variable provides an optional list of extra WiX source files (.wxs) -# that should be compiled and linked. The full path to source files is -# required. -# -# .. variable:: CPACK_WIX_EXTRA_OBJECTS -# -# Extra WiX object files or libraries -# -# This variable provides an optional list of extra WiX object (.wixobj) -# and/or WiX library (.wixlib) files. The full path to objects and libraries -# is required. -# -# .. variable:: CPACK_WIX_EXTENSIONS -# -# This variable provides a list of additional extensions for the WiX -# tools light and candle. -# -# .. variable:: CPACK_WIX_<TOOL>_EXTENSIONS -# -# This is the tool specific version of CPACK_WIX_EXTENSIONS. -# ``<TOOL>`` can be either LIGHT or CANDLE. -# -# .. variable:: CPACK_WIX_<TOOL>_EXTRA_FLAGS -# -# This list variable allows you to pass additional -# flags to the WiX tool ``<TOOL>``. -# -# Use it at your own risk. -# Future versions of CPack may generate flags which may be in conflict -# with your own flags. -# -# ``<TOOL>`` can be either LIGHT or CANDLE. -# -# .. variable:: CPACK_WIX_CMAKE_PACKAGE_REGISTRY -# -# If this variable is set the generated installer will create -# an entry in the windows registry key -# ``HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<package>`` -# The value for ``<package>`` is provided by this variable. -# -# Assuming you also install a CMake configuration file this will -# allow other CMake projects to find your package with -# the :command:`find_package` command. -# -# .. variable:: CPACK_WIX_PROPERTY_<PROPERTY> -# -# This variable can be used to provide a value for -# the Windows Installer property ``<PROPERTY>`` -# -# The following list contains some example properties that can be used to -# customize information under -# "Programs and Features" (also known as "Add or Remove Programs") -# -# * ARPCOMMENTS - Comments -# * ARPHELPLINK - Help and support information URL -# * ARPURLINFOABOUT - General information URL -# * ARPURLUPDATEINFO - Update information URL -# * ARPHELPTELEPHONE - Help and support telephone number -# * ARPSIZE - Size (in kilobytes) of the application -# -# .. variable:: CPACK_WIX_ROOT_FEATURE_TITLE -# -# Sets the name of the root install feature in the WIX installer. Same as -# CPACK_COMPONENT_<compName>_DISPLAY_NAME for components. -# -# .. variable:: CPACK_WIX_ROOT_FEATURE_DESCRIPTION -# -# Sets the description of the root install feature in the WIX installer. Same as -# CPACK_COMPONENT_<compName>_DESCRIPTION for components. -# -# .. variable:: CPACK_WIX_SKIP_PROGRAM_FOLDER -# -# If this variable is set to true, the default install location -# of the generated package will be CPACK_PACKAGE_INSTALL_DIRECTORY directly. -# The install location will not be located relatively below -# ProgramFiles or ProgramFiles64. -# -# .. note:: -# Installers created with this feature do not take differences -# between the system on which the installer is created -# and the system on which the installer might be used into account. -# -# It is therefore possible that the installer e.g. might try to install -# onto a drive that is unavailable or unintended or a path that does not -# follow the localization or convention of the system on which the -# installation is performed. -# -# .. variable:: CPACK_WIX_ROOT_FOLDER_ID -# -# This variable allows specification of a custom root folder ID. -# The generator specific ``<64>`` token can be used for -# folder IDs that come in 32-bit and 64-bit variants. -# In 32-bit builds the token will expand empty while in 64-bit builds -# it will expand to ``64``. -# -# When unset generated installers will default installing to -# ``ProgramFiles<64>Folder``. -# -# .. variable:: CPACK_WIX_ROOT -# -# This variable can optionally be set to the root directory -# of a custom WiX Toolset installation. -# -# When unspecified CPack will try to locate a WiX Toolset -# installation via the ``WIX`` environment variable instead. -# - -if(NOT CPACK_WIX_ROOT) - string(REPLACE "\\" "/" CPACK_WIX_ROOT "$ENV{WIX}") -endif() - -find_program(CPACK_WIX_CANDLE_EXECUTABLE candle - PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin") - -if(NOT CPACK_WIX_CANDLE_EXECUTABLE) - message(FATAL_ERROR "Could not find the WiX candle executable.") -endif() - -find_program(CPACK_WIX_LIGHT_EXECUTABLE light - PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin") - -if(NOT CPACK_WIX_LIGHT_EXECUTABLE) - message(FATAL_ERROR "Could not find the WiX light executable.") -endif() diff --git a/Modules/Compiler/ARMCC.cmake b/Modules/Compiler/ARMCC.cmake index 250a8f4..f949568 100644 --- a/Modules/Compiler/ARMCC.cmake +++ b/Modules/Compiler/ARMCC.cmake @@ -34,4 +34,6 @@ macro(__compiler_armcc lang) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>") set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEPFILE> --depend_single_line --no_depend_system_headers") + + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ") endmacro() diff --git a/Modules/Compiler/Absoft-Fortran.cmake b/Modules/Compiler/Absoft-Fortran.cmake index da1fc80..76502dc 100644 --- a/Modules/Compiler/Absoft-Fortran.cmake +++ b/Modules/Compiler/Absoft-Fortran.cmake @@ -8,3 +8,4 @@ set(CMAKE_Fortran_MODPATH_FLAG "-p") set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree") +set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-X") diff --git a/Modules/Compiler/Bruce-C.cmake b/Modules/Compiler/Bruce-C.cmake index cfabe65..6b64e58 100644 --- a/Modules/Compiler/Bruce-C.cmake +++ b/Modules/Compiler/Bruce-C.cmake @@ -5,3 +5,5 @@ string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -g") string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG") string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG") string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -DNDEBUG") + +set(CMAKE_C_LINKER_WRAPPER_FLAG "-X") diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 7ce1adb..1653b55 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -30,6 +30,8 @@ else() set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "--target=") set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "--gcc-toolchain=") endif() + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP) set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) diff --git a/Modules/Compiler/G95-Fortran.cmake b/Modules/Compiler/G95-Fortran.cmake index 2c83fb8..03b7e08 100644 --- a/Modules/Compiler/G95-Fortran.cmake +++ b/Modules/Compiler/G95-Fortran.cmake @@ -7,3 +7,5 @@ set(CMAKE_Fortran_MODDIR_FLAG "-fmod=") set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form") +set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,") +set(CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP ",") diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index a3ef2bc..9f4c8d1 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -24,6 +24,9 @@ macro(__compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "--sysroot=") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") + # Older versions of gcc (< 4.5) contain a bug causing them to report a missing # header file as a warning if depfiles are enabled, causing check_header_file # tests to always succeed. Work around this by disabling dependency tracking diff --git a/Modules/Compiler/HP-C.cmake b/Modules/Compiler/HP-C.cmake index b42ba2b..8fa4c08 100644 --- a/Modules/Compiler/HP-C.cmake +++ b/Modules/Compiler/HP-C.cmake @@ -2,3 +2,6 @@ set(CMAKE_C_VERBOSE_FLAG "-v") set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + +set(CMAKE_C_LINKER_WRAPPER_FLAG "-Wl,") +set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",") diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake index 7548754..5726b64 100644 --- a/Modules/Compiler/HP-CXX.cmake +++ b/Modules/Compiler/HP-CXX.cmake @@ -3,6 +3,9 @@ set(CMAKE_CXX_VERBOSE_FLAG "-v") set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") +set(CMAKE_CXX_LINKER_WRAPPER_FLAG "-Wl,") +set(CMAKE_CXX_LINKER_WRAPPER_FLAG_SEP ",") + # HP aCC since version 3.80 supports the flag +hpxstd98 to get ANSI C++98 # template support. It is known that version 6.25 doesn't need that flag. # Current assumption: the flag is needed for every version from 3.80 to 4 diff --git a/Modules/Compiler/HP-Fortran.cmake b/Modules/Compiler/HP-Fortran.cmake index a6ca2c2..63a0331 100644 --- a/Modules/Compiler/HP-Fortran.cmake +++ b/Modules/Compiler/HP-Fortran.cmake @@ -4,3 +4,6 @@ set(CMAKE_Fortran_FORMAT_FREE_FLAG "+source=free") set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") + +set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Wl,") +set(CMAKE_Fortran_LINKER_WRAPPER_FLAG ",") diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake index d5a57ee..4f8b90b 100644 --- a/Modules/Compiler/PGI.cmake +++ b/Modules/Compiler/PGI.cmake @@ -25,6 +25,9 @@ macro(__compiler_pgi lang) string(APPEND CMAKE_${lang}_FLAGS_INIT " -Bdynamic") endif() + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG ",") + set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le AND (NOT CMAKE_HOST_WIN32 OR CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 16.3)) set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake index a5e2b0b..9f2b735 100644 --- a/Modules/Compiler/QCC.cmake +++ b/Modules/Compiler/QCC.cmake @@ -13,6 +13,9 @@ macro(__compiler_qcc lang) set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MD,<DEPFILE>,-MT,<OBJECT>,-MF,<DEPFILE>") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") + set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE NO) set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO) diff --git a/Modules/Compiler/SCO.cmake b/Modules/Compiler/SCO.cmake index c55a048..7f643d9 100644 --- a/Modules/Compiler/SCO.cmake +++ b/Modules/Compiler/SCO.cmake @@ -15,4 +15,7 @@ macro(__compiler_sco lang) set(CMAKE_${lang}_COMPILE_OPTIONS_DLL -belf) set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-Kpic -belf") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-belf -Wl,-Bexport") + + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") endmacro() diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index 8d0e6d6..047de43 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -29,6 +29,9 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic") endforeach() +set(CMAKE_C_LINKER_WRAPPER_FLAG "-Qoption" "ld" " ") +set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",") + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.13) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=c89") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index 14196b7..4c1ac5b 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -29,6 +29,9 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic") endforeach() +set(CMAKE_CXX_LINKER_WRAPPER_FLAG "-Qoption" "ld" " ") +set(CMAKE_CXX_LINKER_WRAPPER_FLAG_SEP ",") + set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake index 9b25c0b..2247dd0 100644 --- a/Modules/Compiler/SunPro-Fortran.cmake +++ b/Modules/Compiler/SunPro-Fortran.cmake @@ -18,6 +18,9 @@ string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -g -xO2 -DNDEBUG") set(CMAKE_Fortran_MODDIR_FLAG "-moddir=") set(CMAKE_Fortran_MODPATH_FLAG "-M") +set(CMAKE_Fortran_LINKER_WRAPPER_FLAG "-Qoption" "ld" " ") +set(CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP ",") + set(CMAKE_Fortran_PREPROCESS_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F -fpp <SOURCE> -o <PREPROCESSED_SOURCE>") diff --git a/Modules/Compiler/TinyCC-C.cmake b/Modules/Compiler/TinyCC-C.cmake index fbd2841..6367695 100644 --- a/Modules/Compiler/TinyCC-C.cmake +++ b/Modules/Compiler/TinyCC-C.cmake @@ -6,3 +6,6 @@ string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -g") string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG") string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG") string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " -g -DNDEBUG") + +set(CMAKE_C_LINKER_WRAPPER_FLAG "-Wl,") +set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",") diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index 3361f8f..a1d7ca1 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -23,6 +23,9 @@ macro(__compiler_xl lang) set(CMAKE_${lang}_RESPONSE_FILE_FLAG "-qoptfile=") set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-qoptfile=") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") + string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g") string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O") string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 4e5c45d..c14e402 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1480,14 +1480,14 @@ if(NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" AND NOT Boost_VERSI string(APPEND _boost_ARCHITECTURE_TAG "-") # This needs to be kept in-sync with the section of CMakePlatformId.h.in # inside 'defined(_WIN32) && defined(_MSC_VER)' - if(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "IA64") + if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "IA64") string(APPEND _boost_ARCHITECTURE_TAG "i") - elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "X86" - OR ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "x64") + elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "X86" + OR CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "x64") string(APPEND _boost_ARCHITECTURE_TAG "x") - elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} MATCHES "^ARM") + elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "^ARM") string(APPEND _boost_ARCHITECTURE_TAG "a") - elseif(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} STREQUAL "MIPS") + elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "MIPS") string(APPEND _boost_ARCHITECTURE_TAG "m") endif() diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index a549765..60ddf7b 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -34,17 +34,29 @@ find_path(CURL_INCLUDE_DIR NAMES curl/curl.h) mark_as_advanced(CURL_INCLUDE_DIR) -# Look for the library (sorted from most current/relevant entry to least). -find_library(CURL_LIBRARY NAMES - curl - # Windows MSVC prebuilts: - curllib - libcurl_imp - curllib_static - # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): - libcurl -) -mark_as_advanced(CURL_LIBRARY) +if(NOT CURL_LIBRARY) + # Look for the library (sorted from most current/relevant entry to least). + find_library(CURL_LIBRARY_RELEASE NAMES + curl + # Windows MSVC prebuilts: + curllib + libcurl_imp + curllib_static + # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): + libcurl + ) + mark_as_advanced(CURL_LIBRARY_RELEASE) + + find_library(CURL_LIBRARY_DEBUG NAMES + # Windows MSVC CMake builds in debug configuration on vcpkg: + libcurl-d_imp + libcurl-d + ) + mark_as_advanced(CURL_LIBRARY_DEBUG) + + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(CURL) +endif() if(CURL_INCLUDE_DIR) foreach(_curl_version_header curlver.h curl.h) @@ -69,7 +81,27 @@ if(CURL_FOUND) if(NOT TARGET CURL::libcurl) add_library(CURL::libcurl UNKNOWN IMPORTED) - set_target_properties(CURL::libcurl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") - set_property(TARGET CURL::libcurl APPEND PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") + set_target_properties(CURL::libcurl PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") + + if(EXISTS "${CURL_LIBRARY}") + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${CURL_LIBRARY}") + endif() + if(CURL_LIBRARY_RELEASE) + set_property(TARGET CURL::libcurl APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION_RELEASE "${CURL_LIBRARY_RELEASE}") + endif() + if(CURL_LIBRARY_DEBUG) + set_property(TARGET CURL::libcurl APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}") + endif() endif() endif() diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index 297a5fb..fe162b4 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -119,16 +119,27 @@ if(WIN32) OpenCL/common/lib/x64) endif() else() - find_library(OpenCL_LIBRARY - NAMES OpenCL - PATHS - ENV AMDAPPSDKROOT - ENV CUDA_PATH - PATH_SUFFIXES - lib/x86_64 - lib/x64 - lib - lib64) + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + find_library(OpenCL_LIBRARY + NAMES OpenCL + PATHS + ENV AMDAPPSDKROOT + ENV CUDA_PATH + PATH_SUFFIXES + lib/x86 + lib) + elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + find_library(OpenCL_LIBRARY + NAMES OpenCL + PATHS + ENV AMDAPPSDKROOT + ENV CUDA_PATH + PATH_SUFFIXES + lib/x86_64 + lib/x64 + lib + lib64) + endif() endif() set(OpenCL_LIBRARIES ${OpenCL_LIBRARY}) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index e1a715e..d6d1ec6 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -119,115 +119,140 @@ # ``ARGN`` # ``.proto`` filess -function(PROTOBUF_GENERATE_CPP SRCS HDRS) - cmake_parse_arguments(protobuf "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN}) +function(protobuf_generate) + include(CMakeParseArguments) - set(PROTO_FILES "${protobuf_UNPARSED_ARGUMENTS}") - if(NOT PROTO_FILES) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") + set(_options APPEND_PATH DESCRIPTORS) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR) + if(COMMAND target_sources) + list(APPEND _singleargs TARGET) + endif() + set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS) + + cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") + + if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without any targets or source files") return() endif() - if(protobuf_EXPORT_MACRO) - set(DLL_EXPORT_DECL "dllexport_decl=${protobuf_EXPORT_MACRO}:") + if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without a target or output variable") + return() endif() - if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${PROTO_FILES}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + if(NOT protobuf_generate_LANGUAGE) + set(protobuf_generate_LANGUAGE cpp) endif() + string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE) - if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) - set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + if(NOT protobuf_generate_PROTOC_OUT_DIR) + set(protobuf_generate_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) endif() - if(DEFINED Protobuf_IMPORT_DIRS) - foreach(DIR ${Protobuf_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) + if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) + set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:") + endif() + + if(NOT protobuf_generate_GENERATE_EXTENSIONS) + if(protobuf_generate_LANGUAGE STREQUAL cpp) + set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc) + elseif(protobuf_generate_LANGUAGE STREQUAL python) + set(protobuf_generate_GENERATE_EXTENSIONS _pb2.py) + else() + message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS") + return() + endif() + endif() + + if(protobuf_generate_TARGET) + get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES) + foreach(_file ${_source_list}) + if(_file MATCHES "proto$") + list(APPEND protobuf_generate_PROTOS ${_file}) endif() endforeach() endif() - set(${SRCS}) - set(${HDRS}) - if (protobuf_DESCRIPTORS) - set(${protobuf_DESCRIPTORS}) + if(NOT protobuf_generate_PROTOS) + message(SEND_ERROR "Error: protobuf_generate could not find any .proto files") + return() endif() - foreach(FIL ${PROTO_FILES}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH) - get_filename_component(FIL_DIR ${FIL} DIRECTORY) - if(FIL_DIR) - set(FIL_WE "${FIL_DIR}/${FIL_WE}") + if(protobuf_generate_APPEND_PATH) + # Create an include path for each file specified + foreach(_file ${protobuf_generate_PROTOS}) + get_filename_component(_abs_file ${_file} ABSOLUTE) + get_filename_component(_abs_path ${_abs_file} PATH) + list(FIND _protobuf_include_path ${_abs_path} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${_abs_path}) endif() + endforeach() + else() + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + foreach(DIR ${protobuf_generate_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) endif() + endforeach() - set(_protobuf_protoc_src "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc") - set(_protobuf_protoc_hdr "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h") - list(APPEND ${SRCS} "${_protobuf_protoc_src}") - list(APPEND ${HDRS} "${_protobuf_protoc_hdr}") + set(_generated_srcs_all) + foreach(_proto ${protobuf_generate_PROTOS}) + get_filename_component(_abs_file ${_proto} ABSOLUTE) + get_filename_component(_abs_dir ${_abs_file} DIRECTORY) + get_filename_component(_basename ${_proto} NAME_WE) + file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir}) - if(protobuf_DESCRIPTORS) - set(_protobuf_protoc_desc "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.desc") - set(_protobuf_protoc_flags "--descriptor_set_out=${_protobuf_protoc_desc}") - list(APPEND ${protobuf_DESCRIPTORS} "${_protobuf_protoc_desc}") - else() - set(_protobuf_protoc_desc "") - set(_protobuf_protoc_flags "") + set(_generated_srcs) + foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS}) + list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_basename}${_ext}") + endforeach() + + if(protobuf_generate_DESCRIPTORS AND protobuf_generate_LANGUAGE STREQUAL cpp) + set(_descriptor_file "${CMAKE_CURRENT_BINARY_DIR}/${_basename}.desc") + set(_dll_desc_out "--descriptor_set_out=${_descriptor_file}") + list(APPEND _generated_srcs ${_descriptor_file}) endif() + list(APPEND _generated_srcs_all ${_generated_srcs}) add_custom_command( - OUTPUT "${_protobuf_protoc_src}" - "${_protobuf_protoc_hdr}" - ${_protobuf_protoc_desc} + OUTPUT ${_generated_srcs} COMMAND protobuf::protoc - "--cpp_out=${DLL_EXPORT_DECL}${CMAKE_CURRENT_BINARY_DIR}" - ${_protobuf_protoc_flags} - ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} protobuf::protoc - COMMENT "Running C++ protocol buffer compiler on ${FIL}" + ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} + DEPENDS ${_abs_file} protobuf::protoc + COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" VERBATIM ) endforeach() - set(${SRCS} "${${SRCS}}" PARENT_SCOPE) - set(${HDRS} "${${HDRS}}" PARENT_SCOPE) - if(protobuf_DESCRIPTORS) - set(${protobuf_DESCRIPTORS} "${${protobuf_DESCRIPTORS}}" PARENT_SCOPE) + set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE) + if(protobuf_generate_OUT_VAR) + set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE) + endif() + if(protobuf_generate_TARGET) + target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all}) endif() endfunction() -function(PROTOBUF_GENERATE_PYTHON SRCS) - if(NOT ARGN) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files") +function(PROTOBUF_GENERATE_CPP SRCS HDRS) + cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN}) + + set(_proto_files "${protobuf_generate_cpp_UNPARSED_ARGUMENTS}") + if(NOT _proto_files) + message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") return() endif() if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + set(_append_arg APPEND_PATH) + endif() + + if(protobuf_generate_cpp_DESCRIPTORS) + set(_descriptors DESCRIPTORS) endif() if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) @@ -235,36 +260,55 @@ function(PROTOBUF_GENERATE_PYTHON SRCS) endif() if(DEFINED Protobuf_IMPORT_DIRS) - foreach(DIR ${Protobuf_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() + set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) endif() + set(_outvar) + protobuf_generate(${_append_arg} ${_descriptors} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files}) + set(${SRCS}) - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH) - get_filename_component(FIL_DIR ${FIL} DIRECTORY) - if(FIL_DIR) - set(FIL_WE "${FIL_DIR}/${FIL_WE}") - endif() - endif() + set(${HDRS}) + if(protobuf_generate_cpp_DESCRIPTORS) + set(${protobuf_generate_cpp_DESCRIPTORS}) + endif() - list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py") - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py" - COMMAND protobuf::protoc --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} protobuf::protoc - COMMENT "Running Python protocol buffer compiler on ${FIL}" - VERBATIM ) + foreach(_file ${_outvar}) + if(_file MATCHES "cc$") + list(APPEND ${SRCS} ${_file}) + elseif(_file MATCHES "desc$") + list(APPEND ${protobuf_generate_cpp_DESCRIPTORS} ${_file}) + else() + list(APPEND ${HDRS} ${_file}) + endif() endforeach() - set(${SRCS} ${${SRCS}} PARENT_SCOPE) + set(${HDRS} ${${HDRS}} PARENT_SCOPE) + if(protobuf_generate_cpp_DESCRIPTORS) + set(${protobuf_generate_cpp_DESCRIPTORS} "${${protobuf_generate_cpp_DESCRIPTORS}}" PARENT_SCOPE) + endif() +endfunction() + +function(PROTOBUF_GENERATE_PYTHON SRCS) + if(NOT ARGN) + message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files") + return() + endif() + + if(PROTOBUF_GENERATE_CPP_APPEND_PATH) + set(_append_arg APPEND_PATH) + endif() + + if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) + set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + endif() + + if(DEFINED Protobuf_IMPORT_DIRS) + set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) + endif() + + set(_outvar) + protobuf_generate(${_append_arg} LANGUAGE python OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN}) + set(${SRCS} ${_outvar} PARENT_SCOPE) endfunction() diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake index 19eb932..ad16e0d 100644 --- a/Modules/FindTCL.cmake +++ b/Modules/FindTCL.cmake @@ -85,6 +85,8 @@ set(TCLTK_POSSIBLE_LIB_PATHS ) set(TCLTK_POSSIBLE_LIB_PATH_SUFFIXES + lib/tcl/tcl8.7 + lib/tcl/tk8.7 lib/tcl/tcl8.6 lib/tcl/tk8.6 lib/tcl/tcl8.5 @@ -116,6 +118,7 @@ find_library(TCL_LIBRARY NAMES tcl tcl${TCL_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION} + tcl87 tcl8.7 tcl87t tcl8.7t tcl86 tcl8.6 tcl86t tcl8.6t tcl85 tcl8.5 tcl84 tcl8.4 @@ -130,6 +133,7 @@ find_library(TK_LIBRARY NAMES tk tk${TK_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION} + tk87 tk8.7 tk87t tk8.7t tk86 tk8.6 tk86t tk8.6t tk85 tk8.5 tk84 tk8.4 @@ -176,6 +180,8 @@ set(TCLTK_POSSIBLE_INCLUDE_PATHS set(TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES include/tcl${TK_LIBRARY_VERSION} include/tcl${TCL_LIBRARY_VERSION} + include/tcl8.7 + include/tk8.7 include/tcl8.6 include/tk8.6 include/tcl8.5 diff --git a/Modules/FindTclStub.cmake b/Modules/FindTclStub.cmake index 51fc029..db0a7a1 100644 --- a/Modules/FindTclStub.cmake +++ b/Modules/FindTclStub.cmake @@ -101,6 +101,7 @@ find_library(TCL_STUB_LIBRARY NAMES tclstub tclstub${TK_LIBRARY_VERSION} tclstub${TCL_TCLSH_VERSION} tclstub${TK_WISH_VERSION} + tclstub87 tclstub8.7 tclstub86 tclstub8.6 tclstub85 tclstub8.5 tclstub84 tclstub8.4 @@ -114,6 +115,7 @@ find_library(TK_STUB_LIBRARY NAMES tkstub tkstub${TCL_LIBRARY_VERSION} tkstub${TCL_TCLSH_VERSION} tkstub${TK_WISH_VERSION} + tkstub87 tkstub8.7 tkstub86 tkstub8.6 tkstub85 tkstub8.5 tkstub84 tkstub8.4 diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake index 9fcb41c..9bf935d 100644 --- a/Modules/FindTclsh.cmake +++ b/Modules/FindTclsh.cmake @@ -68,6 +68,7 @@ endif() set(TCL_TCLSH_NAMES tclsh tclsh${TCL_LIBRARY_VERSION} tclsh${TK_LIBRARY_VERSION} tclsh${TK_WISH_VERSION} + tclsh87 tclsh8.7 tclsh86 tclsh8.6 tclsh85 tclsh8.5 tclsh84 tclsh8.4 diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index 51e68d5..267c164 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -59,6 +59,9 @@ function(_XercesC_GET_VERSION version_hdr) endif() set(XercesC_VERSION "${XercesC_MAJOR}.${XercesC_MINOR}.${XercesC_PATCH}" PARENT_SCOPE) + set(XercesC_VERSION_MAJOR "${XercesC_MAJOR}" PARENT_SCOPE) + set(XercesC_VERSION_MINOR "${XercesC_MINOR}" PARENT_SCOPE) + set(XercesC_VERSION_PATCH "${XercesC_PATCH}" PARENT_SCOPE) else() message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information") endif() @@ -73,16 +76,20 @@ mark_as_advanced(XercesC_INCLUDE_DIR) if(NOT XercesC_LIBRARY) # Find all XercesC libraries find_library(XercesC_LIBRARY_RELEASE - NAMES "xerces-c" "xerces-c_3" + NAMES "xerces-c" "xerces-c_${XercesC_VERSION_MAJOR}" DOC "Xerces-C++ libraries (release)") find_library(XercesC_LIBRARY_DEBUG - NAMES "xerces-cd" "xerces-c_3D" "xerces-c_3_1D" + NAMES "xerces-cd" "xerces-c_${XercesC_VERSION_MAJOR}D" "xerces-c_${XercesC_VERSION_MAJOR}_${XercesC_VERSION_MINOR}D" DOC "Xerces-C++ libraries (debug)") include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(XercesC) mark_as_advanced(XercesC_LIBRARY_RELEASE XercesC_LIBRARY_DEBUG) endif() +unset(XercesC_VERSION_MAJOR) +unset(XercesC_VERSION_MINOR) +unset(XercesC_VERSION_PATCH) + if(XercesC_INCLUDE_DIR) _XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") endif() diff --git a/Modules/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index fdbae32..4ef4539 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -1,537 +1,6 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -#.rst: -# CPackDeb -# -------- -# -# The built in (binary) CPack Deb generator (Unix only) -# -# Variables specific to CPack Debian (DEB) generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# CPackDeb may be used to create Deb package using :module:`CPack`. -# CPackDeb is a :module:`CPack` generator thus it uses the ``CPACK_XXX`` -# variables used by :module:`CPack`. -# -# CPackDeb generator should work on any Linux host but it will produce -# better deb package when Debian specific tools ``dpkg-xxx`` are usable on -# the build system. -# -# CPackDeb has specific features which are controlled by the specifics -# :code:`CPACK_DEBIAN_XXX` variables. -# -# :code:`CPACK_DEBIAN_<COMPONENT>_XXXX` variables may be used in order to have -# **component** specific values. Note however that ``<COMPONENT>`` refers to -# the **grouping name** written in upper case. It may be either a component name -# or a component GROUP name. -# -# Here are some CPackDeb wiki resources that are here for historic reasons and -# are no longer maintained but may still prove useful: -# -# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration -# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#deb-unix-only -# -# List of CPackDEB specific variables: -# -# .. variable:: CPACK_DEB_COMPONENT_INSTALL -# -# Enable component packaging for CPackDEB -# -# * Mandatory : NO -# * Default : OFF -# -# If enabled (ON) multiple packages are generated. By default a single package -# containing files of all components is generated. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_NAME -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME -# -# Set Package control field (variable is automatically transformed to lower -# case). -# -# * Mandatory : YES -# * Default : -# -# - :variable:`CPACK_PACKAGE_NAME` for non-component based -# installations -# - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with -<COMPONENT> -# for component-based installations. -# -# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source -# -# .. variable:: CPACK_DEBIAN_FILE_NAME -# CPACK_DEBIAN_<COMPONENT>_FILE_NAME -# -# Package file name. -# -# * Mandatory : YES -# * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].deb`` -# -# This may be set to ``DEB-DEFAULT`` to allow CPackDeb to generate package file -# name by itself in deb format:: -# -# <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb -# -# Alternatively provided package file name must end -# with either ``.deb`` or ``.ipk`` suffix. -# -# .. note:: -# -# Preferred setting of this variable is ``DEB-DEFAULT`` but for backward -# compatibility with CPackDeb in CMake prior to version 3.6 this feature -# is disabled by default. -# -# .. note:: -# -# By using non default filenames duplicate names may occur. Duplicate files -# get overwritten and it is up to the packager to set the variables in a -# manner that will prevent such errors. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_EPOCH -# -# The Debian package epoch -# -# * Mandatory : No -# * Default : - -# -# Optional number that should be incremented when changing versioning schemas -# or fixing mistakes in the version numbers of older packages. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_VERSION -# -# The Debian package version -# -# * Mandatory : YES -# * Default : :variable:`CPACK_PACKAGE_VERSION` -# -# This variable may contain only alphanumerics (A-Za-z0-9) and the characters -# . + - ~ (full stop, plus, hyphen, tilde) and should start with a digit. If -# :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` is not set then hyphens are not -# allowed. -# -# .. note:: -# -# For backward compatibility with CMake 3.9 and lower a failed test of this -# variable's content is not a hard error when both -# :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` and -# :variable:`CPACK_DEBIAN_PACKAGE_EPOCH` variables are not set. An author -# warning is reported instead. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_RELEASE -# -# The Debian package release - Debian revision number. -# -# * Mandatory : No -# * Default : - -# -# This is the numbering of the DEB package itself, i.e. the version of the -# packaging and not the version of the content (see -# :variable:`CPACK_DEBIAN_PACKAGE_VERSION`). One may change the default value -# if the previous packaging was buggy and/or you want to put here a fancy Linux -# distro specific numbering. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_ARCHITECTURE -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE -# -# The Debian package architecture -# -# * Mandatory : YES -# * Default : Output of :code:`dpkg --print-architecture` (or :code:`i386` -# if :code:`dpkg` is not found) -# -# .. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS -# -# Sets the Debian dependencies of this package. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS` for component-based -# installations. -# -# .. note:: -# -# If :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or -# more specifically :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS` -# is set for this component, the discovered dependencies will be appended -# to :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` instead of -# :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`. If -# :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` is an empty string, -# only the automatically discovered dependencies will be set for this -# component. -# -# Example:: -# -# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)") -# -# .. variable:: CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS -# -# Sets inter component dependencies if listed with -# :variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables. -# -# * Mandatory : NO -# * Default : - -# -# .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER -# -# The Debian package maintainer -# -# * Mandatory : YES -# * Default : :code:`CPACK_PACKAGE_CONTACT` -# -# .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION -# CPACK_COMPONENT_<COMPONENT>_DESCRIPTION -# -# The Debian package description -# -# * Mandatory : YES -# * Default : -# -# - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set or -# - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` -# -# -# .. variable:: CPACK_DEBIAN_PACKAGE_SECTION -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION -# -# Set Section control field e.g. admin, devel, doc, ... -# -# * Mandatory : YES -# * Default : "devel" -# -# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections -# -# .. variable:: CPACK_DEBIAN_ARCHIVE_TYPE -# -# The archive format used for creating the Debian package. -# -# * Mandatory : YES -# * Default : "paxr" -# -# Possible values are: -# -# - paxr -# - gnutar -# -# .. note:: -# -# Default pax archive format is the most portable format and generates -# packages that do not treat sparse files specially. -# GNU tar format on the other hand supports longer filenames. -# -# .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE -# -# The compression used for creating the Debian package. -# -# * Mandatory : YES -# * Default : "gzip" -# -# Possible values are: -# -# - lzma -# - xz -# - bzip2 -# - gzip -# -# .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY -# -# Set Priority control field e.g. required, important, standard, optional, -# extra -# -# * Mandatory : YES -# * Default : "optional" -# -# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities -# -# .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE -# -# The URL of the web site for this package, preferably (when applicable) the -# site from which the original source can be obtained and any additional -# upstream documentation or information may be found. -# -# * Mandatory : NO -# * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL` -# -# .. note:: -# -# The content of this field is a simple URL without any surrounding -# characters such as <>. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS -# -# May be set to ON in order to use :code:`dpkg-shlibdeps` to generate -# better package dependency list. -# -# * Mandatory : NO -# * Default : -# -# - :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` if set or -# - OFF -# -# .. note:: -# -# You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value -# if you use this feature, because if you don't :code:`dpkg-shlibdeps` -# may fail to find your own shared libs. -# See https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling -# -# .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG -# -# May be set when invoking cpack in order to trace debug information -# during CPackDeb run. -# -# * Mandatory : NO -# * Default : - -# -# .. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS -# -# Sets the `Pre-Depends` field of the Debian package. -# Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it -# also forces :code:`dpkg` to complete installation of the packages named -# before even starting the installation of the package which declares the -# pre-dependency. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based -# installations. -# -# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES -# -# Sets the `Enhances` field of the Debian package. -# Similar to :variable:`Suggests <CPACK_DEBIAN_PACKAGE_SUGGESTS>` but works -# in the opposite direction: declares that a package can enhance the -# functionality of another package. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based -# installations. -# -# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS -# -# Sets the `Breaks` field of the Debian package. -# When a binary package (P) declares that it breaks other packages (B), -# :code:`dpkg` will not allow the package (P) which declares `Breaks` be -# **unpacked** unless the packages that will be broken (B) are deconfigured -# first. -# As long as the package (P) is configured, the previously deconfigured -# packages (B) cannot be reconfigured again. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based -# installations. -# -# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks -# -# .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS -# -# Sets the `Conflicts` field of the Debian package. -# When one binary package declares a conflict with another using a `Conflicts` -# field, :code:`dpkg` will not allow them to be unpacked on the system at -# the same time. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based -# installations. -# -# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts -# -# .. note:: -# -# This is a stronger restriction than -# :variable:`Breaks <CPACK_DEBIAN_PACKAGE_BREAKS>`, which prevents the -# broken package from being configured while the breaking package is in -# the "Unpacked" state but allows both packages to be unpacked at the same -# time. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES -# -# Sets the `Provides` field of the Debian package. -# A virtual package is one which appears in the `Provides` control field of -# another package. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based -# installations. -# -# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual -# -# .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES -# -# Sets the `Replaces` field of the Debian package. -# Packages can declare in their control file that they should overwrite -# files in certain other packages, or completely replace other packages. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based -# installations. -# -# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS -# -# Sets the `Recommends` field of the Debian package. -# Allows packages to declare a strong, but not absolute, dependency on other -# packages. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based -# installations. -# -# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS -# -# Sets the `Suggests` field of the Debian package. -# Allows packages to declare a suggested package install grouping. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based -# installations. -# -# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS -# -# * Mandatory : NO -# * Default : OFF -# -# Allows to generate shlibs control file automatically. Compatibility is defined by -# :variable:`CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY` variable value. -# -# .. note:: -# -# Libraries are only considered if they have both library name and version -# set. This can be done by setting SOVERSION property with -# :command:`set_target_properties` command. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY -# -# Compatibility policy for auto-generated shlibs control file. -# -# * Mandatory : NO -# * Default : "=" -# -# Defines compatibility policy for auto-generated shlibs control file. -# Possible values: "=", ">=" -# -# See https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-sharedlibs-shlibdeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_EXTRA -# -# This variable allow advanced user to add custom script to the -# control.tar.gz. -# Typical usage is for conffiles, postinst, postrm, prerm. -# -# * Mandatory : NO -# * Default : - -# -# Usage:: -# -# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA -# "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") -# -# .. note:: -# -# The original permissions of the files will be used in the final -# package unless the variable -# :variable:`CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION` is set. -# In particular, the scripts should have the proper executable -# flag prior to the generation of the package. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_STRICT_PERMISSION -# -# This variable indicates if the Debian policy on control files should be -# strictly followed. -# -# * Mandatory : NO -# * Default : FALSE -# -# Usage:: -# -# set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE) -# -# .. note:: -# -# This overrides the permissions on the original files, following the rules -# set by Debian policy -# https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners -# -# .. variable:: CPACK_DEBIAN_PACKAGE_SOURCE -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SOURCE -# -# Sets the ``Source`` field of the binary Debian package. -# When the binary package name is not the same as the source package name -# (in particular when several components/binaries are generated from one -# source) the source from which the binary has been generated should be -# indicated with the field ``Source``. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based -# installations. -# -# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source -# -# .. note:: -# -# This value is not interpreted. It is possible to pass an optional -# revision number of the referenced source package as well. -# -# Building Debian packages on Windows -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# To communicate UNIX file permissions from the install stage -# to the CPack DEB generator the "cmake_mode_t" NTFS -# alternate data stream (ADT) is used. -# -# When a filesystem without ADT support is used only owner read/write -# permissions can be preserved. - # CPack script for creating Debian package # Author: Mathieu Malaterre # diff --git a/Modules/Internal/CPack/CPackExt.cmake b/Modules/Internal/CPack/CPackExt.cmake new file mode 100644 index 0000000..e52d978 --- /dev/null +++ b/Modules/Internal/CPack/CPackExt.cmake @@ -0,0 +1,53 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +if(NOT "${CPACK_EXT_REQUESTED_VERSIONS}" STREQUAL "") + unset(_found_major) + + foreach(_req_version IN LISTS CPACK_EXT_REQUESTED_VERSIONS) + if(_req_version MATCHES "^([0-9]+)\\.([0-9]+)$") + set(_req_major "${CMAKE_MATCH_1}") + set(_req_minor "${CMAKE_MATCH_2}") + + foreach(_known_version IN LISTS CPACK_EXT_KNOWN_VERSIONS) + string(REGEX MATCH + "^([0-9]+)\\.([0-9]+)$" + _known_version_dummy + "${_known_version}" + ) + + set(_known_major "${CMAKE_MATCH_1}") + set(_known_minor "${CMAKE_MATCH_2}") + + if(_req_major EQUAL _known_major AND NOT _known_minor LESS _req_minor) + set(_found_major "${_known_major}") + set(_found_minor "${_known_minor}") + break() + endif() + endforeach() + + if(DEFINED _found_major) + break() + endif() + endif() + endforeach() + + if(DEFINED _found_major) + set(CPACK_EXT_SELECTED_MAJOR "${_found_major}") + set(CPACK_EXT_SELECTED_MINOR "${_found_minor}") + set(CPACK_EXT_SELECTED_VERSION "${_found_major}.${_found_minor}") + else() + message(FATAL_ERROR + "Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS" + ) + endif() +else() + list(GET CPACK_EXT_KNOWN_VERSIONS 0 CPACK_EXT_SELECTED_VERSION) + string(REGEX MATCH + "^([0-9]+)\\.([0-9]+)$" + _dummy + "${CPACK_EXT_SELECTED_VERSION}" + ) + set(CPACK_EXT_SELECTED_MAJOR "${CMAKE_MATCH_1}") + set(CPACK_EXT_SELECTED_MINOR "${CMAKE_MATCH_2}") +endif() diff --git a/Modules/Internal/CPack/CPackFreeBSD.cmake b/Modules/Internal/CPack/CPackFreeBSD.cmake new file mode 100644 index 0000000..16f906c --- /dev/null +++ b/Modules/Internal/CPack/CPackFreeBSD.cmake @@ -0,0 +1,107 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +if(CMAKE_BINARY_DIR) + message(FATAL_ERROR "CPackFreeBSD.cmake may only be used by CPack internally.") +endif() + +if(NOT UNIX) + message(FATAL_ERROR "CPackFreeBSD.cmake may only be used under UNIX.") +endif() + + +### +# +# These bits are copied from the Debian packaging file; slightly modified. +# They are used for filling in FreeBSD-packaging variables that can take +# on values from elsewhere -- e.g. the package description may as well be +# copied from Debian. +# +function(_cpack_freebsd_fallback_var OUTPUT_VAR_NAME) + set(FALLBACK_VAR_NAMES ${ARGN}) + + set(VALUE "${${OUTPUT_VAR_NAME}}") + if(VALUE) + return() + endif() + + foreach(variable_name IN LISTS FALLBACK_VAR_NAMES) + if(${variable_name}) + set(${OUTPUT_VAR_NAME} "${${variable_name}}" PARENT_SCOPE) + set(VALUE "${${variable_name}}") + break() + endif() + endforeach() + if(NOT VALUE) + message(WARNING "Variable ${OUTPUT_VAR_NAME} could not be given a fallback value from any variable ${FALLBACK_VAR_NAMES}.") + endif() +endfunction() + +function(check_required_var VAR_NAME) + if(NOT ${VAR_NAME}) + message(FATAL_ERROR "Variable ${VAR_NAME} is not set.") + endif() +endfunction() + +set(_cpack_freebsd_fallback_origin "misc/bogus") + +_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_NAME" + "CPACK_PACKAGE_NAME" + "CMAKE_PROJECT_NAME" + ) + +set(_cpack_freebsd_fallback_www "http://example.com/?pkg=${CPACK_FREEBSD_PACKAGE_NAME}") + +_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_COMMENT" + "CPACK_PACKAGE_DESCRIPTION_SUMMARY" + ) + +# TODO: maybe read the PACKAGE_DESCRIPTION file for the longer +# FreeBSD pkg-descr? +_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_DESCRIPTION" + "CPACK_DEBIAN_PACKAGE_DESCRIPTION" + "CPACK_PACKAGE_DESCRIPTION_SUMMARY" + "PACKAGE_DESCRIPTION" + ) + +# There's really only one homepage for a project, so +# re-use the Debian setting if it's there. +_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_WWW" + "CMAKE_PROJECT_HOMEPAGE_URL" + "CPACK_DEBIAN_PACKAGE_HOMEPAGE" + "_cpack_freebsd_fallback_www" + ) + +_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_VERSION" + "CMAKE_PROJECT_VERSION" + "${CMAKE_PROJECT_NAME}_VERSION" + "PROJECT_VERSION" + "CPACK_PACKAGE_VERSION" + "CPACK_PACKAGE_VERSION" + ) + +_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_MAINTAINER" + "CPACK_PACKAGE_CONTACT" + ) + +_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_LICENSE" + "CPACK_RPM_PACKAGE_LICENSE" + ) + +_cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_ORIGIN" + "_cpack_freebsd_fallback_origin" + ) + +if(NOT CPACK_FREEBSD_PACKAGE_CATEGORIES) + string(REGEX REPLACE "/.*" "" CPACK_FREEBSD_PACKAGE_CATEGORIES ${CPACK_FREEBSD_PACKAGE_ORIGIN}) +endif() + +check_required_var("CPACK_FREEBSD_PACKAGE_NAME") +check_required_var("CPACK_FREEBSD_PACKAGE_ORIGIN") +check_required_var("CPACK_FREEBSD_PACKAGE_VERSION") +check_required_var("CPACK_FREEBSD_PACKAGE_MAINTAINER") +check_required_var("CPACK_FREEBSD_PACKAGE_COMMENT") +check_required_var("CPACK_FREEBSD_PACKAGE_DESCRIPTION") +check_required_var("CPACK_FREEBSD_PACKAGE_WWW") +check_required_var("CPACK_FREEBSD_PACKAGE_LICENSE") diff --git a/Modules/CPackNuGet.cmake b/Modules/Internal/CPack/CPackNuGet.cmake index 05403bc..198ccad 100644 --- a/Modules/CPackNuGet.cmake +++ b/Modules/Internal/CPack/CPackNuGet.cmake @@ -1,199 +1,6 @@ # 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 package 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) @@ -455,7 +262,7 @@ function(_cpack_nuget_render_spec) # 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" + "${CMAKE_ROOT}/Modules/CPack.NuGet.nuspec.in" "${CPACK_TEMPORARY_DIRECTORY}/CPack.NuGet.nuspec" @ONLY ) diff --git a/Modules/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake index 60b3abe..06298d7 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/Internal/CPack/CPackRPM.cmake @@ -1,963 +1,6 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -#.rst: -# CPackRPM -# -------- -# -# The built in (binary) CPack RPM generator (Unix only) -# -# Variables specific to CPack RPM generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# CPackRPM may be used to create RPM packages using :module:`CPack`. -# CPackRPM is a :module:`CPack` generator thus it uses the ``CPACK_XXX`` -# variables used by :module:`CPack`. -# -# CPackRPM has specific features which are controlled by the specifics -# :code:`CPACK_RPM_XXX` variables. -# -# :code:`CPACK_RPM_<COMPONENT>_XXXX` variables may be used in order to have -# **component** specific values. Note however that ``<COMPONENT>`` refers to the -# **grouping name** written in upper case. It may be either a component name or -# a component GROUP name. Usually those variables correspond to RPM spec file -# entities. One may find information about spec files here -# http://www.rpm.org/wiki/Docs -# -# .. note:: -# -# `<COMPONENT>` part of variables is preferred to be in upper case (for e.g. if -# component is named `foo` then use `CPACK_RPM_FOO_XXXX` variable name format) -# as is with other `CPACK_<COMPONENT>_XXXX` variables. -# For the purposes of back compatibility (CMake/CPack version 3.5 and lower) -# support for same cased component (e.g. `fOo` would be used as -# `CPACK_RPM_fOo_XXXX`) is still supported for variables defined in older -# versions of CMake/CPack but is not guaranteed for variables that -# will be added in the future. For the sake of back compatibility same cased -# component variables also override upper cased versions where both are -# present. -# -# Here are some CPackRPM wiki resources that are here for historic reasons and -# are no longer maintained but may still prove useful: -# -# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/Configuration -# - https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators#rpm-unix-only -# -# List of CPackRPM specific variables: -# -# .. variable:: CPACK_RPM_COMPONENT_INSTALL -# -# Enable component packaging for CPackRPM -# -# * Mandatory : NO -# * Default : OFF -# -# If enabled (ON) multiple packages are generated. By default a single package -# containing files of all components is generated. -# -# .. variable:: CPACK_RPM_PACKAGE_SUMMARY -# CPACK_RPM_<component>_PACKAGE_SUMMARY -# -# The RPM package summary. -# -# * Mandatory : YES -# * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` -# -# .. variable:: CPACK_RPM_PACKAGE_NAME -# CPACK_RPM_<component>_PACKAGE_NAME -# -# The RPM package name. -# -# * Mandatory : YES -# * Default : :variable:`CPACK_PACKAGE_NAME` -# -# .. variable:: CPACK_RPM_FILE_NAME -# CPACK_RPM_<component>_FILE_NAME -# -# Package file name. -# -# * Mandatory : YES -# * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].rpm`` with spaces -# replaced by '-' -# -# This may be set to ``RPM-DEFAULT`` to allow rpmbuild tool to generate package -# file name by itself. -# Alternatively provided package file name must end with ``.rpm`` suffix. -# -# .. note:: -# -# By using user provided spec file, rpm macro extensions such as for -# generating debuginfo packages or by simply using multiple components more -# than one rpm file may be generated, either from a single spec file or from -# multiple spec files (each component execution produces it's own spec file). -# In such cases duplicate file names may occur as a result of this variable -# setting or spec file content structure. Duplicate files get overwritten -# and it is up to the packager to set the variables in a manner that will -# prevent such errors. -# -# .. variable:: CPACK_RPM_MAIN_COMPONENT -# -# Main component that is packaged without component suffix. -# -# * Mandatory : NO -# * Default : - -# -# This variable can be set to any component or group name so that component or -# group rpm package is generated without component suffix in filename and -# package name. -# -# .. variable:: CPACK_RPM_PACKAGE_EPOCH -# -# The RPM package epoch -# -# * Mandatory : No -# * Default : - -# -# Optional number that should be incremented when changing versioning schemas -# or fixing mistakes in the version numbers of older packages. -# -# .. variable:: CPACK_RPM_PACKAGE_VERSION -# -# The RPM package version. -# -# * Mandatory : YES -# * Default : :variable:`CPACK_PACKAGE_VERSION` -# -# .. variable:: CPACK_RPM_PACKAGE_ARCHITECTURE -# CPACK_RPM_<component>_PACKAGE_ARCHITECTURE -# -# The RPM package architecture. -# -# * Mandatory : YES -# * Default : Native architecture output by ``uname -m`` -# -# This may be set to ``noarch`` if you know you are building a noarch package. -# -# .. variable:: CPACK_RPM_PACKAGE_RELEASE -# -# The RPM package release. -# -# * Mandatory : YES -# * Default : 1 -# -# This is the numbering of the RPM package itself, i.e. the version of the -# packaging and not the version of the content (see -# :variable:`CPACK_RPM_PACKAGE_VERSION`). One may change the default value if -# the previous packaging was buggy and/or you want to put here a fancy Linux -# distro specific numbering. -# -# .. note:: -# -# This is the string that goes into the RPM ``Release:`` field. Some distros -# (e.g. Fedora, CentOS) require ``1%{?dist}`` format and not just a number. -# ``%{?dist}`` part can be added by setting :variable:`CPACK_RPM_PACKAGE_RELEASE_DIST`. -# -# .. variable:: CPACK_RPM_PACKAGE_RELEASE_DIST -# -# The dist tag that is added RPM ``Release:`` field. -# -# * Mandatory : NO -# * Default : OFF -# -# This is the reported ``%{dist}`` tag from the current distribution or empty -# ``%{dist}`` if RPM macro is not set. If this variable is set then RPM -# ``Release:`` field value is set to ``${CPACK_RPM_PACKAGE_RELEASE}%{?dist}``. -# -# .. variable:: CPACK_RPM_PACKAGE_LICENSE -# -# The RPM package license policy. -# -# * Mandatory : YES -# * Default : "unknown" -# -# .. variable:: CPACK_RPM_PACKAGE_GROUP -# CPACK_RPM_<component>_PACKAGE_GROUP -# -# The RPM package group. -# -# * Mandatory : YES -# * Default : "unknown" -# -# .. variable:: CPACK_RPM_PACKAGE_VENDOR -# -# The RPM package vendor. -# -# * Mandatory : YES -# * Default : CPACK_PACKAGE_VENDOR if set or "unknown" -# -# .. variable:: CPACK_RPM_PACKAGE_URL -# CPACK_RPM_<component>_PACKAGE_URL -# -# The projects URL. -# -# * Mandatory : NO -# * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL` -# -# .. variable:: CPACK_RPM_PACKAGE_DESCRIPTION -# CPACK_RPM_<component>_PACKAGE_DESCRIPTION -# -# RPM package description. -# -# * Mandatory : YES -# * Default : :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION` (component -# based installers only) if set, :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` -# if set or "no package description available" -# -# .. variable:: CPACK_RPM_COMPRESSION_TYPE -# -# RPM compression type. -# -# * Mandatory : NO -# * Default : - -# -# May be used to override RPM compression type to be used to build the -# RPM. For example some Linux distribution now default to lzma or xz -# compression whereas older cannot use such RPM. Using this one can enforce -# compression type to be used. -# -# Possible values are: -# -# - lzma -# - xz -# - bzip2 -# - gzip -# -# .. variable:: CPACK_RPM_PACKAGE_AUTOREQ -# CPACK_RPM_<component>_PACKAGE_AUTOREQ -# -# RPM spec autoreq field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to enable (1, yes) or disable (0, no) automatic shared libraries -# dependency detection. Dependencies are added to requires list. -# -# .. note:: -# -# By default automatic dependency detection is enabled by rpm generator. -# -# .. variable:: CPACK_RPM_PACKAGE_AUTOPROV -# CPACK_RPM_<component>_PACKAGE_AUTOPROV -# -# RPM spec autoprov field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to enable (1, yes) or disable (0, no) automatic listing of shared -# libraries that are provided by the package. Shared libraries are added to -# provides list. -# -# .. note:: -# -# By default automatic provides detection is enabled by rpm generator. -# -# .. variable:: CPACK_RPM_PACKAGE_AUTOREQPROV -# CPACK_RPM_<component>_PACKAGE_AUTOREQPROV -# -# RPM spec autoreqprov field. -# -# * Mandatory : NO -# * Default : - -# -# Variable enables/disables autoreq and autoprov at the same time. -# See :variable:`CPACK_RPM_PACKAGE_AUTOREQ` and :variable:`CPACK_RPM_PACKAGE_AUTOPROV` -# for more details. -# -# .. note:: -# -# By default automatic detection feature is enabled by rpm. -# -# .. variable:: CPACK_RPM_PACKAGE_REQUIRES -# CPACK_RPM_<component>_PACKAGE_REQUIRES -# -# RPM spec requires field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM dependencies (requires). Note that you must enclose -# the complete requires string between quotes, for example:: -# -# set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8") -# -# The required package list of an RPM file could be printed with:: -# -# rpm -qp --requires file.rpm -# -# .. variable:: CPACK_RPM_PACKAGE_CONFLICTS -# CPACK_RPM_<component>_PACKAGE_CONFLICTS -# -# RPM spec conflicts field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set negative RPM dependencies (conflicts). Note that you must -# enclose the complete requires string between quotes, for example:: -# -# set(CPACK_RPM_PACKAGE_CONFLICTS "libxml2") -# -# The conflicting package list of an RPM file could be printed with:: -# -# rpm -qp --conflicts file.rpm -# -# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PRE -# CPACK_RPM_<component>_PACKAGE_REQUIRES_PRE -# -# RPM spec requires(pre) field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM preinstall dependencies (requires(pre)). Note that -# you must enclose the complete requires string between quotes, for example:: -# -# set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts") -# -# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POST -# CPACK_RPM_<component>_PACKAGE_REQUIRES_POST -# -# RPM spec requires(post) field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM postinstall dependencies (requires(post)). Note that -# you must enclose the complete requires string between quotes, for example:: -# -# set(CPACK_RPM_PACKAGE_REQUIRES_POST "shadow-utils, initscripts") -# -# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN -# CPACK_RPM_<component>_PACKAGE_REQUIRES_POSTUN -# -# RPM spec requires(postun) field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM postuninstall dependencies (requires(postun)). Note -# that you must enclose the complete requires string between quotes, for -# example:: -# -# set(CPACK_RPM_PACKAGE_REQUIRES_POSTUN "shadow-utils, initscripts") -# -# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN -# CPACK_RPM_<component>_PACKAGE_REQUIRES_PREUN -# -# RPM spec requires(preun) field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM preuninstall dependencies (requires(preun)). Note that -# you must enclose the complete requires string between quotes, for example:: -# -# set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts") -# -# .. variable:: CPACK_RPM_PACKAGE_SUGGESTS -# CPACK_RPM_<component>_PACKAGE_SUGGESTS -# -# RPM spec suggest field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set weak RPM dependencies (suggests). Note that you must -# enclose the complete requires string between quotes. -# -# .. variable:: CPACK_RPM_PACKAGE_PROVIDES -# CPACK_RPM_<component>_PACKAGE_PROVIDES -# -# RPM spec provides field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM dependencies (provides). The provided package list -# of an RPM file could be printed with:: -# -# rpm -qp --provides file.rpm -# -# .. variable:: CPACK_RPM_PACKAGE_OBSOLETES -# CPACK_RPM_<component>_PACKAGE_OBSOLETES -# -# RPM spec obsoletes field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM packages that are obsoleted by this one. -# -# .. variable:: CPACK_RPM_PACKAGE_RELOCATABLE -# -# build a relocatable RPM. -# -# * Mandatory : NO -# * Default : CPACK_PACKAGE_RELOCATABLE -# -# If this variable is set to TRUE or ON CPackRPM will try -# to build a relocatable RPM package. A relocatable RPM may -# be installed using:: -# -# rpm --prefix or --relocate -# -# in order to install it at an alternate place see rpm(8). Note that -# currently this may fail if :variable:`CPACK_SET_DESTDIR` is set to ``ON``. If -# :variable:`CPACK_SET_DESTDIR` is set then you will get a warning message but -# if there is file installed with absolute path you'll get unexpected behavior. -# -# .. variable:: CPACK_RPM_SPEC_INSTALL_POST -# -# Deprecated - use :variable:`CPACK_RPM_SPEC_MORE_DEFINE` instead. -# -# * Mandatory : NO -# * Default : - -# * Deprecated: YES -# -# 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 -# -# RPM extended spec definitions lines. -# -# * Mandatory : NO -# * Default : - -# -# 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 -# -# Toggle CPackRPM debug output. -# -# * Mandatory : NO -# * Default : - -# -# May be set when invoking cpack in order to trace debug information -# during CPack RPM run. For example you may launch CPack like this:: -# -# cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM -# -# .. variable:: CPACK_RPM_USER_BINARY_SPECFILE -# CPACK_RPM_<componentName>_USER_BINARY_SPECFILE -# -# A user provided spec file. -# -# * Mandatory : NO -# * Default : - -# -# May be set by the user in order to specify a USER binary spec file -# to be used by CPackRPM instead of generating the file. -# The specified file will be processed by configure_file( @ONLY). -# -# .. variable:: CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE -# -# Spec file template. -# -# * Mandatory : NO -# * Default : - -# -# If set CPack will generate a template for USER specified binary -# spec file and stop with an error. For example launch CPack like this:: -# -# cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM -# -# The user may then use this file in order to hand-craft is own -# binary spec file which may be used with -# :variable:`CPACK_RPM_USER_BINARY_SPECFILE`. -# -# .. variable:: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE -# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE -# -# Path to file containing pre (un)install script. -# -# * Mandatory : NO -# * Default : - -# -# May be used to embed a pre (un)installation script in the spec file. -# The referred script file (or both) will be read and directly -# put after the ``%pre`` or ``%preun`` section -# If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install -# script for each component can be overridden with -# ``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE`` and -# ``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``. -# One may verify which scriptlet has been included with:: -# -# rpm -qp --scripts package.rpm -# -# .. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE -# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE -# -# Path to file containing post (un)install script. -# -# * Mandatory : NO -# * Default : - -# -# May be used to embed a post (un)installation script in the spec file. -# The referred script file (or both) will be read and directly -# put after the ``%post`` or ``%postun`` section. -# If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install -# script for each component can be overridden with -# ``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE`` and -# ``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``. -# One may verify which scriptlet has been included with:: -# -# rpm -qp --scripts package.rpm -# -# .. variable:: CPACK_RPM_USER_FILELIST -# CPACK_RPM_<COMPONENT>_USER_FILELIST -# -# * Mandatory : NO -# * Default : - -# -# May be used to explicitly specify ``%(<directive>)`` file line -# in the spec file. Like ``%config(noreplace)`` or any other directive -# that be found in the ``%files`` section. You can have multiple directives -# per line, as in ``%attr(600,root,root) %config(noreplace)``. Since -# CPackRPM is generating the list of files (and directories) the user -# specified files of the ``CPACK_RPM_<COMPONENT>_USER_FILELIST`` list will -# be removed from the generated list. If referring to directories do -# not add a trailing slash. -# -# .. variable:: CPACK_RPM_CHANGELOG_FILE -# -# RPM changelog file. -# -# * Mandatory : NO -# * Default : - -# -# May be used to embed a changelog in the spec file. -# The referred file will be read and directly put after the ``%changelog`` -# section. -# -# .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST -# -# list of path to be excluded. -# -# * Mandatory : NO -# * Default : /etc /etc/init.d /usr /usr/bin /usr/include /usr/lib -# /usr/libx32 /usr/lib64 /usr/share /usr/share/aclocal -# /usr/share/doc -# -# May be used to exclude path (directories or files) from the auto-generated -# list of paths discovered by CPack RPM. The default value contains a -# reasonable set of values if the variable is not defined by the user. If the -# variable is defined by the user then CPackRPM will NOT any of the default -# path. If you want to add some path to the default list then you can use -# :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION` variable. -# -# .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION -# -# additional list of path to be excluded. -# -# * Mandatory : NO -# * Default : - -# -# May be used to add more exclude path (directories or files) from the initial -# default list of excluded paths. See -# :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST`. -# -# .. variable:: CPACK_RPM_RELOCATION_PATHS -# -# Packages relocation paths list. -# -# * Mandatory : NO -# * Default : - -# -# May be used to specify more than one relocation path per relocatable RPM. -# Variable contains a list of relocation paths that if relative are prefixed -# by the value of :variable:`CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX` or by the -# value of :variable:`CPACK_PACKAGING_INSTALL_PREFIX` if the component version -# is not provided. -# Variable is not component based as its content can be used to set a different -# path prefix for e.g. binary dir and documentation dir at the same time. -# Only prefixes that are required by a certain component are added to that -# component - component must contain at least one file/directory/symbolic link -# with :variable:`CPACK_RPM_RELOCATION_PATHS` prefix for a certain relocation -# path to be added. Package will not contain any relocation paths if there are -# no files/directories/symbolic links on any of the provided prefix locations. -# Packages that either do not contain any relocation paths or contain -# files/directories/symbolic links that are outside relocation paths print -# out an ``AUTHOR_WARNING`` that RPM will be partially relocatable. -# -# .. variable:: CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX -# -# Per component relocation path install prefix. -# -# * Mandatory : NO -# * Default : CPACK_PACKAGING_INSTALL_PREFIX -# -# May be used to set per component :variable:`CPACK_PACKAGING_INSTALL_PREFIX` -# for relocatable RPM packages. -# -# .. variable:: CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION -# CPACK_RPM_NO_<COMPONENT>_INSTALL_PREFIX_RELOCATION -# -# Removal of default install prefix from relocation paths list. -# -# * Mandatory : NO -# * Default : CPACK_PACKAGING_INSTALL_PREFIX or CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX -# are treated as one of relocation paths -# -# May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX -# from relocatable RPM prefix paths. -# -# .. variable:: CPACK_RPM_ADDITIONAL_MAN_DIRS -# -# * Mandatory : NO -# * Default : - -# -# May be used to set additional man dirs that could potentially be compressed -# by brp-compress RPM macro. Variable content must be a list of regular -# expressions that point to directories containing man files or to man files -# directly. Note that in order to compress man pages a path must also be -# present in brp-compress RPM script and that brp-compress script must be -# added to RPM configuration by the operating system. -# -# Regular expressions that are added by default were taken from brp-compress -# RPM macro: -# -# - /usr/man/man.* -# - /usr/man/.*/man.* -# - /usr/info.* -# - /usr/share/man/man.* -# - /usr/share/man/.*/man.* -# - /usr/share/info.* -# - /usr/kerberos/man.* -# - /usr/X11R6/man/man.* -# - /usr/lib/perl5/man/man.* -# - /usr/share/doc/.*/man/man.* -# - /usr/lib/.*/man/man.* -# -# .. variable:: CPACK_RPM_DEFAULT_USER -# CPACK_RPM_<compName>_DEFAULT_USER -# -# default user ownership of RPM content -# -# * Mandatory : NO -# * Default : root -# -# Value should be user name and not UID. -# Note that <compName> must be in upper-case. -# -# .. variable:: CPACK_RPM_DEFAULT_GROUP -# CPACK_RPM_<compName>_DEFAULT_GROUP -# -# default group ownership of RPM content -# -# * Mandatory : NO -# * Default : root -# -# Value should be group name and not GID. -# Note that <compName> must be in upper-case. -# -# .. variable:: CPACK_RPM_DEFAULT_FILE_PERMISSIONS -# CPACK_RPM_<compName>_DEFAULT_FILE_PERMISSIONS -# -# default permissions used for packaged files -# -# * Mandatory : NO -# * Default : - (system default) -# -# Accepted values are lists with ``PERMISSIONS``. Valid permissions -# are: -# -# - OWNER_READ -# - OWNER_WRITE -# - OWNER_EXECUTE -# - GROUP_READ -# - GROUP_WRITE -# - GROUP_EXECUTE -# - WORLD_READ -# - WORLD_WRITE -# - WORLD_EXECUTE -# -# Note that <compName> must be in upper-case. -# -# .. variable:: CPACK_RPM_DEFAULT_DIR_PERMISSIONS -# CPACK_RPM_<compName>_DEFAULT_DIR_PERMISSIONS -# -# default permissions used for packaged directories -# -# * Mandatory : NO -# * Default : - (system default) -# -# Accepted values are lists with PERMISSIONS. Valid permissions -# are the same as for :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`. -# Note that <compName> must be in upper-case. -# -# .. variable:: CPACK_RPM_INSTALL_WITH_EXEC -# -# force execute permissions on programs and shared libraries -# -# * Mandatory : NO -# * Default : - (system default) -# -# Force set owner, group and world execute permissions on programs and shared -# libraries. This can be used for creating valid rpm packages on systems such -# as Debian where shared libraries do not have execute permissions set. -# -# .. note:: -# -# Programs and shared libraries without execute permissions are ignored during -# separation of debug symbols from the binary for debuginfo packages. -# -# Packaging of Symbolic Links -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# CPackRPM supports packaging of symbolic links:: -# -# execute_process(COMMAND ${CMAKE_COMMAND} -# -E create_symlink <relative_path_location> <symlink_name>) -# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/<symlink_name> -# DESTINATION <symlink_location> COMPONENT libraries) -# -# Symbolic links will be optimized (paths will be shortened if possible) -# before being added to the package or if multiple relocation paths are -# detected, a post install symlink relocation script will be generated. -# -# Symbolic links may point to locations that are not packaged by the same -# package (either a different component or even not packaged at all) but -# those locations will be treated as if they were a part of the package -# while determining if symlink should be either created or present in a -# post install script - depending on relocation paths. -# -# Symbolic links that point to locations outside packaging path produce a -# warning and are treated as non relocatable permanent symbolic links. -# -# Currently there are a few limitations though: -# -# * For component based packaging component interdependency is not checked -# when processing symbolic links. Symbolic links pointing to content of -# a different component are treated the same way as if pointing to location -# that will not be packaged. -# -# * Symbolic links pointing to a location through one or more intermediate -# symbolic links will not be handled differently - if the intermediate -# symbolic link(s) is also on a relocatable path, relocating it during -# package installation may cause initial symbolic link to point to an -# invalid location. -# -# Packaging of debug information -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# Debuginfo packages contain debug symbols and sources for debugging packaged -# binaries. -# -# Debuginfo RPM packaging has it's own set of variables: -# -# .. variable:: CPACK_RPM_DEBUGINFO_PACKAGE -# CPACK_RPM_<component>_DEBUGINFO_PACKAGE -# -# Enable generation of debuginfo RPM package(s). -# -# * Mandatory : NO -# * Default : OFF -# -# .. note:: -# -# Binaries must contain debug symbols before packaging so use either ``Debug`` -# or ``RelWithDebInfo`` for :variable:`CMAKE_BUILD_TYPE` variable value. -# -# .. note:: -# -# Packages generated from packages without binary files, with binary files but -# without execute permissions or without debug symbols will cause packaging -# termination. -# -# .. variable:: CPACK_BUILD_SOURCE_DIRS -# -# Provides locations of root directories of source files from which binaries -# were built. -# -# * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set -# * Default : - -# -# .. note:: -# -# For CMake project :variable:`CPACK_BUILD_SOURCE_DIRS` is set by default to -# point to :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR` paths. -# -# .. note:: -# -# Sources with path prefixes that do not fall under any location provided with -# :variable:`CPACK_BUILD_SOURCE_DIRS` will not be present in debuginfo package. -# -# .. variable:: CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX -# CPACK_RPM_<component>_BUILD_SOURCE_DIRS_PREFIX -# -# Prefix of location where sources will be placed during package installation. -# -# * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set -# * Default : "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>" and -# for component packaging "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>-<component>" -# -# .. note:: -# -# Each source path prefix is additionally suffixed by ``src_<index>`` where -# index is index of the path used from :variable:`CPACK_BUILD_SOURCE_DIRS` -# variable. This produces ``<CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX>/src_<index>`` -# replacement path. -# Limitation is that replaced path part must be shorter or of equal -# length than the length of its replacement. If that is not the case either -# :variable:`CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX` variable has to be set to -# a shorter path or source directories must be placed on a longer path. -# -# .. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS -# -# Directories containing sources that should be excluded from debuginfo packages. -# -# * Mandatory : NO -# * Default : "/usr /usr/src /usr/src/debug" -# -# Listed paths are owned by other RPM packages and should therefore not be -# deleted on debuginfo package uninstallation. -# -# .. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION -# -# Paths that should be appended to :variable:`CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS` -# for exclusion. -# -# * Mandatory : NO -# * Default : - -# -# .. variable:: CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE -# -# Create a single debuginfo package even if components packaging is set. -# -# * Mandatory : NO -# * Default : OFF -# -# When this variable is enabled it produces a single debuginfo package even if -# component packaging is enabled. -# -# When using this feature in combination with components packaging and there is -# more than one component this variable requires :variable:`CPACK_RPM_MAIN_COMPONENT` -# to be set. -# -# .. note:: -# -# If none of the :variable:`CPACK_RPM_<component>_DEBUGINFO_PACKAGE` variables -# is set then :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is automatically set to -# ``ON`` when :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` is set. -# -# .. variable:: CPACK_RPM_DEBUGINFO_FILE_NAME -# CPACK_RPM_<component>_DEBUGINFO_FILE_NAME -# -# Debuginfo package file name. -# -# * Mandatory : NO -# * Default : rpmbuild tool generated package file name -# -# Alternatively provided debuginfo package file name must end with ``.rpm`` -# suffix and should differ from file names of other generated packages. -# -# Variable may contain ``@cpack_component@`` placeholder which will be -# replaced by component name if component packaging is enabled otherwise it -# deletes the placeholder. -# -# Setting the variable to ``RPM-DEFAULT`` may be used to explicitly set -# filename generation to default. -# -# .. note:: -# -# :variable:`CPACK_RPM_FILE_NAME` also supports rpmbuild tool generated package -# file name - disabled by default but can be enabled by setting the variable to -# ``RPM-DEFAULT``. -# -# Packaging of sources (SRPM) -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# SRPM packaging is enabled by setting :variable:`CPACK_RPM_PACKAGE_SOURCES` -# 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 produced by executing:: -# -# cpack -G RPM --config ./CPackSourceConfig.cmake -# -# .. note:: -# -# Produced SRPM package is expected to be built with :manual:`cmake(1)` executable -# and packaged with :manual:`cpack(1)` executable so CMakeLists.txt has to be -# located in root source directory and must be able to generate binary rpm -# packages by executing ``cpack -G`` command. The two executables as well as -# rpmbuild must also be present when generating binary rpm packages from the -# produced SRPM package. -# -# 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:: -# -# 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. -# -# .. note:: -# -# SRPM package internally uses CPack/RPM generator to generate binary packages -# so CMakeScripts.txt can decide during the SRPM to binary rpm generation step -# what content the package(s) should have as well as how they should be packaged -# (monolithic or components). CMake can decide this for e.g. by reading environment -# variables set by the package manager before starting the process of generating -# binary rpm packages. This way a single SRPM package can be used to produce -# different binary rpm packages on different platforms depending on the platform's -# packaging rules. -# -# Source RPM packaging has it's own set of variables: -# -# .. variable:: CPACK_RPM_PACKAGE_SOURCES -# -# Should the content be packaged as a source rpm (default is binary rpm). -# -# * Mandatory : NO -# * Default : OFF -# -# .. note:: -# -# For cmake projects :variable:`CPACK_RPM_PACKAGE_SOURCES` variable is set -# to ``OFF`` in CPackConfig.cmake and ``ON`` in CPackSourceConfig.cmake -# generated files. -# -# .. variable:: CPACK_RPM_SOURCE_PKG_BUILD_PARAMS -# -# Additional command-line parameters provided to :manual:`cmake(1)` executable. -# -# * Mandatory : NO -# * Default : - -# -# .. variable:: CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX -# -# Packaging install prefix that would be provided in :variable:`CPACK_PACKAGING_INSTALL_PREFIX` -# variable for producing binary RPM packages. -# -# * Mandatory : YES -# * Default : "/" -# -# .. VARIABLE:: CPACK_RPM_BUILDREQUIRES -# -# List of source rpm build dependencies. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set source RPM build dependencies (BuildRequires). Note that -# you must enclose the complete build requirements string between quotes, for -# example:: -# -# set(CPACK_RPM_BUILDREQUIRES "python >= 2.5.0, cmake >= 2.8") - # Author: Eric Noulard with the help of Alexander Neundorf. function(get_file_permissions FILE RETURN_VAR) @@ -2482,7 +1525,7 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES} %build mkdir cpack_rpm_build_dir cd cpack_rpm_build_dir -cmake ${CPACK_RPM_SOURCE_PKG_BUILD_PARAMS} -DCPACK_PACKAGING_INSTALL_PREFIX=${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX} ../${CPACK_PACKAGE_FILE_NAME} +'${CMAKE_COMMAND}' ${CPACK_RPM_SOURCE_PKG_BUILD_PARAMS} -DCPACK_PACKAGING_INSTALL_PREFIX=${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX} ../${CPACK_PACKAGE_FILE_NAME} make %{?_smp_mflags}" # %{?_smp_mflags} -> -j option ) set(TMP_RPM_INSTALL diff --git a/Modules/Internal/CPack/CPackWIX.cmake b/Modules/Internal/CPack/CPackWIX.cmake new file mode 100644 index 0000000..d1875f2 --- /dev/null +++ b/Modules/Internal/CPack/CPackWIX.cmake @@ -0,0 +1,20 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +if(NOT CPACK_WIX_ROOT) + string(REPLACE "\\" "/" CPACK_WIX_ROOT "$ENV{WIX}") +endif() + +find_program(CPACK_WIX_CANDLE_EXECUTABLE candle + PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin") + +if(NOT CPACK_WIX_CANDLE_EXECUTABLE) + message(FATAL_ERROR "Could not find the WiX candle executable.") +endif() + +find_program(CPACK_WIX_LIGHT_EXECUTABLE light + PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin") + +if(NOT CPACK_WIX_LIGHT_EXECUTABLE) + message(FATAL_ERROR "Could not find the WiX light executable.") +endif() diff --git a/Modules/CPackZIP.cmake b/Modules/Internal/CPack/CPackZIP.cmake index 376520c..f619de4 100644 --- a/Modules/CPackZIP.cmake +++ b/Modules/Internal/CPack/CPackZIP.cmake @@ -28,4 +28,3 @@ if(NOT ZIP_EXECUTABLE) set(CPACK_ZIP_NEED_QUOTES FALSE) endif() endif() - diff --git a/Modules/Platform/Apple-Intel.cmake b/Modules/Platform/Apple-Intel.cmake index 2d4f7e5..a854be9 100644 --- a/Modules/Platform/Apple-Intel.cmake +++ b/Modules/Platform/Apple-Intel.cmake @@ -10,6 +10,9 @@ macro(__apple_compiler_intel lang) set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") endif() diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake index bf61d7b..9b384df 100644 --- a/Modules/Platform/GHS-MULTI-Initialize.cmake +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -1,40 +1,44 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. +#Setup Green Hills MULTI specific compilation information -#Setup Greenhills MULTI specific compilation information - -if (NOT GHS_INT_DIRECTORY) - #Assume the C:/ghs/int#### directory that is latest is preferred - set(GHS_EXPECTED_ROOT "C:/ghs") - if (EXISTS ${GHS_EXPECTED_ROOT}) - FILE(GLOB GHS_CANDIDATE_INT_DIRS RELATIVE - ${GHS_EXPECTED_ROOT} ${GHS_EXPECTED_ROOT}/*) - string(REGEX MATCHALL "int[0-9][0-9][0-9][0-9a-z]" GHS_CANDIDATE_INT_DIRS - ${GHS_CANDIDATE_INT_DIRS}) - if (GHS_CANDIDATE_INT_DIRS) - list(SORT GHS_CANDIDATE_INT_DIRS) - list(GET GHS_CANDIDATE_INT_DIRS -1 GHS_INT_DIRECTORY) - string(CONCAT GHS_INT_DIRECTORY ${GHS_EXPECTED_ROOT} "/" - ${GHS_INT_DIRECTORY}) +set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory") +mark_as_advanced(GHS_OS_ROOT) + +set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory") +mark_as_advanced(GHS_OS_DIR) + +#set GHS_OS_DIR if not set by user +if ( NOT GHS_OS_DIR ) + if (EXISTS ${GHS_OS_ROOT}) + + #get all directories in root directory + FILE(GLOB GHS_CANDIDATE_OS_DIRS + LIST_DIRECTORIES true RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*) + FILE(GLOB GHS_CANDIDATE_OS_FILES + LIST_DIRECTORIES false RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*) + if ( GHS_CANDIDATE_OS_FILES ) + list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES}) endif () - endif () - #Try to look for known registry values - if (NOT GHS_INT_DIRECTORY) - find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122 - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104 - ) - endif () + #filter based on platform name + if (GHS_TARGET_PLATFORM STREQUAL "integrity") + list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z].*") + endif () + + if (GHS_CANDIDATE_OS_DIRS) + list(SORT GHS_CANDIDATE_OS_DIRS) + list(GET GHS_CANDIDATE_OS_DIRS -1 GHS_OS_DIR) + string(CONCAT GHS_OS_DIR ${GHS_OS_ROOT} "/" ${GHS_OS_DIR}) + endif() - set(GHS_INT_DIRECTORY ${GHS_INT_DIRECTORY} CACHE PATH - "Path to integrity directory") + set(GHS_OS_DIR "${GHS_OS_DIR}" CACHE PATH "GHS platform OS directory" FORCE) + endif () endif () -set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory") -set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation") -set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name") +set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name") + set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization") mark_as_advanced(GHS_CUSTOMIZATION) set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons") diff --git a/Modules/Platform/Generic-ADSP-C.cmake b/Modules/Platform/Generic-ADSP-C.cmake index de1cee2..c8597cd 100644 --- a/Modules/Platform/Generic-ADSP-C.cmake +++ b/Modules/Platform/Generic-ADSP-C.cmake @@ -9,6 +9,9 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " ") string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ") string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO_INIT " ") +set(CMAKE_C_LINKER_WRAPPER_FLAG "-flags-link" " ") +set(CMAKE_C_LINKER_WRAPPER_FLAG_SEP ",") + set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_C_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_C_LINK_FLAGS> <OBJECTS>") @@ -17,4 +20,3 @@ set(CMAKE_C_LINK_EXECUTABLE set(CMAKE_C_CREATE_SHARED_LIBRARY) set(CMAKE_C_CREATE_MODULE_LIBRARY) - diff --git a/Modules/Platform/Generic-ADSP-CXX.cmake b/Modules/Platform/Generic-ADSP-CXX.cmake index 0cde8f2..d76bb66 100644 --- a/Modules/Platform/Generic-ADSP-CXX.cmake +++ b/Modules/Platform/Generic-ADSP-CXX.cmake @@ -7,6 +7,9 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " ") string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ") string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT " ") +set(CMAKE_CXX_LINKER_WRAPPER_FLAG "-flags-link" " ") +set(CMAKE_CXX_LINKER_WRAPPER_FLAG_SEP ",") + set(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_CXX_COMPILER> -build-lib -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o <TARGET> <CMAKE_CXX_LINK_FLAGS> <OBJECTS>") @@ -15,4 +18,3 @@ set(CMAKE_CXX_LINK_EXECUTABLE set(CMAKE_CXX_CREATE_SHARED_LIBRARY) set(CMAKE_CXX_CREATE_MODULE_LIBRARY) - diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake index 4b3912a..aef4abf 100644 --- a/Modules/Platform/Generic-SDCC-C.cmake +++ b/Modules/Platform/Generic-SDCC-C.cmake @@ -37,6 +37,8 @@ if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) set (CMAKE_EXE_LINKER_FLAGS_INIT --model-small) endif() +set(CMAKE_C_LINKER_WRAPPER_FLAG "-Wl" ",") + # compile a C file into an object file set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") @@ -51,4 +53,3 @@ set(CMAKE_C_CREATE_STATIC_LIBRARY # not supported by sdcc set(CMAKE_C_CREATE_SHARED_LIBRARY "") set(CMAKE_C_CREATE_MODULE_LIBRARY "") - diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake index ee9aac2..f712e2b 100644 --- a/Modules/Platform/Linux-Intel.cmake +++ b/Modules/Platform/Linux-Intel.cmake @@ -30,6 +30,9 @@ macro(__linux_compiler_intel lang) # executables that use dlopen but do not set ENABLE_EXPORTS. set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") + set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) if(XIAR) diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index f8e1c9e..48b936e 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -76,6 +76,8 @@ macro(__embarcadero_language lang) set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "${_tD}") # ... while this is a space separated string. set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1) + set (CMAKE_${lang}_LINKER_WRAPPER_FLAG "-l") + # compile a source file into an object file # place <DEFINES> outside the response file because Borland refuses # to parse quotes from the response file. diff --git a/Modules/Platform/WindowsPhone-Clang-C.cmake b/Modules/Platform/WindowsPhone-Clang-C.cmake new file mode 100644 index 0000000..6e38572 --- /dev/null +++ b/Modules/Platform/WindowsPhone-Clang-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Clang-C) diff --git a/Modules/Platform/WindowsPhone-Clang-CXX.cmake b/Modules/Platform/WindowsPhone-Clang-CXX.cmake new file mode 100644 index 0000000..bf47978 --- /dev/null +++ b/Modules/Platform/WindowsPhone-Clang-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Clang-CXX) diff --git a/Modules/Platform/WindowsPhone-GNU-C.cmake b/Modules/Platform/WindowsPhone-GNU-C.cmake new file mode 100644 index 0000000..ff6acd5 --- /dev/null +++ b/Modules/Platform/WindowsPhone-GNU-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-C) diff --git a/Modules/Platform/WindowsPhone-GNU-CXX.cmake b/Modules/Platform/WindowsPhone-GNU-CXX.cmake new file mode 100644 index 0000000..6adab6a --- /dev/null +++ b/Modules/Platform/WindowsPhone-GNU-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-CXX) diff --git a/Modules/Platform/WindowsStore-Clang-C.cmake b/Modules/Platform/WindowsStore-Clang-C.cmake new file mode 100644 index 0000000..6e38572 --- /dev/null +++ b/Modules/Platform/WindowsStore-Clang-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Clang-C) diff --git a/Modules/Platform/WindowsStore-Clang-CXX.cmake b/Modules/Platform/WindowsStore-Clang-CXX.cmake new file mode 100644 index 0000000..bf47978 --- /dev/null +++ b/Modules/Platform/WindowsStore-Clang-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-Clang-CXX) diff --git a/Modules/Platform/WindowsStore-GNU-C.cmake b/Modules/Platform/WindowsStore-GNU-C.cmake new file mode 100644 index 0000000..ff6acd5 --- /dev/null +++ b/Modules/Platform/WindowsStore-GNU-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-C) diff --git a/Modules/Platform/WindowsStore-GNU-CXX.cmake b/Modules/Platform/WindowsStore-GNU-CXX.cmake new file mode 100644 index 0000000..6adab6a --- /dev/null +++ b/Modules/Platform/WindowsStore-GNU-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-CXX) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index b306181..7460932 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -117,6 +117,13 @@ ensure generated files will receive the required settings. :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and :prop_sf:`COMPILE_OPTIONS`. +``USE_TARGET_INCLUDE_DIRECTORIES`` + If set to ``TRUE``, contents of target property + :prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler. + If set to ``FALSE`` target property :prop_tgt:`INCLUDE_DIRECTORIES` will be + ignored. If not set, target property ``SWIG_USE_TARGT_INCLUDE_DIRECTORIES`` + will be considered. + ``GENERATED_INCLUDE_DIRECTORIES``, ``GENERATED_COMPILE_DEFINITIONS`` and ``GENERATED_COMPILE_OPTIONS`` Add custom flags to the C/C++ generated source. They will fill, respectively, properties :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and @@ -149,6 +156,13 @@ input files. set_property(TARGET mymod PROPERTY SWIG_COMPILE_DEFINITIONS MY_DEF1 MY_DEF2) set_property(TARGET mymod PROPERTY SWIG_COMPILE_OPTIONS -bla -blb) +``SWIG_USE_TARGET_INCLUDE_DIRECTORIES`` + If set to ``TRUE``, contents of target property + :prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler. + If set to ``FALSE`` or not defined, target property + :prop_tgt:`INCLUDE_DIRECTORIES` will be ignored. This behavior can be + overridden by specifying source property ``USE_TARGET_INCLUDE_DIRECTORIES``. + ``SWIG_GENERATED_INCLUDE_DIRECTORIES``, ``SWIG_GENERATED_COMPILE_DEFINITIONS`` and ``SWIG_GENERATED_COMPILE_OPTIONS`` These properties will populate, respectively, properties :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and @@ -294,7 +308,7 @@ function(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile) endif() foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSIONS}) set(extra_file "${generatedpath}/${module_basename}${it}") - if (extra_file MATCHES "\\.cs$") + if (extra_file MATCHES "\\.cs$" AND CMAKE_CSharp_COMPILER_LOADED) set_source_files_properties(${extra_file} PROPERTIES LANGUAGE "CSharp") else() # Treat extra outputs as plain files regardless of language. @@ -346,6 +360,14 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) endif() set (property "$<TARGET_PROPERTY:${target_name},SWIG_INCLUDE_DIRECTORIES>") list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:$<TARGET_GENEX_EVAL:${target_name},${property}>,$<SEMICOLON>-I>>") + set (property "$<TARGET_PROPERTY:${target_name},INCLUDE_DIRECTORIES>") + get_source_file_property(use_target_include_dirs "${infile}" USE_TARGET_INCLUDE_DIRECTORIES) + if (use_target_include_dirs) + list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:${property},$<SEMICOLON>-I>>") + elseif(use_target_include_dirs STREQUAL "NOTFOUND") + # not defined at source level, rely on target level + list (APPEND swig_source_file_flags "$<$<AND:$<BOOL:$<TARGET_PROPERTY:${target_name},SWIG_USE_TARGET_INCLUDE_DIRECTORIES>>,$<BOOL:${property}>>:-I$<JOIN:${property},$<SEMICOLON>-I>>") + endif() set (property "$<TARGET_PROPERTY:${target_name},SWIG_COMPILE_DEFINITIONS>") list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-D$<JOIN:$<TARGET_GENEX_EVAL:${target_name},${property}>,$<SEMICOLON>-D>>") diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 30bef74..0457984 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -379,6 +379,8 @@ set(SRCS cmAddCompileDefinitionsCommand.h cmAddCompileOptionsCommand.cxx cmAddCompileOptionsCommand.h + cmAddLinkOptionsCommand.cxx + cmAddLinkOptionsCommand.h cmAddCustomCommandCommand.cxx cmAddCustomCommandCommand.h cmAddCustomTargetCommand.cxx @@ -574,6 +576,8 @@ set(SRCS cmTargetCompileOptionsCommand.h cmTargetIncludeDirectoriesCommand.cxx cmTargetIncludeDirectoriesCommand.h + cmTargetLinkOptionsCommand.cxx + cmTargetLinkOptionsCommand.h cmTargetLinkLibrariesCommand.cxx cmTargetLinkLibrariesCommand.h cmTargetPropCommandBase.cxx @@ -882,6 +886,8 @@ include_directories( set(CPACK_SRCS CPack/cmCPackArchiveGenerator.cxx CPack/cmCPackComponentGroup.cxx + CPack/cmCPackDebGenerator.cxx + CPack/cmCPackExtGenerator.cxx CPack/cmCPackGeneratorFactory.cxx CPack/cmCPackGenerator.cxx CPack/cmCPackLog.cxx @@ -894,7 +900,6 @@ set(CPACK_SRCS CPack/cmCPackTarCompressGenerator.cxx CPack/cmCPackZIPGenerator.cxx CPack/cmCPack7zGenerator.cxx - CPack/cmCPackDebGenerator.cxx ) # CPack IFW generator set(CPACK_SRCS ${CPACK_SRCS} diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 24f74e4..f4e59af 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 12) -set(CMake_VERSION_PATCH 0) -#set(CMake_VERSION_RC 0) +set(CMake_VERSION_PATCH 20180720) +#set(CMake_VERSION_RC 1) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index e06efda..398ebd3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -100,6 +100,10 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile, command << " -ext " << QuotePath(ext); } + if (sourceFile.rfind(this->CPackTopLevel, 0) != 0) { + command << " " << QuotePath("-I" + this->CPackTopLevel); + } + AddCustomFlags("CPACK_WIX_CANDLE_EXTRA_FLAGS", command); command << " " << QuotePath(sourceFile); @@ -148,7 +152,7 @@ int cmCPackWIXGenerator::PackageFiles() bool cmCPackWIXGenerator::InitializeWiXConfiguration() { - if (!ReadListFile("CPackWIX.cmake")) { + if (!ReadListFile("Internal/CPack/CPackWIX.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while executing CPackWIX.cmake" << std::endl); return false; diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index b734bb4..593b4bf 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -106,15 +106,15 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( gf.Open((filename).c_str(), false, true); \ if (!GenerateHeader(&gf)) { \ cmCPackLogger(cmCPackLog::LOG_ERROR, \ - "Problem to generate Header for archive < " \ + "Problem to generate Header for archive <" \ << (filename) << ">." << std::endl); \ return 0; \ } \ cmArchiveWrite archive(gf, this->Compress, this->ArchiveFormat); \ if (!(archive)) { \ cmCPackLogger(cmCPackLog::LOG_ERROR, \ - "Problem to create archive < " \ - << (filename) << ">. ERROR =" << (archive).GetError() \ + "Problem to create archive <" \ + << (filename) << ">, ERROR = " << (archive).GetError() \ << std::endl); \ return 0; \ } @@ -262,9 +262,9 @@ int cmCPackArchiveGenerator::PackageFiles() archive.Add(rp, 0, nullptr, false); if (!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem while adding file< " + "Problem while adding file <" << file << "> to archive <" << packageFileNames[0] - << "> .ERROR =" << archive.GetError() << std::endl); + << ">, ERROR = " << archive.GetError() << std::endl); return 0; } } diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index f2907db..bb980d7 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -143,4 +143,29 @@ public: std::vector<cmCPackComponentGroup*> Subgroups; }; +/** \class cmCPackInstallCMakeProject + * \brief A single quadruplet from the CPACK_INSTALL_CMAKE_PROJECTS variable. + */ +class cmCPackInstallCMakeProject +{ +public: + /// The directory of the CMake project. + std::string Directory; + + /// The name of the CMake project. + std::string ProjectName; + + /// The name of the component (or component set) to install. + std::string Component; + + /// The subdirectory to install into. + std::string SubDirectory; + + /// The list of installation types. + std::vector<cmCPackInstallationType*> InstallationTypes; + + /// The list of components. + std::vector<cmCPackComponent*> Components; +}; + #endif diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 8a4c004..c53dd32 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -61,7 +61,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, component_path += packageName; this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH", component_path.c_str()); - if (!this->ReadListFile("CPackDeb.cmake")) { + if (!this->ReadListFile("Internal/CPack/CPackDeb.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackDeb.cmake" << std::endl); retval = 0; @@ -179,7 +179,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne( this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH", component_path.c_str()); } - if (!this->ReadListFile("CPackDeb.cmake")) { + if (!this->ReadListFile("Internal/CPack/CPackDeb.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackDeb.cmake" << std::endl); retval = 0; diff --git a/Source/CPack/cmCPackExtGenerator.cxx b/Source/CPack/cmCPackExtGenerator.cxx new file mode 100644 index 0000000..c36b098 --- /dev/null +++ b/Source/CPack/cmCPackExtGenerator.cxx @@ -0,0 +1,291 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmCPackExtGenerator.h" + +#include "cmAlgorithms.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackLog.h" +#include "cmSystemTools.h" + +#include "cm_jsoncpp_value.h" +#include "cm_jsoncpp_writer.h" + +#include "cmsys/FStream.hxx" + +#include <utility> +#include <vector> + +int cmCPackExtGenerator::InitializeInternal() +{ + this->SetOption("CPACK_EXT_KNOWN_VERSIONS", "1.0"); + + if (!this->ReadListFile("Internal/CPack/CPackExt.cmake")) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error while executing CPackExt.cmake" << std::endl); + return 0; + } + + std::string major = this->GetOption("CPACK_EXT_SELECTED_MAJOR"); + if (major == "1") { + this->Generator = cm::make_unique<cmCPackExtVersion1Generator>(this); + } + + return this->Superclass::InitializeInternal(); +} + +int cmCPackExtGenerator::PackageFiles() +{ + Json::StreamWriterBuilder builder; + builder["indentation"] = " "; + + std::string filename = "package.json"; + if (!this->packageFileNames.empty()) { + filename = this->packageFileNames[0]; + } + + cmsys::ofstream fout(filename.c_str()); + std::unique_ptr<Json::StreamWriter> jout(builder.newStreamWriter()); + + Json::Value root(Json::objectValue); + + if (!this->Generator->WriteToJSON(root)) { + return 0; + } + + if (jout->write(root, &fout)) { + return 0; + } + + return 1; +} + +bool cmCPackExtGenerator::SupportsComponentInstallation() const +{ + return true; +} + +int cmCPackExtGenerator::InstallProjectViaInstallCommands( + bool setDestDir, const std::string& tempInstallDirectory) +{ + (void)setDestDir; + (void)tempInstallDirectory; + return 1; +} + +int cmCPackExtGenerator::InstallProjectViaInstallScript( + bool setDestDir, const std::string& tempInstallDirectory) +{ + (void)setDestDir; + (void)tempInstallDirectory; + return 1; +} + +int cmCPackExtGenerator::InstallProjectViaInstalledDirectories( + bool setDestDir, const std::string& tempInstallDirectory, + const mode_t* default_dir_mode) +{ + (void)setDestDir; + (void)tempInstallDirectory; + (void)default_dir_mode; + return 1; +} + +int cmCPackExtGenerator::RunPreinstallTarget( + const std::string& installProjectName, const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, const std::string& buildConfig) +{ + (void)installProjectName; + (void)installDirectory; + (void)globalGenerator; + (void)buildConfig; + return 1; +} + +int cmCPackExtGenerator::InstallCMakeProject( + bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode, + const std::string& component, bool componentInstall, + const std::string& installSubDirectory, const std::string& buildConfig, + std::string& absoluteDestFiles) +{ + (void)setDestDir; + (void)installDirectory; + (void)baseTempInstallDirectory; + (void)default_dir_mode; + (void)component; + (void)componentInstall; + (void)installSubDirectory; + (void)buildConfig; + (void)absoluteDestFiles; + return 1; +} + +cmCPackExtGenerator::cmCPackExtVersionGenerator::cmCPackExtVersionGenerator( + cmCPackExtGenerator* parent) + : Parent(parent) +{ +} + +int cmCPackExtGenerator::cmCPackExtVersionGenerator::WriteVersion( + Json::Value& root) +{ + root["formatVersionMajor"] = this->GetVersionMajor(); + root["formatVersionMinor"] = this->GetVersionMinor(); + + return 1; +} + +int cmCPackExtGenerator::cmCPackExtVersionGenerator::WriteToJSON( + Json::Value& root) +{ + if (!this->WriteVersion(root)) { + return 0; + } + + const char* packageName = this->Parent->GetOption("CPACK_PACKAGE_NAME"); + if (packageName) { + root["packageName"] = packageName; + } + + const char* packageVersion = + this->Parent->GetOption("CPACK_PACKAGE_VERSION"); + if (packageVersion) { + root["packageVersion"] = packageVersion; + } + + const char* packageDescriptionFile = + this->Parent->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE"); + if (packageDescriptionFile) { + root["packageDescriptionFile"] = packageDescriptionFile; + } + + const char* packageDescriptionSummary = + this->Parent->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY"); + if (packageDescriptionSummary) { + root["packageDescriptionSummary"] = packageDescriptionSummary; + } + + const char* buildConfigCstr = this->Parent->GetOption("CPACK_BUILD_CONFIG"); + if (buildConfigCstr) { + root["buildConfig"] = buildConfigCstr; + } + + const char* defaultDirectoryPermissions = + this->Parent->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); + if (defaultDirectoryPermissions && *defaultDirectoryPermissions) { + root["defaultDirectoryPermissions"] = defaultDirectoryPermissions; + } + if (cmSystemTools::IsInternallyOn( + this->Parent->GetOption("CPACK_SET_DESTDIR"))) { + root["setDestdir"] = true; + root["packagingInstallPrefix"] = + this->Parent->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); + } else { + root["setDestdir"] = false; + } + + root["stripFiles"] = + !cmSystemTools::IsOff(this->Parent->GetOption("CPACK_STRIP_FILES")); + root["warnOnAbsoluteInstallDestination"] = + this->Parent->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION"); + root["errorOnAbsoluteInstallDestination"] = + this->Parent->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION"); + + Json::Value& projects = root["projects"] = Json::Value(Json::arrayValue); + for (auto& project : this->Parent->CMakeProjects) { + Json::Value jsonProject(Json::objectValue); + + jsonProject["projectName"] = project.ProjectName; + jsonProject["component"] = project.Component; + jsonProject["directory"] = project.Directory; + jsonProject["subDirectory"] = project.SubDirectory; + + Json::Value& installationTypes = jsonProject["installationTypes"] = + Json::Value(Json::arrayValue); + for (auto& installationType : project.InstallationTypes) { + installationTypes.append(installationType->Name); + } + + Json::Value& components = jsonProject["components"] = + Json::Value(Json::arrayValue); + for (auto& component : project.Components) { + components.append(component->Name); + } + + projects.append(jsonProject); + } + + Json::Value& installationTypes = root["installationTypes"] = + Json::Value(Json::objectValue); + for (auto& installationType : this->Parent->InstallationTypes) { + Json::Value& jsonInstallationType = + installationTypes[installationType.first] = + Json::Value(Json::objectValue); + + jsonInstallationType["name"] = installationType.second.Name; + jsonInstallationType["displayName"] = installationType.second.DisplayName; + jsonInstallationType["index"] = installationType.second.Index; + } + + Json::Value& components = root["components"] = + Json::Value(Json::objectValue); + for (auto& component : this->Parent->Components) { + Json::Value& jsonComponent = components[component.first] = + Json::Value(Json::objectValue); + + jsonComponent["name"] = component.second.Name; + jsonComponent["displayName"] = component.second.DisplayName; + if (component.second.Group) { + jsonComponent["group"] = component.second.Group->Name; + } + jsonComponent["isRequired"] = component.second.IsRequired; + jsonComponent["isHidden"] = component.second.IsHidden; + jsonComponent["isDisabledByDefault"] = + component.second.IsDisabledByDefault; + jsonComponent["isDownloaded"] = component.second.IsDownloaded; + jsonComponent["description"] = component.second.Description; + jsonComponent["archiveFile"] = component.second.ArchiveFile; + + Json::Value& cmpInstallationTypes = jsonComponent["installationTypes"] = + Json::Value(Json::arrayValue); + for (auto& installationType : component.second.InstallationTypes) { + cmpInstallationTypes.append(installationType->Name); + } + + Json::Value& dependencies = jsonComponent["dependencies"] = + Json::Value(Json::arrayValue); + for (auto& dep : component.second.Dependencies) { + dependencies.append(dep->Name); + } + } + + Json::Value& groups = root["componentGroups"] = + Json::Value(Json::objectValue); + for (auto& group : this->Parent->ComponentGroups) { + Json::Value& jsonGroup = groups[group.first] = + Json::Value(Json::objectValue); + + jsonGroup["name"] = group.second.Name; + jsonGroup["displayName"] = group.second.DisplayName; + jsonGroup["description"] = group.second.Description; + jsonGroup["isBold"] = group.second.IsBold; + jsonGroup["isExpandedByDefault"] = group.second.IsExpandedByDefault; + if (group.second.ParentGroup) { + jsonGroup["parentGroup"] = group.second.ParentGroup->Name; + } + + Json::Value& subgroups = jsonGroup["subgroups"] = + Json::Value(Json::arrayValue); + for (auto& subgroup : group.second.Subgroups) { + subgroups.append(subgroup->Name); + } + + Json::Value& groupComponents = jsonGroup["components"] = + Json::Value(Json::arrayValue); + for (auto& component : group.second.Components) { + groupComponents.append(component->Name); + } + } + + return 1; +} diff --git a/Source/CPack/cmCPackExtGenerator.h b/Source/CPack/cmCPackExtGenerator.h new file mode 100644 index 0000000..fa12d7f --- /dev/null +++ b/Source/CPack/cmCPackExtGenerator.h @@ -0,0 +1,86 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmCPackExtGenerator_h +#define cmCPackExtGenerator_h + +#include "cmCPackGenerator.h" +#include "cm_sys_stat.h" + +#include <memory> +#include <string> + +class cmGlobalGenerator; +namespace Json { +class Value; +} + +/** \class cmCPackExtGenerator + * \brief A generator for CPack External packaging tools + */ +class cmCPackExtGenerator : public cmCPackGenerator +{ +public: + cmCPackTypeMacro(cmCPackExtGenerator, cmCPackGenerator); + + const char* GetOutputExtension() override { return ".json"; } + +protected: + int InitializeInternal() override; + + int PackageFiles() override; + + bool SupportsComponentInstallation() const override; + + int InstallProjectViaInstallCommands( + bool setDestDir, const std::string& tempInstallDirectory) override; + int InstallProjectViaInstallScript( + bool setDestDir, const std::string& tempInstallDirectory) override; + int InstallProjectViaInstalledDirectories( + bool setDestDir, const std::string& tempInstallDirectory, + const mode_t* default_dir_mode) override; + + int RunPreinstallTarget(const std::string& installProjectName, + const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, + const std::string& buildConfig) override; + int InstallCMakeProject(bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, + const mode_t* default_dir_mode, + const std::string& component, bool componentInstall, + const std::string& installSubDirectory, + const std::string& buildConfig, + std::string& absoluteDestFiles) override; + +private: + class cmCPackExtVersionGenerator + { + public: + cmCPackExtVersionGenerator(cmCPackExtGenerator* parent); + + virtual ~cmCPackExtVersionGenerator() = default; + + virtual int WriteToJSON(Json::Value& root); + + protected: + virtual int GetVersionMajor() = 0; + virtual int GetVersionMinor() = 0; + + int WriteVersion(Json::Value& root); + + cmCPackExtGenerator* Parent; + }; + + class cmCPackExtVersion1Generator : public cmCPackExtVersionGenerator + { + public: + using cmCPackExtVersionGenerator::cmCPackExtVersionGenerator; + + protected: + int GetVersionMajor() override { return 1; } + int GetVersionMinor() override { return 0; } + }; + + std::unique_ptr<cmCPackExtVersionGenerator> Generator; +}; + +#endif diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index 91ae1a2..1433414 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -298,7 +298,7 @@ static bool has_suffix(const std::string& str, const std::string& suffix) int cmCPackFreeBSDGenerator::PackageFiles() { - if (!this->ReadListFile("CPackFreeBSD.cmake")) { + if (!this->ReadListFile("Internal/CPack/CPackFreeBSD.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackFreeBSD.cmake" << std::endl); return 0; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index f15445b..7014676 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -545,10 +545,13 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( ++it; std::string installProjectName = *it; ++it; - std::string installComponent = *it; + cmCPackInstallCMakeProject project; + + project.Directory = installDirectory; + project.ProjectName = installProjectName; + project.Component = *it; ++it; - std::string installSubDirectory = *it; - std::string installFile = installDirectory + "/cmake_install.cmake"; + project.SubDirectory = *it; std::vector<std::string> componentsVector; @@ -559,34 +562,36 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( * - the user did not request Monolithic install * (this works at CPack time too) */ - if (this->SupportsComponentInstallation() & + if (this->SupportsComponentInstallation() && !(this->IsOn("CPACK_MONOLITHIC_INSTALL"))) { // Determine the installation types for this project (if provided). std::string installTypesVar = "CPACK_" + - cmSystemTools::UpperCase(installComponent) + "_INSTALL_TYPES"; + cmSystemTools::UpperCase(project.Component) + "_INSTALL_TYPES"; const char* installTypes = this->GetOption(installTypesVar); if (installTypes && *installTypes) { std::vector<std::string> installTypesVector; cmSystemTools::ExpandListArgument(installTypes, installTypesVector); for (std::string const& installType : installTypesVector) { - this->GetInstallationType(installProjectName, installType); + project.InstallationTypes.push_back( + this->GetInstallationType(project.ProjectName, installType)); } } // Determine the set of components that will be used in this project std::string componentsVar = - "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(installComponent); + "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(project.Component); const char* components = this->GetOption(componentsVar); if (components && *components) { cmSystemTools::ExpandListArgument(components, componentsVector); for (std::string const& comp : componentsVector) { - GetComponent(installProjectName, comp); + project.Components.push_back( + this->GetComponent(project.ProjectName, comp)); } componentInstall = true; } } if (componentsVector.empty()) { - componentsVector.push_back(installComponent); + componentsVector.push_back(project.Component); } const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG"); @@ -606,297 +611,316 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // on windows. cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths()); - // Does this generator require pre-install? - if (const char* preinstall = - globalGenerator->GetPreinstallTargetName()) { - std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand( - preinstall, buildConfig, "", false); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Install command: " << buildCommand << std::endl); - cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Run preinstall target for: " << installProjectName - << std::endl); - std::string output; - int retVal = 1; - bool resB = cmSystemTools::RunSingleCommand( - buildCommand.c_str(), &output, &output, &retVal, - installDirectory.c_str(), this->GeneratorVerbose, - cmDuration::zero()); - if (!resB || retVal) { - std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - tmpFile += "/PreinstallOutput.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << buildCommand << std::endl - << "# Directory: " << installDirectory << std::endl - << "# Output:" << std::endl - << output << std::endl; - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running install command: " - << buildCommand << std::endl - << "Please check " << tmpFile << " for errors" - << std::endl); - return 0; - } + if (!this->RunPreinstallTarget(project.ProjectName, project.Directory, + globalGenerator, buildConfig)) { + return 0; } + delete globalGenerator; cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Install project: " << installProjectName << std::endl); + "- Install project: " << project.ProjectName << std::endl); // Run the installation for each component for (std::string const& component : componentsVector) { - std::string tempInstallDirectory = baseTempInstallDirectory; - installComponent = component; - if (componentInstall) { - cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Install component: " << installComponent - << std::endl); + if (!this->InstallCMakeProject( + setDestDir, project.Directory, baseTempInstallDirectory, + default_dir_mode, component, componentInstall, + project.SubDirectory, buildConfig, absoluteDestFiles)) { + return 0; } + } - cmake cm(cmake::RoleScript); - cm.SetHomeDirectory(""); - cm.SetHomeOutputDirectory(""); - cm.GetCurrentSnapshot().SetDefaultDefinitions(); - cm.AddCMakePaths(); - cm.SetProgressCallback(cmCPackGeneratorProgress, this); - cm.SetTrace(this->Trace); - cm.SetTraceExpand(this->TraceExpand); - cmGlobalGenerator gg(&cm); - cmMakefile mf(&gg, cm.GetCurrentSnapshot()); - if (!installSubDirectory.empty() && installSubDirectory != "/" && - installSubDirectory != ".") { - tempInstallDirectory += installSubDirectory; - } - if (componentInstall) { - tempInstallDirectory += "/"; - // Some CPack generators would rather chose - // the local installation directory suffix. - // Some (e.g. RPM) use - // one install directory for each component **GROUP** - // instead of the default - // one install directory for each component. - tempInstallDirectory += - GetComponentInstallDirNameSuffix(installComponent); - if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { - tempInstallDirectory += "/"; - tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME"); - } - } + this->CMakeProjects.push_back(project); + } + } + this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES", + absoluteDestFiles.c_str()); + return 1; +} - const char* default_dir_inst_permissions = - this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); - if (default_dir_inst_permissions && *default_dir_inst_permissions) { - mf.AddDefinition("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS", - default_dir_inst_permissions); - } +int cmCPackGenerator::RunPreinstallTarget( + const std::string& installProjectName, const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, const std::string& buildConfig) +{ + // Does this generator require pre-install? + if (const char* preinstall = globalGenerator->GetPreinstallTargetName()) { + std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand( + preinstall, buildConfig, "", false); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Install command: " << buildCommand << std::endl); + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Run preinstall target for: " << installProjectName + << std::endl); + std::string output; + int retVal = 1; + bool resB = cmSystemTools::RunSingleCommand( + buildCommand.c_str(), &output, &output, &retVal, + installDirectory.c_str(), this->GeneratorVerbose, cmDuration::zero()); + if (!resB || retVal) { + std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); + tmpFile += "/PreinstallOutput.log"; + cmGeneratedFileStream ofs(tmpFile.c_str()); + ofs << "# Run command: " << buildCommand << std::endl + << "# Directory: " << installDirectory << std::endl + << "# Output:" << std::endl + << output << std::endl; + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem running install command: " + << buildCommand << std::endl + << "Please check " << tmpFile << " for errors" + << std::endl); + return 0; + } + } - if (!setDestDir) { - tempInstallDirectory += this->GetPackagingInstallPrefix(); - } + return 1; +} - if (setDestDir) { - // For DESTDIR based packaging, use the *project* - // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The - // value of the project's CMAKE_INSTALL_PREFIX is sent in here as - // the value of the CPACK_INSTALL_PREFIX variable. - // - // If DESTDIR has been 'internally set ON' this means that - // the underlying CPack specific generator did ask for that - // In this case we may override CPACK_INSTALL_PREFIX with - // CPACK_PACKAGING_INSTALL_PREFIX - // I know this is tricky and awkward but it's the price for - // CPACK_SET_DESTDIR backward compatibility. - if (cmSystemTools::IsInternallyOn( - this->GetOption("CPACK_SET_DESTDIR"))) { - this->SetOption("CPACK_INSTALL_PREFIX", - this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX")); - } - std::string dir; - if (this->GetOption("CPACK_INSTALL_PREFIX")) { - dir += this->GetOption("CPACK_INSTALL_PREFIX"); - } - mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str()); +int cmCPackGenerator::InstallCMakeProject( + bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode, + const std::string& component, bool componentInstall, + const std::string& installSubDirectory, const std::string& buildConfig, + std::string& absoluteDestFiles) +{ + std::string tempInstallDirectory = baseTempInstallDirectory; + std::string installFile = installDirectory + "/cmake_install.cmake"; - cmCPackLogger( - cmCPackLog::LOG_DEBUG, - "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf.AddDefinition)" - << std::endl); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" - << std::endl); - - // Make sure that DESTDIR + CPACK_INSTALL_PREFIX directory - // exists: - // - if (cmSystemTools::StringStartsWith(dir.c_str(), "/")) { - dir = tempInstallDirectory + dir; - } else { - dir = tempInstallDirectory + "/" + dir; - } - /* - * We must re-set DESTDIR for each component - * We must not add the CPACK_INSTALL_PREFIX part because - * it will be added using the override of CMAKE_INSTALL_PREFIX - * The main reason for this awkward trick is that - * are using DESTDIR for 2 different reasons: - * - Because it was asked by the CPack Generator or the user - * using CPACK_SET_DESTDIR - * - Because it was already used for component install - * in order to put things in subdirs... - */ - cmSystemTools::PutEnv(std::string("DESTDIR=") + - tempInstallDirectory); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Creating directory: '" << dir << "'" << std::endl); + if (componentInstall) { + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Install component: " << component << std::endl); + } - if (!cmsys::SystemTools::MakeDirectory(dir, default_dir_mode)) { - cmCPackLogger( - cmCPackLog::LOG_ERROR, - "Problem creating temporary directory: " << dir << std::endl); - return 0; - } - } else { - mf.AddDefinition("CMAKE_INSTALL_PREFIX", - tempInstallDirectory.c_str()); + cmake cm(cmake::RoleScript); + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); + cm.GetCurrentSnapshot().SetDefaultDefinitions(); + cm.AddCMakePaths(); + cm.SetProgressCallback(cmCPackGeneratorProgress, this); + cm.SetTrace(this->Trace); + cm.SetTraceExpand(this->TraceExpand); + cmGlobalGenerator gg(&cm); + cmMakefile mf(&gg, cm.GetCurrentSnapshot()); + if (!installSubDirectory.empty() && installSubDirectory != "/" && + installSubDirectory != ".") { + tempInstallDirectory += installSubDirectory; + } + if (componentInstall) { + tempInstallDirectory += "/"; + // Some CPack generators would rather chose + // the local installation directory suffix. + // Some (e.g. RPM) use + // one install directory for each component **GROUP** + // instead of the default + // one install directory for each component. + tempInstallDirectory += GetComponentInstallDirNameSuffix(component); + if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { + tempInstallDirectory += "/"; + tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME"); + } + } - if (!cmsys::SystemTools::MakeDirectory(tempInstallDirectory, - default_dir_mode)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating temporary directory: " - << tempInstallDirectory << std::endl); - return 0; - } + const char* default_dir_inst_permissions = + this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); + if (default_dir_inst_permissions && *default_dir_inst_permissions) { + mf.AddDefinition("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS", + default_dir_inst_permissions); + } - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Using non-DESTDIR install... (mf.AddDefinition)" - << std::endl); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Setting CMAKE_INSTALL_PREFIX to '" - << tempInstallDirectory << "'" << std::endl); - } + if (!setDestDir) { + tempInstallDirectory += this->GetPackagingInstallPrefix(); + } - if (!buildConfig.empty()) { - mf.AddDefinition("BUILD_TYPE", buildConfig.c_str()); - } - std::string installComponentLowerCase = - cmSystemTools::LowerCase(installComponent); - if (installComponentLowerCase != "all") { - mf.AddDefinition("CMAKE_INSTALL_COMPONENT", - installComponent.c_str()); - } + if (setDestDir) { + // For DESTDIR based packaging, use the *project* + // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The + // value of the project's CMAKE_INSTALL_PREFIX is sent in here as + // the value of the CPACK_INSTALL_PREFIX variable. + // + // If DESTDIR has been 'internally set ON' this means that + // the underlying CPack specific generator did ask for that + // In this case we may override CPACK_INSTALL_PREFIX with + // CPACK_PACKAGING_INSTALL_PREFIX + // I know this is tricky and awkward but it's the price for + // CPACK_SET_DESTDIR backward compatibility. + if (cmSystemTools::IsInternallyOn(this->GetOption("CPACK_SET_DESTDIR"))) { + this->SetOption("CPACK_INSTALL_PREFIX", + this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX")); + } + std::string dir; + if (this->GetOption("CPACK_INSTALL_PREFIX")) { + dir += this->GetOption("CPACK_INSTALL_PREFIX"); + } + mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str()); - // strip on TRUE, ON, 1, one or several file names, but not on - // FALSE, OFF, 0 and an empty string - if (!cmSystemTools::IsOff(this->GetOption("CPACK_STRIP_FILES"))) { - mf.AddDefinition("CMAKE_INSTALL_DO_STRIP", "1"); - } - // Remember the list of files before installation - // of the current component (if we are in component install) - std::string const& InstallPrefix = tempInstallDirectory; - std::vector<std::string> filesBefore; - std::string findExpr = tempInstallDirectory; - if (componentInstall) { - cmsys::Glob glB; - findExpr += "/*"; - glB.RecurseOn(); - glB.SetRecurseListDirs(true); - glB.FindFiles(findExpr); - filesBefore = glB.GetFiles(); - std::sort(filesBefore.begin(), filesBefore.end()); - } + cmCPackLogger( + cmCPackLog::LOG_DEBUG, + "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf.AddDefinition)" + << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" + << std::endl); + + // Make sure that DESTDIR + CPACK_INSTALL_PREFIX directory + // exists: + // + if (cmSystemTools::StringStartsWith(dir.c_str(), "/")) { + dir = tempInstallDirectory + dir; + } else { + dir = tempInstallDirectory + "/" + dir; + } + /* + * We must re-set DESTDIR for each component + * We must not add the CPACK_INSTALL_PREFIX part because + * it will be added using the override of CMAKE_INSTALL_PREFIX + * The main reason for this awkward trick is that + * are using DESTDIR for 2 different reasons: + * - Because it was asked by the CPack Generator or the user + * using CPACK_SET_DESTDIR + * - Because it was already used for component install + * in order to put things in subdirs... + */ + cmSystemTools::PutEnv(std::string("DESTDIR=") + tempInstallDirectory); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Creating directory: '" << dir << "'" << std::endl); - // If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION - // then forward request to cmake_install.cmake script - if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) { - mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); - } - // If current CPack generator does support - // ABSOLUTE INSTALL DESTINATION or CPack has been asked for - // then ask cmake_install.cmake script to error out - // as soon as it occurs (before installing file) - if (!SupportsAbsoluteDestination() || - this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) { - mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); - } - // do installation - int res = mf.ReadListFile(installFile.c_str()); - // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES - // to CPack (may be used by generators like CPack RPM or DEB) - // in order to transparently handle ABSOLUTE PATH - if (mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) { - mf.AddDefinition( - "CPACK_ABSOLUTE_DESTINATION_FILES", - mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")); - } + if (!cmsys::SystemTools::MakeDirectory(dir, default_dir_mode)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating temporary directory: " << dir + << std::endl); + return 0; + } + } else { + mf.AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory.c_str()); - // Now rebuild the list of files after installation - // of the current component (if we are in component install) - if (componentInstall) { - cmsys::Glob glA; - glA.RecurseOn(); - glA.SetRecurseListDirs(true); - glA.SetRecurseThroughSymlinks(false); - glA.FindFiles(findExpr); - std::vector<std::string> filesAfter = glA.GetFiles(); - std::sort(filesAfter.begin(), filesAfter.end()); - std::vector<std::string>::iterator diff; - std::vector<std::string> result(filesAfter.size()); - diff = std::set_difference(filesAfter.begin(), filesAfter.end(), - filesBefore.begin(), filesBefore.end(), - result.begin()); - - std::vector<std::string>::iterator fit; - std::string localFileName; - // Populate the File field of each component - for (fit = result.begin(); fit != diff; ++fit) { - localFileName = cmSystemTools::RelativePath(InstallPrefix, *fit); - localFileName = - localFileName.substr(localFileName.find_first_not_of('/')); - Components[installComponent].Files.push_back(localFileName); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Adding file <" - << localFileName << "> to component <" - << installComponent << ">" << std::endl); - } - } + if (!cmsys::SystemTools::MakeDirectory(tempInstallDirectory, + default_dir_mode)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating temporary directory: " + << tempInstallDirectory << std::endl); + return 0; + } - if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) { - if (!absoluteDestFiles.empty()) { - absoluteDestFiles += ";"; - } - absoluteDestFiles += - mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Got some ABSOLUTE DESTINATION FILES: " - << absoluteDestFiles << std::endl); - // define component specific var - if (componentInstall) { - std::string absoluteDestFileComponent = - std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" + - GetComponentInstallDirNameSuffix(installComponent); - if (nullptr != this->GetOption(absoluteDestFileComponent)) { - std::string absoluteDestFilesListComponent = - this->GetOption(absoluteDestFileComponent); - absoluteDestFilesListComponent += ";"; - absoluteDestFilesListComponent += - mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); - this->SetOption(absoluteDestFileComponent, - absoluteDestFilesListComponent.c_str()); - } else { - this->SetOption( - absoluteDestFileComponent, - mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")); - } - } - } - if (cmSystemTools::GetErrorOccuredFlag() || !res) { - return 0; - } + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Using non-DESTDIR install... (mf.AddDefinition)" + << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Setting CMAKE_INSTALL_PREFIX to '" << tempInstallDirectory + << "'" << std::endl); + } + + if (!buildConfig.empty()) { + mf.AddDefinition("BUILD_TYPE", buildConfig.c_str()); + } + std::string installComponentLowerCase = cmSystemTools::LowerCase(component); + if (installComponentLowerCase != "all") { + mf.AddDefinition("CMAKE_INSTALL_COMPONENT", component.c_str()); + } + + // strip on TRUE, ON, 1, one or several file names, but not on + // FALSE, OFF, 0 and an empty string + if (!cmSystemTools::IsOff(this->GetOption("CPACK_STRIP_FILES"))) { + mf.AddDefinition("CMAKE_INSTALL_DO_STRIP", "1"); + } + // Remember the list of files before installation + // of the current component (if we are in component install) + std::string const& InstallPrefix = tempInstallDirectory; + std::vector<std::string> filesBefore; + std::string findExpr = tempInstallDirectory; + if (componentInstall) { + cmsys::Glob glB; + findExpr += "/*"; + glB.RecurseOn(); + glB.SetRecurseListDirs(true); + glB.FindFiles(findExpr); + filesBefore = glB.GetFiles(); + std::sort(filesBefore.begin(), filesBefore.end()); + } + + // If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION + // then forward request to cmake_install.cmake script + if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) { + mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); + } + // If current CPack generator does support + // ABSOLUTE INSTALL DESTINATION or CPack has been asked for + // then ask cmake_install.cmake script to error out + // as soon as it occurs (before installing file) + if (!SupportsAbsoluteDestination() || + this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) { + mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); + } + // do installation + int res = mf.ReadListFile(installFile.c_str()); + // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES + // to CPack (may be used by generators like CPack RPM or DEB) + // in order to transparently handle ABSOLUTE PATH + if (mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) { + mf.AddDefinition("CPACK_ABSOLUTE_DESTINATION_FILES", + mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")); + } + + // Now rebuild the list of files after installation + // of the current component (if we are in component install) + if (componentInstall) { + cmsys::Glob glA; + glA.RecurseOn(); + glA.SetRecurseListDirs(true); + glA.SetRecurseThroughSymlinks(false); + glA.FindFiles(findExpr); + std::vector<std::string> filesAfter = glA.GetFiles(); + std::sort(filesAfter.begin(), filesAfter.end()); + std::vector<std::string>::iterator diff; + std::vector<std::string> result(filesAfter.size()); + diff = std::set_difference(filesAfter.begin(), filesAfter.end(), + filesBefore.begin(), filesBefore.end(), + result.begin()); + + std::vector<std::string>::iterator fit; + std::string localFileName; + // Populate the File field of each component + for (fit = result.begin(); fit != diff; ++fit) { + localFileName = cmSystemTools::RelativePath(InstallPrefix, *fit); + localFileName = + localFileName.substr(localFileName.find_first_not_of('/')); + Components[component].Files.push_back(localFileName); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Adding file <" << localFileName << "> to component <" + << component << ">" << std::endl); + } + } + + if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) { + if (!absoluteDestFiles.empty()) { + absoluteDestFiles += ";"; + } + absoluteDestFiles += mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Got some ABSOLUTE DESTINATION FILES: " << absoluteDestFiles + << std::endl); + // define component specific var + if (componentInstall) { + std::string absoluteDestFileComponent = + std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" + + GetComponentInstallDirNameSuffix(component); + if (nullptr != this->GetOption(absoluteDestFileComponent)) { + std::string absoluteDestFilesListComponent = + this->GetOption(absoluteDestFileComponent); + absoluteDestFilesListComponent += ";"; + absoluteDestFilesListComponent += + mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); + this->SetOption(absoluteDestFileComponent, + absoluteDestFilesListComponent.c_str()); + } else { + this->SetOption(absoluteDestFileComponent, + mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")); } } } - this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES", - absoluteDestFiles.c_str()); + if (cmSystemTools::GetErrorOccuredFlag() || !res) { + return 0; + } return 1; } diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index c22f36b..c13c649 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -15,6 +15,7 @@ #include "cm_sys_stat.h" class cmCPackLog; +class cmGlobalGenerator; class cmInstalledFile; class cmMakefile; @@ -185,6 +186,17 @@ protected: bool setDestDir, const std::string& tempInstallDirectory, const mode_t* default_dir_mode); + virtual int RunPreinstallTarget(const std::string& installProjectName, + const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, + const std::string& buildConfig); + virtual int InstallCMakeProject( + bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, + const mode_t* default_dir_mode, const std::string& component, + bool componentInstall, const std::string& installSubDirectory, + const std::string& buildConfig, std::string& absoluteDestFiles); + /** * The various level of support of * CPACK_SET_DESTDIR used by the generator. @@ -271,6 +283,7 @@ protected: */ std::vector<std::string> files; + std::vector<cmCPackInstallCMakeProject> CMakeProjects; std::map<std::string, cmCPackInstallationType> InstallationTypes; /** * The set of components. diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index d47e5ed..8ef24f7 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -12,6 +12,7 @@ # include "cmCPackFreeBSDGenerator.h" #endif #include "cmCPackDebGenerator.h" +#include "cmCPackExtGenerator.h" #include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmCPackNSISGenerator.h" @@ -110,6 +111,10 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() this->RegisterGenerator("NuGet", "NuGet packages", cmCPackNuGetGenerator::CreateGenerator); } + if (cmCPackExtGenerator::CanGenerate()) { + this->RegisterGenerator("Ext", "CPack External packages", + cmCPackExtGenerator::CreateGenerator); + } #ifdef __APPLE__ if (cmCPackDragNDropGenerator::CanGenerate()) { this->RegisterGenerator("DragNDrop", "Mac OSX Drag And Drop", diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index a893a0f..e46b2cf 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -703,7 +703,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( // Find a ZIP program if (!this->IsSet("ZIP_EXECUTABLE")) { - this->ReadListFile("CPackZIP.cmake"); + this->ReadListFile("Internal/CPack/CPackZIP.cmake"); if (!this->IsSet("ZIP_EXECUTABLE")) { cmCPackLogger(cmCPackLog::LOG_ERROR, diff --git a/Source/CPack/cmCPackNuGetGenerator.cxx b/Source/CPack/cmCPackNuGetGenerator.cxx index 2ae8cba..76f0699 100644 --- a/Source/CPack/cmCPackNuGetGenerator.cxx +++ b/Source/CPack/cmCPackNuGetGenerator.cxx @@ -49,7 +49,7 @@ int cmCPackNuGetGenerator::PackageFiles() this->SetOption("CPACK_NUGET_ORDINAL_MONOLITIC", "TRUE"); } - auto retval = this->ReadListFile("CPackNuGet.cmake"); + auto retval = this->ReadListFile("Internal/CPack/CPackNuGet.cmake"); if (retval) { AddGeneratedPackageNames(); } else { diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index c389884..5834829 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -89,7 +89,7 @@ int cmCPackRPMGenerator::PackageOnePack(std::string const& initialToplevel, component_path += packageName; this->SetOption("CPACK_RPM_PACKAGE_COMPONENT_PART_PATH", component_path.c_str()); - if (!this->ReadListFile("CPackRPM.cmake")) { + if (!this->ReadListFile("Internal/CPack/CPackRPM.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackRPM.cmake" << std::endl); retval = 0; @@ -385,7 +385,7 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne( component_path.c_str()); } - if (this->ReadListFile("CPackRPM.cmake")) { + if (this->ReadListFile("Internal/CPack/CPackRPM.cmake")) { AddGeneratedPackageNames(); } else { cmCPackLogger(cmCPackLog::LOG_ERROR, diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index dcef8a0..52db9d4 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -15,7 +15,6 @@ #include "cmUVSignalHackRAII.h" // IWYU pragma: keep #include "cmsys/FStream.hxx" -#include "cmsys/String.hxx" #include "cmsys/SystemInformation.hxx" #include <algorithm> @@ -458,7 +457,7 @@ void cmCTestMultiProcessHandler::UpdateCostData() if (line == "---") { break; } - std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' '); + std::vector<std::string> parts = cmSystemTools::SplitString(line, ' '); // Format: <name> <previous_runs> <avg_cost> if (parts.size() < 3) { break; @@ -511,7 +510,7 @@ void cmCTestMultiProcessHandler::ReadCostData() break; } - std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' '); + std::vector<std::string> parts = cmSystemTools::SplitString(line, ' '); // Probably an older version of the file, will be fixed next run if (parts.size() < 3) { diff --git a/Source/LexerParser/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx index 81a1ec5..cb24687 100644 --- a/Source/LexerParser/cmExprLexer.cxx +++ b/Source/LexerParser/cmExprLexer.cxx @@ -548,8 +548,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 15 -#define YY_END_OF_BUFFER 16 +#define YY_NUM_RULES 18 +#define YY_END_OF_BUFFER 19 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -557,29 +557,29 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[23] = +static const flex_int16_t yy_accept[29] = { 0, - 0, 0, 16, 15, 6, 8, 13, 14, 4, 2, - 3, 5, 1, 15, 15, 9, 7, 10, 1, 11, - 12, 0 + 0, 0, 19, 17, 1, 18, 8, 10, 15, 16, + 6, 4, 5, 7, 2, 2, 17, 17, 11, 9, + 12, 2, 0, 13, 14, 3, 3, 0 } ; static const YY_CHAR yy_ec[256] = { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 4, 5, 1, 6, + 7, 8, 9, 1, 10, 1, 11, 12, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 1, 1, 14, + 1, 15, 1, 1, 16, 16, 16, 16, 16, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 3, 1, 4, - 5, 6, 7, 1, 8, 1, 9, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 1, 1, 11, - 1, 12, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 13, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 17, 1, 1, + 1, 1, 1, 18, 1, 1, 16, 16, 16, 16, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 14, 1, 15, 1, 1, 1, 1, + 16, 16, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 17, + 1, 1, 1, 19, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -596,40 +596,46 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[16] = +static const YY_CHAR yy_meta[21] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 + 1, 2, 2, 1, 1, 3, 4, 1, 1, 1 } ; -static const flex_int16_t yy_base[23] = +static const flex_int16_t yy_base[32] = { 0, - 0, 0, 20, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 9, 7, 5, 21, 21, 21, 6, 21, - 21, 21 + 0, 0, 34, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 16, 9, 18, 11, 35, 35, + 35, 11, 0, 35, 35, 0, 0, 35, 23, 26, + 28 } ; -static const flex_int16_t yy_def[23] = +static const flex_int16_t yy_def[32] = { 0, - 22, 1, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 0 + 28, 1, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 29, 28, 28, 28, 28, 28, + 28, 28, 30, 28, 28, 31, 31, 0, 28, 28, + 28 } ; -static const flex_int16_t yy_nxt[37] = +static const flex_int16_t yy_nxt[56] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 21, 20, 19, 22, - 3, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22 + 14, 15, 16, 17, 18, 4, 4, 19, 20, 21, + 22, 22, 22, 22, 22, 25, 22, 26, 26, 27, + 27, 24, 23, 28, 3, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28 } ; -static const flex_int16_t yy_chk[37] = +static const flex_int16_t yy_chk[56] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 19, 15, 14, 13, 3, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 16, 16, 22, 22, 29, 18, 29, 30, 30, 31, + 31, 17, 15, 3, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28 } ; /* The intent behind this definition is that it'll catch @@ -668,6 +674,8 @@ Modify cmExprLexer.cxx: /* Include the set of tokens from the parser. */ #include "cmExprParserTokens.h" +#include <string> + /*--------------------------------------------------------------------------*/ #define INITIAL 0 @@ -946,13 +954,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 23 ) + if ( yy_current_state >= 29 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 21 ); + while ( yy_base[yy_current_state] != 35 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -978,62 +986,74 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -{ yylvalp->Number = atoi(yytext); return exp_NUMBER; } +{} YY_BREAK case 2: YY_RULE_SETUP -{ return exp_PLUS; } +{ yylvalp->Number = std::stoll(yytext, nullptr, 10); return exp_NUMBER; } YY_BREAK case 3: YY_RULE_SETUP -{ return exp_MINUS; } +{ yylvalp->Number = std::stoll(yytext, nullptr, 16); return exp_NUMBER; } YY_BREAK case 4: YY_RULE_SETUP -{ return exp_TIMES; } +{ return exp_PLUS; } YY_BREAK case 5: YY_RULE_SETUP -{ return exp_DIVIDE; } +{ return exp_MINUS; } YY_BREAK case 6: YY_RULE_SETUP -{ return exp_MOD; } +{ return exp_TIMES; } YY_BREAK case 7: YY_RULE_SETUP -{ return exp_OR; } +{ return exp_DIVIDE; } YY_BREAK case 8: YY_RULE_SETUP -{ return exp_AND; } +{ return exp_MOD; } YY_BREAK case 9: YY_RULE_SETUP -{ return exp_XOR; } +{ return exp_OR; } YY_BREAK case 10: YY_RULE_SETUP -{ return exp_NOT; } +{ return exp_AND; } YY_BREAK case 11: YY_RULE_SETUP -{ return exp_SHIFTLEFT; } +{ return exp_XOR; } YY_BREAK case 12: YY_RULE_SETUP -{ return exp_SHIFTRIGHT; } +{ return exp_NOT; } YY_BREAK case 13: YY_RULE_SETUP -{ return exp_OPENPARENT; } +{ return exp_SHIFTLEFT; } YY_BREAK case 14: YY_RULE_SETUP -{ return exp_CLOSEPARENT; } +{ return exp_SHIFTRIGHT; } YY_BREAK case 15: YY_RULE_SETUP +{ return exp_OPENPARENT; } + YY_BREAK +case 16: +YY_RULE_SETUP +{ return exp_CLOSEPARENT; } + YY_BREAK +case 17: +YY_RULE_SETUP +{ yyextra->UnexpectedChar(yytext[0]); } + YY_BREAK +case 18: +YY_RULE_SETUP ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): @@ -1334,7 +1354,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 23 ) + if ( yy_current_state >= 29 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -1363,11 +1383,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 23 ) + if ( yy_current_state >= 29 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 22); + yy_is_jam = (yy_current_state == 28); (void)yyg; return yy_is_jam ? 0 : yy_current_state; diff --git a/Source/LexerParser/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l index e5f177a..2197c2a 100644 --- a/Source/LexerParser/cmExprLexer.in.l +++ b/Source/LexerParser/cmExprLexer.in.l @@ -28,6 +28,8 @@ Modify cmExprLexer.cxx: /* Include the set of tokens from the parser. */ #include "cmExprParserTokens.h" +#include <string> + /*--------------------------------------------------------------------------*/ %} @@ -38,8 +40,10 @@ Modify cmExprLexer.cxx: %pointer %% +[ \t] {} -[0-9][0-9]* { yylvalp->Number = atoi(yytext); return exp_NUMBER; } +[0-9][0-9]* { yylvalp->Number = std::stoll(yytext, nullptr, 10); return exp_NUMBER; } +0[xX][0-9a-fA-F][0-9a-fA-F]* { yylvalp->Number = std::stoll(yytext, nullptr, 16); return exp_NUMBER; } "+" { return exp_PLUS; } "-" { return exp_MINUS; } @@ -54,5 +58,6 @@ Modify cmExprLexer.cxx: ">>" { return exp_SHIFTRIGHT; } "(" { return exp_OPENPARENT; } ")" { return exp_CLOSEPARENT; } +. { yyextra->UnexpectedChar(yytext[0]); } %% diff --git a/Source/LexerParser/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx index 67664a5..fbc3628 100644 --- a/Source/LexerParser/cmExprParser.cxx +++ b/Source/LexerParser/cmExprParser.cxx @@ -89,6 +89,7 @@ Modify cmExprParser.cxx: #include <stdlib.h> #include <string.h> +#include <stdexcept> /*-------------------------------------------------------------------------*/ #define YYDEBUG 1 @@ -108,7 +109,7 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4065) /* Switch statement contains default but no case. */ #endif -#line 112 "cmExprParser.cxx" /* yacc.c:339 */ +#line 113 "cmExprParser.cxx" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -185,7 +186,7 @@ int cmExpr_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 189 "cmExprParser.cxx" /* yacc.c:358 */ +#line 190 "cmExprParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -484,9 +485,9 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 73, 73, 78, 81, 86, 89, 94, 97, 102, - 105, 108, 113, 116, 119, 124, 127, 130, 133, 138, - 141, 144, 149, 152 + 0, 74, 74, 79, 82, 87, 90, 95, 98, 103, + 106, 109, 114, 117, 120, 125, 128, 131, 137, 142, + 145, 148, 153, 156 }; #endif @@ -1281,183 +1282,186 @@ yyreduce: switch (yyn) { case 2: -#line 73 "cmExprParser.y" /* yacc.c:1646 */ +#line 74 "cmExprParser.y" /* yacc.c:1646 */ { cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number)); } -#line 1289 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1290 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 78 "cmExprParser.y" /* yacc.c:1646 */ +#line 79 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1297 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1298 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 81 "cmExprParser.y" /* yacc.c:1646 */ +#line 82 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number); } -#line 1305 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1306 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 86 "cmExprParser.y" /* yacc.c:1646 */ +#line 87 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1313 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1314 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 89 "cmExprParser.y" /* yacc.c:1646 */ +#line 90 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number); } -#line 1321 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1322 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 94 "cmExprParser.y" /* yacc.c:1646 */ +#line 95 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1329 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1330 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 97 "cmExprParser.y" /* yacc.c:1646 */ +#line 98 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number); } -#line 1337 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1338 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 102 "cmExprParser.y" /* yacc.c:1646 */ +#line 103 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1345 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1346 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 105 "cmExprParser.y" /* yacc.c:1646 */ +#line 106 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number); } -#line 1353 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1354 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 108 "cmExprParser.y" /* yacc.c:1646 */ +#line 109 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number); } -#line 1361 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1362 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 113 "cmExprParser.y" /* yacc.c:1646 */ +#line 114 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1369 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1370 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 116 "cmExprParser.y" /* yacc.c:1646 */ +#line 117 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number); } -#line 1377 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1378 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 119 "cmExprParser.y" /* yacc.c:1646 */ +#line 120 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number); } -#line 1385 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1386 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 124 "cmExprParser.y" /* yacc.c:1646 */ +#line 125 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1393 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1394 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 127 "cmExprParser.y" /* yacc.c:1646 */ +#line 128 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number); } -#line 1401 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1402 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 130 "cmExprParser.y" /* yacc.c:1646 */ +#line 131 "cmExprParser.y" /* yacc.c:1646 */ { + if (yyvsp[0].Number == 0) { + throw std::overflow_error("divide by zero"); + } (yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number); } -#line 1409 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1413 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 133 "cmExprParser.y" /* yacc.c:1646 */ +#line 137 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number); } -#line 1417 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1421 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 138 "cmExprParser.y" /* yacc.c:1646 */ +#line 142 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1425 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1429 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 141 "cmExprParser.y" /* yacc.c:1646 */ +#line 145 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = + (yyvsp[0].Number); } -#line 1433 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1437 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 144 "cmExprParser.y" /* yacc.c:1646 */ +#line 148 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = - (yyvsp[0].Number); } -#line 1441 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1445 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 149 "cmExprParser.y" /* yacc.c:1646 */ +#line 153 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1449 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1453 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 152 "cmExprParser.y" /* yacc.c:1646 */ +#line 156 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-1].Number); } -#line 1457 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1461 "cmExprParser.cxx" /* yacc.c:1646 */ break; -#line 1461 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1465 "cmExprParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1687,7 +1691,7 @@ yyreturn: #endif return yyresult; } -#line 157 "cmExprParser.y" /* yacc.c:1906 */ +#line 161 "cmExprParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/LexerParser/cmExprParser.y b/Source/LexerParser/cmExprParser.y index d1c3a97..921b31d 100644 --- a/Source/LexerParser/cmExprParser.y +++ b/Source/LexerParser/cmExprParser.y @@ -18,6 +18,7 @@ Modify cmExprParser.cxx: #include <stdlib.h> #include <string.h> +#include <stdexcept> /*-------------------------------------------------------------------------*/ #define YYDEBUG 1 @@ -128,6 +129,9 @@ term: $<Number>$ = $<Number>1 * $<Number>3; } | term exp_DIVIDE unary { + if (yyvsp[0].Number == 0) { + throw std::overflow_error("divide by zero"); + } $<Number>$ = $<Number>1 / $<Number>3; } | term exp_MOD unary { diff --git a/Source/cmAddLinkOptionsCommand.cxx b/Source/cmAddLinkOptionsCommand.cxx new file mode 100644 index 0000000..10ebd12 --- /dev/null +++ b/Source/cmAddLinkOptionsCommand.cxx @@ -0,0 +1,20 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmAddLinkOptionsCommand.h" + +#include "cmMakefile.h" + +class cmExecutionStatus; + +bool cmAddLinkOptionsCommand::InitialPass(std::vector<std::string> const& args, + cmExecutionStatus&) +{ + if (args.empty()) { + return true; + } + + for (std::string const& i : args) { + this->Makefile->AddLinkOption(i); + } + return true; +} diff --git a/Source/cmAddLinkOptionsCommand.h b/Source/cmAddLinkOptionsCommand.h new file mode 100644 index 0000000..30fff00 --- /dev/null +++ b/Source/cmAddLinkOptionsCommand.h @@ -0,0 +1,31 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmAddLinkOptionsCommand_h +#define cmAddLinkOptionsCommand_h + +#include "cmConfigure.h" // IWYU pragma: keep + +#include <string> +#include <vector> + +#include "cmCommand.h" + +class cmExecutionStatus; + +class cmAddLinkOptionsCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + cmCommand* Clone() override { return new cmAddLinkOptionsCommand; } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus& status) override; +}; + +#endif diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index d0e668d..95edd8b 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -9,7 +9,6 @@ #include "cmsys/FStream.hxx" #include "cmsys/Glob.hxx" #include "cmsys/Process.h" -#include "cmsys/String.hxx" #include "cmsys/SystemInformation.hxx" #include <algorithm> #include <chrono> @@ -1491,7 +1490,7 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml, this->AddSiteProperties(xml); xml.StartElement("Notes"); - for (cmsys::String const& file : files) { + for (std::string const& file : files) { cmCTestLog(this, OUTPUT, "\tAdd file: " << file << std::endl); std::string note_time = this->CurrentTime(); xml.StartElement("Note"); @@ -1595,7 +1594,7 @@ std::string cmCTest::Base64EncodeFile(std::string const& file) bool cmCTest::SubmitExtraFiles(const VectorOfStrings& files) { - for (cmsys::String const& file : files) { + for (std::string const& file : files) { if (!cmSystemTools::FileExists(file)) { cmCTestLog(this, ERROR_MESSAGE, "Cannot find extra file: " << file << " to submit." diff --git a/Source/cmCTest.h b/Source/cmCTest.h index ddeab1a..c6ece98 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -7,7 +7,7 @@ #include "cmDuration.h" #include "cmProcessOutput.h" -#include "cmsys/String.hxx" + #include <chrono> #include <map> #include <set> @@ -93,7 +93,7 @@ public: if the string does not name a valid part. */ Part GetPartFromName(const char* name); - typedef std::vector<cmsys::String> VectorOfStrings; + typedef std::vector<std::string> VectorOfStrings; typedef std::set<std::string> SetOfStrings; /** Process Command line arguments */ diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index dc9318e..15fbd40 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -82,6 +82,7 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmAddCompileOptionsCommand.h" +# include "cmAddLinkOptionsCommand.h" # include "cmAuxSourceDirectoryCommand.h" # include "cmBuildNameCommand.h" # include "cmCMakeHostSystemInformationCommand.h" @@ -100,6 +101,7 @@ # include "cmRemoveDefinitionsCommand.h" # include "cmSourceGroupCommand.h" # include "cmSubdirDependsCommand.h" +# include "cmTargetLinkOptionsCommand.h" # include "cmUseMangledMesaCommand.h" # include "cmUtilitySourceCommand.h" # include "cmVariableRequiresCommand.h" @@ -272,7 +274,10 @@ void GetProjectCommands(cmState* state) state->AddBuiltinCommand("include_external_msproject", new cmIncludeExternalMSProjectCommand); state->AddBuiltinCommand("install_programs", new cmInstallProgramsCommand); + state->AddBuiltinCommand("add_link_options", new cmAddLinkOptionsCommand); state->AddBuiltinCommand("link_libraries", new cmLinkLibrariesCommand); + state->AddBuiltinCommand("target_link_options", + new cmTargetLinkOptionsCommand); state->AddBuiltinCommand("load_cache", new cmLoadCacheCommand); state->AddBuiltinCommand("qt_wrap_cpp", new cmQTWrapCPPCommand); state->AddBuiltinCommand("qt_wrap_ui", new cmQTWrapUICommand); diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index 0ceac85..bb370c4 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -7,6 +7,7 @@ #include <sstream> #include <utility> +#include "cmAlgorithms.h" #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorTarget.h" @@ -169,6 +170,11 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( end = "\\\n"; } os << "\n"; + } else if (property.first == "INTERFACE_LINK_OPTIONS") { + os << "LOCAL_EXPORT_LDFLAGS := "; + std::vector<std::string> linkFlagsList; + cmSystemTools::ExpandListArgument(property.second, linkFlagsList); + os << cmJoin(linkFlagsList, " ") << "\n"; } else { os << "# " << property.first << " " << (property.second) << "\n"; } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 47636cd..7f42035 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -95,6 +95,12 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gte, cmGeneratorExpression::BuildInterface, properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_LINK_OPTIONS", gte, + cmGeneratorExpression::BuildInterface, + properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_LINK_DEPENDS", gte, + cmGeneratorExpression::BuildInterface, + properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", gte, properties); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 5f61571..ec68fce 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -420,6 +420,37 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( } } +void cmExportFileGenerator::PopulateLinkDependsInterface( + cmTargetExport* tei, cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap& properties, std::vector<std::string>& missingTargets) +{ + cmGeneratorTarget* gt = tei->Target; + assert(preprocessRule == cmGeneratorExpression::InstallInterface); + + const char* propName = "INTERFACE_LINK_DEPENDS"; + const char* input = gt->GetProperty(propName); + + if (!input) { + return; + } + + if (!*input) { + properties[propName].clear(); + return; + } + + std::string prepro = + cmGeneratorExpression::Preprocess(input, preprocessRule, true); + if (!prepro.empty()) { + this->ResolveTargetsInGeneratorExpressions(prepro, gt, missingTargets); + + if (!checkInterfaceDirs(prepro, gt, propName)) { + return; + } + properties[propName] = prepro; + } +} + void cmExportFileGenerator::PopulateInterfaceProperty( const std::string& propName, cmGeneratorTarget* target, cmGeneratorExpression::PreprocessContext preprocessRule, diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 954e6c5..6ca2e07 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -147,6 +147,10 @@ protected: cmTargetExport* target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap& properties, std::vector<std::string>& missingTargets); + void PopulateLinkDependsInterface( + cmTargetExport* target, + cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap& properties, std::vector<std::string>& missingTargets); void SetImportLinkInterface( const std::string& config, std::string const& suffix, diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 02686f3..3595708 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -103,6 +103,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gt, cmGeneratorExpression::InstallInterface, properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_LINK_OPTIONS", gt, + cmGeneratorExpression::InstallInterface, + properties, missingTargets); + this->PopulateLinkDependsInterface( + te, cmGeneratorExpression::InstallInterface, properties, missingTargets); std::string errorMessage; if (!this->PopulateExportProperties(gt, properties, errorMessage)) { diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index fe7159a..8d3dad7 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -6,6 +6,8 @@ #include <iostream> #include <sstream> +#include <stdexcept> +#include <utility> int cmExpr_yyparse(yyscan_t yyscanner); // @@ -13,11 +15,11 @@ cmExprParserHelper::cmExprParserHelper() { this->FileLine = -1; this->FileName = nullptr; + this->Result = 0; } cmExprParserHelper::~cmExprParserHelper() { - this->CleanupParser(); } int cmExprParserHelper::ParseString(const char* str, int verb) @@ -37,16 +39,34 @@ int cmExprParserHelper::ParseString(const char* str, int verb) yyscan_t yyscanner; cmExpr_yylex_init(&yyscanner); cmExpr_yyset_extra(this, yyscanner); - int res = cmExpr_yyparse(yyscanner); + + try { + int res = cmExpr_yyparse(yyscanner); + if (res != 0) { + std::string e = "cannot parse the expression: \"" + InputBuffer + "\": "; + e += ErrorString; + e += "."; + this->SetError(std::move(e)); + } + } catch (std::runtime_error const& fail) { + std::string e = + "cannot evaluate the expression: \"" + InputBuffer + "\": "; + e += fail.what(); + e += "."; + this->SetError(std::move(e)); + } catch (std::out_of_range const&) { + std::string e = "cannot evaluate the expression: \"" + InputBuffer + + "\": a numeric value is out of range."; + this->SetError(std::move(e)); + } catch (...) { + std::string e = "cannot parse the expression: \"" + InputBuffer + "\"."; + this->SetError(std::move(e)); + } cmExpr_yylex_destroy(yyscanner); - if (res != 0) { - // str << "CAL_Parser returned: " << res << std::endl; - // std::cerr << "When parsing: [" << str << "]" << std::endl; + if (!this->ErrorString.empty()) { return 0; } - this->CleanupParser(); - if (Verbose) { std::cerr << "Expanding [" << str << "] produced: [" << this->Result << "]" << std::endl; @@ -54,10 +74,6 @@ int cmExprParserHelper::ParseString(const char* str, int verb) return 1; } -void cmExprParserHelper::CleanupParser() -{ -} - int cmExprParserHelper::LexInput(char* buf, int maxlen) { // std::cout << "JPLexInput "; @@ -85,7 +101,21 @@ void cmExprParserHelper::Error(const char* str) this->ErrorString = ostr.str(); } -void cmExprParserHelper::SetResult(int value) +void cmExprParserHelper::UnexpectedChar(char c) +{ + unsigned long pos = static_cast<unsigned long>(this->InputBufferPos); + std::ostringstream ostr; + ostr << "Unexpected character in expression at position " << pos << ": " << c + << "\n"; + this->WarningString += ostr.str(); +} + +void cmExprParserHelper::SetResult(KWIML_INT_int64_t value) { this->Result = value; } + +void cmExprParserHelper::SetError(std::string errorString) +{ + this->ErrorString = std::move(errorString); +} diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index dcdaca9..42c460a 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -5,6 +5,8 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include "cm_kwiml.h" + #include <string> #include <vector> @@ -13,7 +15,7 @@ class cmExprParserHelper public: struct ParserType { - int Number; + KWIML_INT_int64_t Number; }; cmExprParserHelper(); @@ -24,12 +26,16 @@ public: int LexInput(char* buf, int maxlen); void Error(const char* str); - void SetResult(int value); + void SetResult(KWIML_INT_int64_t value); - int GetResult() { return this->Result; } + KWIML_INT_int64_t GetResult() { return this->Result; } const char* GetError() { return this->ErrorString.c_str(); } + void UnexpectedChar(char c); + + std::string const& GetWarning() const { return this->WarningString; } + private: std::string::size_type InputBufferPos; std::string InputBuffer; @@ -39,12 +45,13 @@ private: void Print(const char* place, const char* str); - void CleanupParser(); + void SetError(std::string errorString); - int Result; + KWIML_INT_int64_t Result; const char* FileName; long FileLine; std::string ErrorString; + std::string WarningString; }; #define YYSTYPE cmExprParserHelper::ParserType diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index dcb79f7..4c288f5 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -7,9 +7,10 @@ #include "cmsys/FStream.hxx" #include "cmsys/Glob.hxx" #include "cmsys/RegularExpression.hxx" -#include "cmsys/String.hxx" + #include <algorithm> #include <assert.h> +#include <ctype.h> #include <memory> // IWYU pragma: keep #include <sstream> #include <stdio.h> @@ -609,8 +610,8 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) continue; } - if ((c >= 0x20 && c < 0x7F) || c == '\t' || - (c == '\n' && newline_consume)) { + if (c >= 0 && c <= 0xFF && + (isprint(c) || c == '\t' || (c == '\n' && newline_consume))) { // This is an ASCII character that may be part of a string. // Cast added to avoid compiler warning. Cast is ok because // c is guaranteed to fit in char by the above if... @@ -2484,11 +2485,11 @@ bool cmFileCommand::HandleCMakePathCommand( #else char pathSep = ':'; #endif - std::vector<cmsys::String> path = cmSystemTools::SplitString(*i, pathSep); + std::vector<std::string> path = cmSystemTools::SplitString(*i, pathSep); i++; const char* var = i->c_str(); std::string value; - for (std::vector<cmsys::String>::iterator j = path.begin(); j != path.end(); + for (std::vector<std::string>::iterator j = path.begin(); j != path.end(); ++j) { if (j != path.begin()) { value += ";"; @@ -2498,7 +2499,7 @@ bool cmFileCommand::HandleCMakePathCommand( } else { *j = cmSystemTools::ConvertToOutputPath(*j); // remove double quotes in the path - cmsys::String& s = *j; + std::string& s = *j; if (s.size() > 1 && s[0] == '\"' && s[s.size() - 1] == '\"') { s = s.substr(1, s.size() - 2); diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 13a18e2..db34077 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -34,6 +34,9 @@ struct cmFindProgramHelper // Current names under consideration. std::vector<std::string> Names; + // Current name with extension under consideration. + std::string TestNameExt; + // Current full path under consideration. std::string TestPath; @@ -43,6 +46,19 @@ struct cmFindProgramHelper this->Names.clear(); this->AddName(name); } + bool CheckCompoundNames() + { + for (std::string const& n : this->Names) { + // Only perform search relative to current directory if the file name + // contains a directory separator. + if (n.find('/') != std::string::npos) { + if (this->CheckDirectoryForName("", n)) { + return true; + } + } + } + return false; + } bool CheckDirectory(std::string const& path) { for (std::string const& n : this->Names) { @@ -55,14 +71,16 @@ struct cmFindProgramHelper bool CheckDirectoryForName(std::string const& path, std::string const& name) { for (std::string const& ext : this->Extensions) { - this->TestPath = path; - this->TestPath += name; if (!ext.empty() && cmSystemTools::StringEndsWith(name, ext.c_str())) { continue; } - this->TestPath += ext; + this->TestNameExt = name; + this->TestNameExt += ext; + this->TestPath = + cmSystemTools::CollapseCombinedPath(path, this->TestNameExt); + if (cmSystemTools::FileExists(this->TestPath, true)) { - this->BestPath = cmSystemTools::CollapseFullPath(this->TestPath); + this->BestPath = this->TestPath; return true; } } @@ -145,8 +163,8 @@ std::string cmFindProgramCommand::FindNormalProgramNamesPerDir() helper.AddName(n); } - // Check for the names themselves (e.g. absolute paths). - if (helper.CheckDirectory(std::string())) { + // Check for the names themselves if they contain a directory separator. + if (helper.CheckCompoundNames()) { return helper.BestPath; } @@ -168,8 +186,8 @@ std::string cmFindProgramCommand::FindNormalProgramDirsPerName() // Switch to searching for this name. helper.SetName(n); - // Check for the name by itself (e.g. an absolute path). - if (helper.CheckDirectory(std::string())) { + // Check for the names themselves if they contain a directory separator. + if (helper.CheckCompoundNames()) { return helper.BestPath; } diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index a3a8f69..cd23904 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -25,7 +25,9 @@ struct cmGeneratorExpressionContext; SELECT(F, EvaluatingCompileOptions, COMPILE_OPTIONS) \ SELECT(F, EvaluatingAutoUicOptions, AUTOUIC_OPTIONS) \ SELECT(F, EvaluatingSources, SOURCES) \ - SELECT(F, EvaluatingCompileFeatures, COMPILE_FEATURES) + SELECT(F, EvaluatingCompileFeatures, COMPILE_FEATURES) \ + SELECT(F, EvaluatingLinkOptions, LINK_OPTIONS) \ + SELECT(F, EvaluatingLinkDepends, LINK_DEPENDS) #define CM_FOR_EACH_TRANSITIVE_PROPERTY(F) \ CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_BOTH) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b223c5e..098c13a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -102,6 +102,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) , DebugCompileOptionsDone(false) , DebugCompileFeaturesDone(false) , DebugCompileDefinitionsDone(false) + , DebugLinkOptionsDone(false) , DebugSourcesDone(false) , LinkImplementationLanguageIsContextDependent(true) , UtilityItemsDone(false) @@ -128,6 +129,10 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) t->GetCompileDefinitionsBacktraces(), this->CompileDefinitionsEntries); + CreatePropertyGeneratorExpressions(t->GetLinkOptionsEntries(), + t->GetLinkOptionsBacktraces(), + this->LinkOptionsEntries); + CreatePropertyGeneratorExpressions(t->GetSourceEntries(), t->GetSourceBacktraces(), this->SourceEntries, true); @@ -145,6 +150,7 @@ cmGeneratorTarget::~cmGeneratorTarget() cmDeleteAll(this->CompileOptionsEntries); cmDeleteAll(this->CompileFeaturesEntries); cmDeleteAll(this->CompileDefinitionsEntries); + cmDeleteAll(this->LinkOptionsEntries); cmDeleteAll(this->SourceEntries); cmDeleteAll(this->LinkInformation); } @@ -215,6 +221,15 @@ const char* cmGeneratorTarget::GetProperty(const std::string& prop) const return this->Target->GetProperty(prop); } +const char* cmGeneratorTarget::GetSafeProperty(const std::string& prop) const +{ + const char* ret = this->GetProperty(prop); + if (!ret) { + return ""; + } + return ret; +} + const char* cmGeneratorTarget::GetOutputTargetType( cmStateEnums::ArtifactType artifact) const { @@ -2633,7 +2648,7 @@ enum class OptionsParse Shell }; -static void processCompileOptionsInternal( +static void processOptionsInternal( cmGeneratorTarget const* tgt, const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries, std::vector<std::string>& options, @@ -2665,7 +2680,7 @@ static void processCompileOptionsInternal( if (!usedOptions.empty()) { tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage( cmake::LOG, - std::string("Used compile ") + logName + std::string(" for target ") + + std::string("Used ") + logName + std::string(" for target ") + tgt->GetName() + ":\n" + usedOptions, entry->ge->GetBacktrace()); } @@ -2680,9 +2695,9 @@ static void processCompileOptions( cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, bool debugOptions, std::string const& language) { - processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "options", - language, OptionsParse::Shell); + processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, + config, debugOptions, "compile options", language, + OptionsParse::Shell); } void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result, @@ -2734,9 +2749,9 @@ static void processCompileFeatures( cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, bool debugOptions) { - processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "features", - std::string(), OptionsParse::None); + processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, + config, debugOptions, "compile features", + std::string(), OptionsParse::None); } void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result, @@ -2784,9 +2799,9 @@ static void processCompileDefinitions( cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, bool debugOptions, std::string const& language) { - processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, - "definitions", language, OptionsParse::None); + processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, + config, debugOptions, "compile definitions", language, + OptionsParse::None); } void cmGeneratorTarget::GetCompileDefinitions( @@ -2855,6 +2870,195 @@ void cmGeneratorTarget::GetCompileDefinitions( cmDeleteAll(linkInterfaceCompileDefinitionsEntries); } +namespace { +void processLinkOptions( + cmGeneratorTarget const* tgt, + const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries, + std::vector<std::string>& options, + std::unordered_set<std::string>& uniqueOptions, + cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, + bool debugOptions, std::string const& language) +{ + processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, + config, debugOptions, "link options", language, + OptionsParse::Shell); +} +} + +void cmGeneratorTarget::GetLinkOptions(std::vector<std::string>& result, + const std::string& config, + const std::string& language) const +{ + std::unordered_set<std::string> uniqueOptions; + + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "LINK_OPTIONS", + nullptr, nullptr); + + std::vector<std::string> debugProperties; + const char* debugProp = + this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); + if (debugProp) { + cmSystemTools::ExpandListArgument(debugProp, debugProperties); + } + + bool debugOptions = !this->DebugLinkOptionsDone && + std::find(debugProperties.begin(), debugProperties.end(), + "LINK_OPTIONS") != debugProperties.end(); + + if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { + this->DebugLinkOptionsDone = true; + } + + processLinkOptions(this, this->LinkOptionsEntries, result, uniqueOptions, + &dagChecker, config, debugOptions, language); + + std::vector<cmGeneratorTarget::TargetPropertyEntry*> + linkInterfaceLinkOptionsEntries; + + AddInterfaceEntries(this, config, "INTERFACE_LINK_OPTIONS", + linkInterfaceLinkOptionsEntries); + + processLinkOptions(this, linkInterfaceLinkOptionsEntries, result, + uniqueOptions, &dagChecker, config, debugOptions, + language); + + cmDeleteAll(linkInterfaceLinkOptionsEntries); + + // Last step: replace "LINKER:" prefixed elements by + // actual linker wrapper + const std::string wrapper(this->Makefile->GetSafeDefinition( + "CMAKE_" + language + "_LINKER_WRAPPER_FLAG")); + std::vector<std::string> wrapperFlag; + cmSystemTools::ExpandListArgument(wrapper, wrapperFlag); + const std::string wrapperSep(this->Makefile->GetSafeDefinition( + "CMAKE_" + language + "_LINKER_WRAPPER_FLAG_SEP")); + bool concatFlagAndArgs = true; + if (!wrapperFlag.empty() && wrapperFlag.back() == " ") { + concatFlagAndArgs = false; + wrapperFlag.pop_back(); + } + + const std::string LINKER{ "LINKER:" }; + const std::string SHELL{ "SHELL:" }; + const std::string LINKER_SHELL = LINKER + SHELL; + + std::vector<std::string>::iterator entry; + while ((entry = std::find_if(result.begin(), result.end(), + [&LINKER](const std::string& item) -> bool { + return item.compare(0, LINKER.length(), + LINKER) == 0; + })) != result.end()) { + std::vector<std::string> linkerOptions; + if (entry->compare(0, LINKER_SHELL.length(), LINKER_SHELL) == 0) { + cmSystemTools::ParseUnixCommandLine( + entry->c_str() + LINKER_SHELL.length(), linkerOptions); + } else { + linkerOptions = + cmSystemTools::tokenize(entry->substr(LINKER.length()), ","); + } + entry = result.erase(entry); + + if (linkerOptions.empty() || + (linkerOptions.size() == 1 && linkerOptions.front().empty())) { + continue; + } + + // for now, raise an error if prefix SHELL: is part of arguments + if (std::find_if(linkerOptions.begin(), linkerOptions.end(), + [&SHELL](const std::string& item) -> bool { + return item.find(SHELL) != std::string::npos; + }) != linkerOptions.end()) { + this->LocalGenerator->GetCMakeInstance()->IssueMessage( + cmake::FATAL_ERROR, + "'SHELL:' prefix is not supported as part of 'LINKER:' arguments.", + this->GetBacktrace()); + return; + } + + if (wrapperFlag.empty()) { + // nothing specified, insert elements as is + result.insert(entry, linkerOptions.begin(), linkerOptions.end()); + } else { + std::vector<std::string> options; + + if (!wrapperSep.empty()) { + if (concatFlagAndArgs) { + // insert flag elements except last one + options.insert(options.end(), wrapperFlag.begin(), + wrapperFlag.end() - 1); + // concatenate last flag element and all LINKER list values + // in one option + options.push_back(wrapperFlag.back() + + cmJoin(linkerOptions, wrapperSep)); + } else { + options.insert(options.end(), wrapperFlag.begin(), + wrapperFlag.end()); + // concatenate all LINKER list values in one option + options.push_back(cmJoin(linkerOptions, wrapperSep)); + } + } else { + // prefix each element of LINKER list with wrapper + if (concatFlagAndArgs) { + std::transform( + linkerOptions.begin(), linkerOptions.end(), linkerOptions.begin(), + [&wrapperFlag](const std::string& value) -> std::string { + return wrapperFlag.back() + value; + }); + } + for (const auto& value : linkerOptions) { + options.insert(options.end(), wrapperFlag.begin(), + concatFlagAndArgs ? wrapperFlag.end() - 1 + : wrapperFlag.end()); + options.push_back(value); + } + } + result.insert(entry, options.begin(), options.end()); + } + } +} + +namespace { +void processLinkDepends( + cmGeneratorTarget const* tgt, + const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries, + std::vector<std::string>& options, + std::unordered_set<std::string>& uniqueOptions, + cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, + std::string const& language) +{ + processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, + config, false, "link depends", language, + OptionsParse::None); +} +} + +void cmGeneratorTarget::GetLinkDepends(std::vector<std::string>& result, + const std::string& config, + const std::string& language) const +{ + std::vector<cmGeneratorTarget::TargetPropertyEntry*> linkDependsEntries; + std::unordered_set<std::string> uniqueOptions; + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "LINK_DEPENDS", + nullptr, nullptr); + + if (const char* linkDepends = this->GetProperty("LINK_DEPENDS")) { + std::vector<std::string> depends; + cmGeneratorExpression ge; + cmSystemTools::ExpandListArgument(linkDepends, depends); + for (const auto& depend : depends) { + std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(depend); + linkDependsEntries.push_back( + new cmGeneratorTarget::TargetPropertyEntry(std::move(cge))); + } + } + AddInterfaceEntries(this, config, "INTERFACE_LINK_DEPENDS", + linkDependsEntries); + processLinkDepends(this, linkDependsEntries, result, uniqueOptions, + &dagChecker, config, language); + + cmDeleteAll(linkDependsEntries); +} + void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const { if (this->IsImported()) { @@ -3154,14 +3358,12 @@ std::string cmGeneratorTarget::GetFullNameInternal( return prefix + base + suffix; } -const char* cmGeneratorTarget::ImportedGetLocation( +std::string cmGeneratorTarget::ImportedGetLocation( const std::string& config) const { - static std::string location; assert(this->IsImported()); - location = this->Target->ImportedGetFullPath( + return this->Target->ImportedGetFullPath( config, cmStateEnums::RuntimeBinaryArtifact); - return location.c_str(); } std::string cmGeneratorTarget::GetFullNameImported( diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2132b15..6c1f931 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -68,7 +68,10 @@ public: std::string GetExportName() const; std::vector<std::string> GetPropertyKeys() const; + ///! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; + ///! Always returns a valid pointer + const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector<cmSourceFile*>& files, const std::string& config) const; @@ -418,6 +421,14 @@ public: const std::string& config, const std::string& language) const; + void GetLinkOptions(std::vector<std::string>& result, + const std::string& config, + const std::string& language) const; + + void GetLinkDepends(std::vector<std::string>& result, + const std::string& config, + const std::string& language) const; + bool IsSystemIncludeDirectory(const std::string& dir, const std::string& config, const std::string& language) const; @@ -647,7 +658,7 @@ public: no soname at all. */ bool IsImportedSharedLibWithoutSOName(const std::string& config) const; - const char* ImportedGetLocation(const std::string& config) const; + std::string ImportedGetLocation(const std::string& config) const; /** Get the target major and minor version numbers interpreted from the VERSION property. Version 0 is returned if the property is @@ -803,6 +814,7 @@ private: std::vector<TargetPropertyEntry*> CompileOptionsEntries; std::vector<TargetPropertyEntry*> CompileFeaturesEntries; std::vector<TargetPropertyEntry*> CompileDefinitionsEntries; + std::vector<TargetPropertyEntry*> LinkOptionsEntries; std::vector<TargetPropertyEntry*> SourceEntries; mutable std::set<std::string> LinkImplicitNullProperties; @@ -851,6 +863,7 @@ private: mutable bool DebugCompileOptionsDone; mutable bool DebugCompileFeaturesDone; mutable bool DebugCompileDefinitionsDone; + mutable bool DebugLinkOptionsDone; mutable bool DebugSourcesDone; mutable bool LinkImplementationLanguageIsContextDependent; mutable bool UtilityItemsDone; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2872831..c401844 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1318,7 +1318,9 @@ bool cmGlobalGenerator::Compute() // the AUTOMOC, AUTOUIC or AUTORCC property set auto autogenInits = this->CreateQtAutoGenInitializers(); for (auto& autoGen : autogenInits) { - autoGen->InitCustomTargets(); + if (!autoGen->InitCustomTargets()) { + return false; + } } #endif @@ -1341,7 +1343,9 @@ bool cmGlobalGenerator::Compute() #ifdef CMAKE_BUILD_WITH_CMAKE for (auto& autoGen : autogenInits) { - autoGen->SetupCustomTargets(); + if (!autoGen->SetupCustomTargets()) { + return false; + } autoGen.reset(nullptr); } autogenInits.clear(); diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 0328991..a9742c5 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -14,13 +14,13 @@ #include "cmVersion.h" const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj"; -const char* cmGlobalGhsMultiGenerator::DEFAULT_MAKE_PROGRAM = "gbuild"; +const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe"; +const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs"; cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm) : cmGlobalGenerator(cm) , OSDirRelative(false) { - this->GhsBuildCommandInitialized = false; } cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() @@ -41,133 +41,153 @@ void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry& entry) "Generates Green Hills MULTI files (experimental, work-in-progress)."; } -void cmGlobalGhsMultiGenerator::EnableLanguage( - std::vector<std::string> const& l, cmMakefile* mf, bool optional) +bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, + cmMakefile* mf) { - mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); - mf->AddDefinition("CMAKE_SYSTEM_PROCESSOR", "ARM"); - - const std::string ghsCompRoot(GetCompRoot()); - mf->AddDefinition("GHS_COMP_ROOT", ghsCompRoot.c_str()); - std::string ghsCompRootStart = - 0 == ghsCompRootStart.size() ? "" : ghsCompRoot + "/"; - mf->AddDefinition("CMAKE_C_COMPILER", - std::string(ghsCompRootStart + "ccarm.exe").c_str()); + std::string tsp; /* toolset path */ + std::string tsn = ts; /* toolset name */ + + GetToolset(mf, tsp, tsn); + + /* no toolset was found */ + if (tsn.empty()) { + return false; + } else if (ts.empty()) { + std::string message; + message = + "Green Hills MULTI: -T <toolset> not specified; defaulting to \""; + message += tsn; + message += "\""; + cmSystemTools::Message(message.c_str()); + + /* store the toolset for later use + * -- already done if -T<toolset> was specified + */ + mf->AddCacheDefinition("CMAKE_GENERATOR_TOOLSET", tsn.c_str(), + "Name of generator toolset.", + cmStateEnums::INTERNAL); + } + + /* set the build tool to use */ + const char* prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM"); + std::string gbuild(tsp + "/" + tsn + "/" + DEFAULT_BUILD_PROGRAM); + + /* check if the toolset changed from last generate */ + if (prevTool != NULL && (gbuild != prevTool)) { + std::string message = "generator toolset: "; + message += gbuild; + message += "\nDoes not match the toolset used previously: "; + message += prevTool; + message += "\nEither remove the CMakeCache.txt file and CMakeFiles " + "directory or choose a different binary directory."; + cmSystemTools::Error(message.c_str()); + } else { + /* store the toolset that is being used for this build */ + mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(), + "build program to use", cmStateEnums::INTERNAL, + true); + } + + mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsn.c_str()); + + // FIXME: compiler detection not implemented + // gbuild uses the primaryTarget setting in the top-level project + // file to determine which compiler to use. Because compiler + // detection is not implemented these variables must be + // set to skip past these tests. However cmake will verify that + // the executable pointed to by CMAKE_<LANG>_COMPILER exists. + // To pass this additional check gbuild is used as a place holder for the + // actual compiler. + mf->AddDefinition("CMAKE_C_COMPILER", gbuild.c_str()); mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE"); mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHS"); mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE"); - mf->AddDefinition("CMAKE_CXX_COMPILER", - std::string(ghsCompRootStart + "cxarm.exe").c_str()); + mf->AddDefinition("CMAKE_CXX_COMPILER", gbuild.c_str()); mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE"); mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHS"); mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE"); - if (!ghsCompRoot.empty()) { - static const char* compPreFix = "comp_"; - std::string compFilename = - cmsys::SystemTools::FindLastString(ghsCompRoot.c_str(), compPreFix); - cmsys::SystemTools::ReplaceString(compFilename, compPreFix, ""); - mf->AddDefinition("CMAKE_SYSTEM_VERSION", compFilename.c_str()); - } - - mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files - this->cmGlobalGenerator::EnableLanguage(l, mf, optional); + return true; } -bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* mf) +bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, + cmMakefile* mf) { - // The GHS generator knows how to lookup its build tool - // directly instead of needing a helper module to do it, so we - // do not actually need to put CMAKE_MAKE_PROGRAM into the cache. - if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) { - mf->AddDefinition("CMAKE_MAKE_PROGRAM", - this->GetGhsBuildCommand().c_str()); + if (p == "") { + cmSystemTools::Message( + "Green Hills MULTI: -A <arch> not specified; defaulting to \"arm\""); + std::string arch = "arm"; + + /* store the platform name for later use + * -- already done if -A<arch> was specified + */ + mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch.c_str(), + "Name of generator platform.", + cmStateEnums::INTERNAL); } - return true; -} -std::string const& cmGlobalGhsMultiGenerator::GetGhsBuildCommand() -{ - if (!this->GhsBuildCommandInitialized) { - this->GhsBuildCommandInitialized = true; - this->GhsBuildCommand = this->FindGhsBuildCommand(); + const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM"); + if (tgtPlatform == nullptr) { + tgtPlatform = "integrity"; } - return this->GhsBuildCommand; + + /* store the platform name for later use */ + mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform, + "Name of GHS target platform.", + cmStateEnums::INTERNAL); + + return true; } -std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand() +void cmGlobalGhsMultiGenerator::EnableLanguage( + std::vector<std::string> const& l, cmMakefile* mf, bool optional) { - std::vector<std::string> userPaths; - userPaths.push_back(this->GetCompRoot()); - std::string makeProgram = - cmSystemTools::FindProgram(DEFAULT_MAKE_PROGRAM, userPaths); - if (makeProgram.empty()) { - makeProgram = DEFAULT_MAKE_PROGRAM; - } - return makeProgram; + mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); + + mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files + this->cmGlobalGenerator::EnableLanguage(l, mf, optional); } -std::string cmGlobalGhsMultiGenerator::GetCompRoot() +bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* /*mf*/) { - std::string output; - - const std::vector<std::string> potentialDirsHardPaths( - GetCompRootHardPaths()); - const std::vector<std::string> potentialDirsRegistry(GetCompRootRegistry()); - - std::vector<std::string> potentialDirsComplete; - potentialDirsComplete.insert(potentialDirsComplete.end(), - potentialDirsHardPaths.begin(), - potentialDirsHardPaths.end()); - potentialDirsComplete.insert(potentialDirsComplete.end(), - potentialDirsRegistry.begin(), - potentialDirsRegistry.end()); - - // Use latest version - std::string outputDirName; - for (std::vector<std::string>::const_iterator potentialDirsCompleteIt = - potentialDirsComplete.begin(); - potentialDirsCompleteIt != potentialDirsComplete.end(); - ++potentialDirsCompleteIt) { - const std::string dirName( - cmsys::SystemTools::GetFilenameName(*potentialDirsCompleteIt)); - if (dirName.compare(outputDirName) > 0) { - output = *potentialDirsCompleteIt; - outputDirName = dirName; - } - } + // The GHS generator only knows how to lookup its build tool + // during generation of the project files, but this + // can only be done after the toolset is specified. - return output; + return true; } -std::vector<std::string> cmGlobalGhsMultiGenerator::GetCompRootHardPaths() +void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd, + std::string& ts) { - std::vector<std::string> output; - cmSystemTools::Glob("C:/ghs", "comp_[^;]+", output); - for (std::vector<std::string>::iterator outputIt = output.begin(); - outputIt != output.end(); ++outputIt) { - *outputIt = "C:/ghs/" + *outputIt; + const char* ghsRoot = mf->GetDefinition("GHS_TOOLSET_ROOT"); + + if (!ghsRoot) { + ghsRoot = DEFAULT_TOOLSET_ROOT; } - return output; -} + tsd = ghsRoot; -std::vector<std::string> cmGlobalGhsMultiGenerator::GetCompRootRegistry() -{ - std::vector<std::string> output(2); - cmsys::SystemTools::ReadRegistryValue( - "HKEY_LOCAL_" - "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" - "Windows\\CurrentVersion\\Uninstall\\" - "GreenHillsSoftwared771f1b4;InstallLocation", - output[0]); - cmsys::SystemTools::ReadRegistryValue( - "HKEY_LOCAL_" - "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" - "Windows\\CurrentVersion\\Uninstall\\" - "GreenHillsSoftware9881cef6;InstallLocation", - output[1]); - return output; + if (ts.empty()) { + std::vector<std::string> output; + + // Use latest? version + cmSystemTools::Glob(tsd, "comp_[^;]+", output); + + if (output.empty()) { + cmSystemTools::Error("GHS toolset not found in ", tsd.c_str()); + ts = ""; + } else { + ts = output.back(); + } + } else { + std::string tryPath = tsd + std::string("/") + ts; + if (!cmSystemTools::FileExists(tryPath)) { + cmSystemTools::Error("GHS toolset \"", ts.c_str(), "\" not found in ", + tsd.c_str()); + ts = ""; + } + } } void cmGlobalGhsMultiGenerator::OpenBuildFileStream( @@ -216,25 +236,28 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream() this->OSDirRelative = true; } - char const* bspName = + std::string bspName; + char const* bspCache = this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); - if (NULL == bspName) { - bspName = ""; - cmSystemTools::Error("GHS_BSP_NAME cache variable must be set"); - } else { + if (bspCache) { + bspName = bspCache; this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME"); } - std::string fBspName(this->trimQuotes(bspName)); - std::replace(fBspName.begin(), fBspName.end(), '\\', '/'); + if (bspName.empty() || bspName.compare("IGNORE") == 0) { + const char* a = + this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM"); + bspName = "sim"; + bspName += (a ? a : ""); + } + this->WriteMacros(); this->WriteHighLevelDirectives(); GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream()); this->WriteDisclaimer(this->GetBuildFileStream()); *this->GetBuildFileStream() << "# Top Level Project File" << std::endl; - if (!fBspName.empty()) { - *this->GetBuildFileStream() << " -bsp " << fBspName << std::endl; - } + *this->GetBuildFileStream() << " -bsp " << bspName << std::endl; + this->WriteCompilerOptions(fOSDir); } @@ -275,8 +298,10 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand( const std::string& targetName, const std::string& /*config*/, bool /*fast*/, int jobs, bool /*verbose*/, std::vector<std::string> const& makeOptions) { + const char* gbuild = + this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); makeCommand.push_back( - this->SelectMakeProgram(makeProgram, this->GetGhsBuildCommand())); + this->SelectMakeProgram(makeProgram, (std::string)gbuild)); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { makeCommand.push_back("-parallel"); @@ -313,8 +338,26 @@ void cmGlobalGhsMultiGenerator::WriteMacros() void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() { - *this->GetBuildFileStream() - << "primaryTarget=arm_integrity.tgt" << std::endl; + /* set primary target */ + std::string tgt; + const char* t = + this->GetCMakeInstance()->GetCacheDefinition("GHS_PRIMARY_TARGET"); + if (t) { + tgt = t; + this->GetCMakeInstance()->MarkCliAsUsed("GHS_PRIMARY_TARGET"); + } else { + const char* a = + this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM"); + const char* p = + this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM"); + tgt = (a ? a : ""); + tgt += "_"; + tgt += (p ? p : ""); + tgt += ".tgt"; + } + + *this->GetBuildFileStream() << "primaryTarget=" << tgt << std::endl; + char const* const customization = this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); if (NULL != customization && strlen(customization) > 0) { @@ -348,16 +391,14 @@ void cmGlobalGhsMultiGenerator::AddFilesUpToPath( { std::string workingPath(path); cmSystemTools::ConvertToUnixSlashes(workingPath); - std::vector<cmsys::String> splitPath = - cmSystemTools::SplitString(workingPath); + std::vector<std::string> splitPath = cmSystemTools::SplitString(workingPath); std::string workingRelPath(relPath); cmSystemTools::ConvertToUnixSlashes(workingRelPath); if (!workingRelPath.empty()) { workingRelPath += "/"; } std::string pathUpTo; - for (std::vector<cmsys::String>::const_iterator splitPathI = - splitPath.begin(); + for (std::vector<std::string>::const_iterator splitPathI = splitPath.begin(); splitPath.end() != splitPathI; ++splitPathI) { pathUpTo += *splitPathI; if (targetFolderBuildStreams->end() == @@ -415,11 +456,11 @@ void cmGlobalGhsMultiGenerator::AddFilesUpToPathNewBuildFile( void cmGlobalGhsMultiGenerator::AddFilesUpToPathAppendNextFile( std::map<std::string, cmGeneratedFileStream*>* targetFolderBuildStreams, std::string const& pathUpTo, - std::vector<cmsys::String>::const_iterator splitPathI, - std::vector<cmsys::String>::const_iterator end, + std::vector<std::string>::const_iterator splitPathI, + std::vector<std::string>::const_iterator end, GhsMultiGpj::Types const projType) { - std::vector<cmsys::String>::const_iterator splitPathNextI = splitPathI + 1; + std::vector<std::string>::const_iterator splitPathNextI = splitPathI + 1; if (end != splitPathNextI && targetFolderBuildStreams->end() == targetFolderBuildStreams->find(pathUpTo + "/" + *splitPathNextI)) { @@ -436,7 +477,7 @@ std::string cmGlobalGhsMultiGenerator::GetFileNameFromPath( std::string output(path); if (!path.empty()) { cmSystemTools::ConvertToUnixSlashes(output); - std::vector<cmsys::String> splitPath = cmSystemTools::SplitString(output); + std::vector<std::string> splitPath = cmSystemTools::SplitString(output); output += "/" + splitPath.back() + FILE_EXTENSION; } return output; @@ -457,7 +498,7 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles( this->GetCMakeInstance()->GetHomeOutputDirectory().c_str(), folderName, GhsMultiGpj::PROJECT); } - std::vector<cmsys::String> splitPath = cmSystemTools::SplitString( + std::vector<std::string> splitPath = cmSystemTools::SplitString( cmGhsMultiTargetGenerator::GetRelBuildFileName(tgt)); std::string foldNameRelBuildFile(*(splitPath.end() - 2) + "/" + splitPath.back()); diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 30d4d3b..13c5113 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -40,13 +40,17 @@ public: * Utilized by the generator factory to determine if this generator * supports toolsets. */ - static bool SupportsToolset() { return false; } + static bool SupportsToolset() { return true; } /** * Utilized by the generator factory to determine if this generator * supports platforms. */ - static bool SupportsPlatform() { return false; } + static bool SupportsPlatform() { return true; } + + // Toolset / Platform Support + virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); + virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf); /** * Try to determine system information such as shared library @@ -93,11 +97,7 @@ protected: std::vector<std::string> const& makeOptions = std::vector<std::string>()); private: - std::string const& GetGhsBuildCommand(); - std::string FindGhsBuildCommand(); - std::string GetCompRoot(); - std::vector<std::string> GetCompRootHardPaths(); - std::vector<std::string> GetCompRootRegistry(); + void GetToolset(cmMakefile* mf, std::string& tsd, std::string& ts); void OpenBuildFileStream(); void WriteMacros(); @@ -112,9 +112,8 @@ private: static void AddFilesUpToPathAppendNextFile( std::map<std::string, cmGeneratedFileStream*>* targetFolderBuildStreams, std::string const& pathUpTo, - std::vector<cmsys::String>::const_iterator splitPathI, - std::vector<cmsys::String>::const_iterator end, - GhsMultiGpj::Types projType); + std::vector<std::string>::const_iterator splitPathI, + std::vector<std::string>::const_iterator end, GhsMultiGpj::Types projType); static std::string GetFileNameFromPath(std::string const& path); void UpdateBuildFiles(const std::vector<cmGeneratorTarget*>& tgts); bool IsTgtForBuild(const cmGeneratorTarget* tgt); @@ -125,9 +124,8 @@ private: std::vector<std::string> LibDirs; bool OSDirRelative; - bool GhsBuildCommandInitialized; - std::string GhsBuildCommand; - static const char* DEFAULT_MAKE_PROGRAM; + static const char* DEFAULT_BUILD_PROGRAM; + static const char* DEFAULT_TOOLSET_ROOT; }; #endif diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 158f484..21121f2 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -397,12 +397,12 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( if (written && this->UseFolderProperty()) { const std::string targetFolder = target->GetEffectiveFolderName(); if (!targetFolder.empty()) { - std::vector<cmsys::String> tokens = + std::vector<std::string> tokens = cmSystemTools::SplitString(targetFolder, '/', false); std::string cumulativePath; - for (cmsys::String const& iter : tokens) { + for (std::string const& iter : tokens) { if (!iter.size()) { continue; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e9a08bf..042ce41 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -386,12 +386,46 @@ void cmGlobalXCodeGenerator::AddExtraIDETargets() } } +void cmGlobalXCodeGenerator::ComputeTargetOrder() +{ + size_t index = 0; + auto const& lgens = this->GetLocalGenerators(); + for (cmLocalGenerator* lgen : lgens) { + auto const& targets = lgen->GetGeneratorTargets(); + for (cmGeneratorTarget const* gt : targets) { + this->ComputeTargetOrder(gt, index); + } + } + assert(index == this->TargetOrderIndex.size()); +} + +void cmGlobalXCodeGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt, + size_t& index) +{ + std::map<cmGeneratorTarget const*, size_t>::value_type value(gt, 0); + auto insertion = this->TargetOrderIndex.insert(value); + if (!insertion.second) { + return; + } + auto entry = insertion.first; + + auto& deps = this->GetTargetDirectDepends(gt); + for (auto& d : deps) { + this->ComputeTargetOrder(d, index); + } + + entry->second = index++; +} + void cmGlobalXCodeGenerator::Generate() { this->cmGlobalGenerator::Generate(); if (cmSystemTools::GetErrorOccuredFlag()) { return; } + + this->ComputeTargetOrder(); + for (auto keyVal : this->ProjectMap) { cmLocalGenerator* root = keyVal.second[0]; @@ -1031,15 +1065,17 @@ struct cmSourceFilePathCompare struct cmCompareTargets { - bool operator()(std::string const& a, std::string const& b) const + bool operator()(cmXCodeObject* l, cmXCodeObject* r) const { + std::string const& a = l->GetTarget()->GetName(); + std::string const& b = r->GetTarget()->GetName(); if (a == "ALL_BUILD") { return true; } if (b == "ALL_BUILD") { return false; } - return strcmp(a.c_str(), b.c_str()) < 0; + return a < b; } }; @@ -1047,274 +1083,279 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( cmLocalGenerator* gen, std::vector<cmXCodeObject*>& targets) { this->SetCurrentLocalGenerator(gen); - typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets> - cmSortedTargets; - cmSortedTargets sortedTargets; - for (auto tgt : this->CurrentLocalGenerator->GetGeneratorTargets()) { - sortedTargets[tgt->GetName()] = tgt; + std::vector<cmGeneratorTarget*> gts = + this->CurrentLocalGenerator->GetGeneratorTargets(); + std::sort(gts.begin(), gts.end(), + [this](cmGeneratorTarget const* l, cmGeneratorTarget const* r) { + return this->TargetOrderIndex[l] < this->TargetOrderIndex[r]; + }); + for (auto gtgt : gts) { + if (!this->CreateXCodeTarget(gtgt, targets)) { + return false; + } } - for (auto& sortedTarget : sortedTargets) { - cmGeneratorTarget* gtgt = sortedTarget.second; - - std::string targetName = gtgt->GetName(); + std::sort(targets.begin(), targets.end(), cmCompareTargets()); + return true; +} - // make sure ALL_BUILD, INSTALL, etc are only done once - if (this->SpecialTargetEmitted(targetName)) { - continue; - } +bool cmGlobalXCodeGenerator::CreateXCodeTarget( + cmGeneratorTarget* gtgt, std::vector<cmXCodeObject*>& targets) +{ + std::string targetName = gtgt->GetName(); - if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { - continue; - } + // make sure ALL_BUILD, INSTALL, etc are only done once + if (this->SpecialTargetEmitted(targetName)) { + return true; + } - if (gtgt->GetType() == cmStateEnums::UTILITY || - gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) { - cmXCodeObject* t = this->CreateUtilityTarget(gtgt); - if (!t) { - return false; - } - targets.push_back(t); - continue; - } + if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + return true; + } - // organize the sources - std::vector<cmSourceFile*> classes; - if (!gtgt->GetConfigCommonSourceFiles(classes)) { + if (gtgt->GetType() == cmStateEnums::UTILITY || + gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) { + cmXCodeObject* t = this->CreateUtilityTarget(gtgt); + if (!t) { return false; } + targets.push_back(t); + return true; + } - // Add CMakeLists.txt file for user convenience. - this->AddXCodeProjBuildRule(gtgt, classes); + // organize the sources + std::vector<cmSourceFile*> classes; + if (!gtgt->GetConfigCommonSourceFiles(classes)) { + return false; + } - std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); + // Add CMakeLists.txt file for user convenience. + this->AddXCodeProjBuildRule(gtgt, classes); - gtgt->ComputeObjectMapping(); + std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); - std::vector<cmXCodeObject*> externalObjFiles; - std::vector<cmXCodeObject*> headerFiles; - std::vector<cmXCodeObject*> resourceFiles; - std::vector<cmXCodeObject*> sourceFiles; - for (auto sourceFile : classes) { - cmXCodeObject* xsf = this->CreateXCodeSourceFile( - this->CurrentLocalGenerator, sourceFile, gtgt); - cmXCodeObject* fr = xsf->GetObject("fileRef"); - cmXCodeObject* filetype = fr->GetObject()->GetObject("explicitFileType"); + gtgt->ComputeObjectMapping(); - cmGeneratorTarget::SourceFileFlags tsFlags = - gtgt->GetTargetSourceFileFlags(sourceFile); + std::vector<cmXCodeObject*> externalObjFiles; + std::vector<cmXCodeObject*> headerFiles; + std::vector<cmXCodeObject*> resourceFiles; + std::vector<cmXCodeObject*> sourceFiles; + for (auto sourceFile : classes) { + cmXCodeObject* xsf = this->CreateXCodeSourceFile( + this->CurrentLocalGenerator, sourceFile, gtgt); + cmXCodeObject* fr = xsf->GetObject("fileRef"); + cmXCodeObject* filetype = fr->GetObject()->GetObject("explicitFileType"); - if (filetype && filetype->GetString() == "compiled.mach-o.objfile") { - if (sourceFile->GetObjectLibrary().empty()) { - externalObjFiles.push_back(xsf); - } - } else if (this->IsHeaderFile(sourceFile) || - (tsFlags.Type == - cmGeneratorTarget::SourceFileTypePrivateHeader) || - (tsFlags.Type == - cmGeneratorTarget::SourceFileTypePublicHeader)) { - headerFiles.push_back(xsf); - } else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource) { - resourceFiles.push_back(xsf); - } else if (!sourceFile->GetPropertyAsBool("HEADER_FILE_ONLY")) { - // Include this file in the build if it has a known language - // and has not been listed as an ignored extension for this - // generator. - if (!this->CurrentLocalGenerator->GetSourceFileLanguage(*sourceFile) - .empty() && - !this->IgnoreFile(sourceFile->GetExtension().c_str())) { - sourceFiles.push_back(xsf); - } - } - } + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(sourceFile); - if (this->XcodeVersion < 50) { - // Add object library contents as external objects. (Equivalent to - // the externalObjFiles above, except each one is not a cmSourceFile - // within the target.) - std::vector<cmSourceFile const*> objs; - gtgt->GetExternalObjects(objs, ""); - for (auto sourceFile : objs) { - if (sourceFile->GetObjectLibrary().empty()) { - continue; - } - std::string const& obj = sourceFile->GetFullPath(); - cmXCodeObject* xsf = - this->CreateXCodeSourceFileFromPath(obj, gtgt, "", nullptr); + if (filetype && filetype->GetString() == "compiled.mach-o.objfile") { + if (sourceFile->GetObjectLibrary().empty()) { externalObjFiles.push_back(xsf); } - } - - // some build phases only apply to bundles and/or frameworks - bool isFrameworkTarget = gtgt->IsFrameworkOnApple(); - bool isBundleTarget = gtgt->GetPropertyAsBool("MACOSX_BUNDLE"); - bool isCFBundleTarget = gtgt->IsCFBundleOnApple(); - - cmXCodeObject* buildFiles = nullptr; - - // create source build phase - cmXCodeObject* sourceBuildPhase = nullptr; - if (!sourceFiles.empty()) { - sourceBuildPhase = - this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase); - sourceBuildPhase->SetComment("Sources"); - sourceBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (auto& sourceFile : sourceFiles) { - buildFiles->AddObject(sourceFile); + } else if (this->IsHeaderFile(sourceFile) || + (tsFlags.Type == + cmGeneratorTarget::SourceFileTypePrivateHeader) || + (tsFlags.Type == + cmGeneratorTarget::SourceFileTypePublicHeader)) { + headerFiles.push_back(xsf); + } else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource) { + resourceFiles.push_back(xsf); + } else if (!sourceFile->GetPropertyAsBool("HEADER_FILE_ONLY")) { + // Include this file in the build if it has a known language + // and has not been listed as an ignored extension for this + // generator. + if (!this->CurrentLocalGenerator->GetSourceFileLanguage(*sourceFile) + .empty() && + !this->IgnoreFile(sourceFile->GetExtension().c_str())) { + sourceFiles.push_back(xsf); } - sourceBuildPhase->AddAttribute("files", buildFiles); - sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); } + } - // create header build phase - only for framework targets - cmXCodeObject* headerBuildPhase = nullptr; - if (!headerFiles.empty() && isFrameworkTarget) { - headerBuildPhase = - this->CreateObject(cmXCodeObject::PBXHeadersBuildPhase); - headerBuildPhase->SetComment("Headers"); - headerBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (auto& headerFile : headerFiles) { - buildFiles->AddObject(headerFile); + if (this->XcodeVersion < 50) { + // Add object library contents as external objects. (Equivalent to + // the externalObjFiles above, except each one is not a cmSourceFile + // within the target.) + std::vector<cmSourceFile const*> objs; + gtgt->GetExternalObjects(objs, ""); + for (auto sourceFile : objs) { + if (sourceFile->GetObjectLibrary().empty()) { + continue; } - headerBuildPhase->AddAttribute("files", buildFiles); - headerBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); + std::string const& obj = sourceFile->GetFullPath(); + cmXCodeObject* xsf = + this->CreateXCodeSourceFileFromPath(obj, gtgt, "", nullptr); + externalObjFiles.push_back(xsf); + } + } + + // some build phases only apply to bundles and/or frameworks + bool isFrameworkTarget = gtgt->IsFrameworkOnApple(); + bool isBundleTarget = gtgt->GetPropertyAsBool("MACOSX_BUNDLE"); + bool isCFBundleTarget = gtgt->IsCFBundleOnApple(); + + cmXCodeObject* buildFiles = nullptr; + + // create source build phase + cmXCodeObject* sourceBuildPhase = nullptr; + if (!sourceFiles.empty()) { + sourceBuildPhase = this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase); + sourceBuildPhase->SetComment("Sources"); + sourceBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (auto& sourceFile : sourceFiles) { + buildFiles->AddObject(sourceFile); + } + sourceBuildPhase->AddAttribute("files", buildFiles); + sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } + + // create header build phase - only for framework targets + cmXCodeObject* headerBuildPhase = nullptr; + if (!headerFiles.empty() && isFrameworkTarget) { + headerBuildPhase = this->CreateObject(cmXCodeObject::PBXHeadersBuildPhase); + headerBuildPhase->SetComment("Headers"); + headerBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (auto& headerFile : headerFiles) { + buildFiles->AddObject(headerFile); + } + headerBuildPhase->AddAttribute("files", buildFiles); + headerBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } + + // create resource build phase - only for framework or bundle targets + cmXCodeObject* resourceBuildPhase = nullptr; + if (!resourceFiles.empty() && + (isFrameworkTarget || isBundleTarget || isCFBundleTarget)) { + resourceBuildPhase = + this->CreateObject(cmXCodeObject::PBXResourcesBuildPhase); + resourceBuildPhase->SetComment("Resources"); + resourceBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (auto& resourceFile : resourceFiles) { + buildFiles->AddObject(resourceFile); } + resourceBuildPhase->AddAttribute("files", buildFiles); + resourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } - // create resource build phase - only for framework or bundle targets - cmXCodeObject* resourceBuildPhase = nullptr; - if (!resourceFiles.empty() && - (isFrameworkTarget || isBundleTarget || isCFBundleTarget)) { - resourceBuildPhase = - this->CreateObject(cmXCodeObject::PBXResourcesBuildPhase); - resourceBuildPhase->SetComment("Resources"); - resourceBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (auto& resourceFile : resourceFiles) { - buildFiles->AddObject(resourceFile); - } - resourceBuildPhase->AddAttribute("files", buildFiles); - resourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); - } - - // create vector of "non-resource content file" build phases - only for - // framework or bundle targets - std::vector<cmXCodeObject*> contentBuildPhases; - if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { - typedef std::map<std::string, std::vector<cmSourceFile*>> - mapOfVectorOfSourceFiles; - mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : classes) { - cmGeneratorTarget::SourceFileFlags tsFlags = - gtgt->GetTargetSourceFileFlags(sourceFile); - if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) { - bundleFiles[tsFlags.MacFolder].push_back(sourceFile); - } + // create vector of "non-resource content file" build phases - only for + // framework or bundle targets + std::vector<cmXCodeObject*> contentBuildPhases; + if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { + typedef std::map<std::string, std::vector<cmSourceFile*>> + mapOfVectorOfSourceFiles; + mapOfVectorOfSourceFiles bundleFiles; + for (auto sourceFile : classes) { + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(sourceFile); + if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) { + bundleFiles[tsFlags.MacFolder].push_back(sourceFile); } - for (auto keySources : bundleFiles) { - cmXCodeObject* copyFilesBuildPhase = - this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); - copyFilesBuildPhase->SetComment("Copy files"); - copyFilesBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", - this->CreateString("6")); - std::ostringstream ostr; - if (gtgt->IsFrameworkOnApple()) { - // dstPath in frameworks is relative to Versions/<version> + } + for (auto keySources : bundleFiles) { + cmXCodeObject* copyFilesBuildPhase = + this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); + copyFilesBuildPhase->SetComment("Copy files"); + copyFilesBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", + this->CreateString("6")); + std::ostringstream ostr; + if (gtgt->IsFrameworkOnApple()) { + // dstPath in frameworks is relative to Versions/<version> + ostr << keySources.first; + } else if (keySources.first != "MacOS") { + if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) { ostr << keySources.first; - } else if (keySources.first != "MacOS") { - if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) { - ostr << keySources.first; - } else { - // dstPath in bundles is relative to Contents/MacOS - ostr << "../" << keySources.first; - } - } - copyFilesBuildPhase->AddAttribute("dstPath", - this->CreateString(ostr.str())); - copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - copyFilesBuildPhase->AddAttribute("files", buildFiles); - for (auto sourceFile : keySources.second) { - cmXCodeObject* xsf = this->CreateXCodeSourceFile( - this->CurrentLocalGenerator, sourceFile, gtgt); - buildFiles->AddObject(xsf); + } else { + // dstPath in bundles is relative to Contents/MacOS + ostr << "../" << keySources.first; } - contentBuildPhases.push_back(copyFilesBuildPhase); } + copyFilesBuildPhase->AddAttribute("dstPath", + this->CreateString(ostr.str())); + copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + copyFilesBuildPhase->AddAttribute("files", buildFiles); + for (auto sourceFile : keySources.second) { + cmXCodeObject* xsf = this->CreateXCodeSourceFile( + this->CurrentLocalGenerator, sourceFile, gtgt); + buildFiles->AddObject(xsf); + } + contentBuildPhases.push_back(copyFilesBuildPhase); } + } - // create vector of "resource content file" build phases - only for - // framework or bundle targets - if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { - typedef std::map<std::string, std::vector<cmSourceFile*>> - mapOfVectorOfSourceFiles; - mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : classes) { - cmGeneratorTarget::SourceFileFlags tsFlags = - gtgt->GetTargetSourceFileFlags(sourceFile); - if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) { - bundleFiles[tsFlags.MacFolder].push_back(sourceFile); - } - } - for (auto keySources : bundleFiles) { - cmXCodeObject* copyFilesBuildPhase = - this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); - copyFilesBuildPhase->SetComment("Copy files"); - copyFilesBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", - this->CreateString("7")); - copyFilesBuildPhase->AddAttribute( - "dstPath", this->CreateString(keySources.first)); - copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - copyFilesBuildPhase->AddAttribute("files", buildFiles); - for (auto sourceFile : keySources.second) { - cmXCodeObject* xsf = this->CreateXCodeSourceFile( - this->CurrentLocalGenerator, sourceFile, gtgt); - buildFiles->AddObject(xsf); - } - contentBuildPhases.push_back(copyFilesBuildPhase); + // create vector of "resource content file" build phases - only for + // framework or bundle targets + if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { + typedef std::map<std::string, std::vector<cmSourceFile*>> + mapOfVectorOfSourceFiles; + mapOfVectorOfSourceFiles bundleFiles; + for (auto sourceFile : classes) { + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(sourceFile); + if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) { + bundleFiles[tsFlags.MacFolder].push_back(sourceFile); } } - - // create framework build phase - cmXCodeObject* frameworkBuildPhase = nullptr; - if (!externalObjFiles.empty()) { - frameworkBuildPhase = - this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase); - frameworkBuildPhase->SetComment("Frameworks"); - frameworkBuildPhase->AddAttribute("buildActionMask", + for (auto keySources : bundleFiles) { + cmXCodeObject* copyFilesBuildPhase = + this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); + copyFilesBuildPhase->SetComment("Copy files"); + copyFilesBuildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); + copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", + this->CreateString("7")); + copyFilesBuildPhase->AddAttribute("dstPath", + this->CreateString(keySources.first)); + copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - frameworkBuildPhase->AddAttribute("files", buildFiles); - for (auto& externalObjFile : externalObjFiles) { - buildFiles->AddObject(externalObjFile); + copyFilesBuildPhase->AddAttribute("files", buildFiles); + for (auto sourceFile : keySources.second) { + cmXCodeObject* xsf = this->CreateXCodeSourceFile( + this->CurrentLocalGenerator, sourceFile, gtgt); + buildFiles->AddObject(xsf); } - frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); + contentBuildPhases.push_back(copyFilesBuildPhase); + } + } + + // create framework build phase + cmXCodeObject* frameworkBuildPhase = nullptr; + if (!externalObjFiles.empty()) { + frameworkBuildPhase = + this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase); + frameworkBuildPhase->SetComment("Frameworks"); + frameworkBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + frameworkBuildPhase->AddAttribute("files", buildFiles); + for (auto& externalObjFile : externalObjFiles) { + buildFiles->AddObject(externalObjFile); } + frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } - // create list of build phases and create the Xcode target - cmXCodeObject* buildPhases = - this->CreateObject(cmXCodeObject::OBJECT_LIST); + // create list of build phases and create the Xcode target + cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST); - this->CreateCustomCommands(buildPhases, sourceBuildPhase, headerBuildPhase, - resourceBuildPhase, contentBuildPhases, - frameworkBuildPhase, gtgt); + this->CreateCustomCommands(buildPhases, sourceBuildPhase, headerBuildPhase, + resourceBuildPhase, contentBuildPhases, + frameworkBuildPhase, gtgt); - targets.push_back(this->CreateXCodeTarget(gtgt, buildPhases)); - } + targets.push_back(this->CreateXCodeTarget(gtgt, buildPhases)); return true; } @@ -1817,6 +1858,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CurrentLocalGenerator->AppendFlags(extraLinkOptions, linkFlags); } } + std::vector<std::string> opts; + gtgt->GetLinkOptions(opts, configName, llang); + // LINK_OPTIONS are escaped. + this->CurrentLocalGenerator->AppendCompileOptions(extraLinkOptions, opts); } // Set target-specific architectures. @@ -3315,13 +3360,6 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( if (generators.empty()) { return; } - // Skip local generators that are excluded from this project. - for (auto generator : generators) { - if (this->IsExcluded(root, generator)) { - continue; - } - } - if (!this->CreateXCodeObjects(root, generators)) { return; } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ccef6e2..f7bca13 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -109,6 +109,8 @@ public: protected: void AddExtraIDETargets() override; + void ComputeTargetOrder(); + void ComputeTargetOrder(cmGeneratorTarget const* gt, size_t& index); void Generate() override; private: @@ -204,6 +206,8 @@ private: void AddXCodeProjBuildRule(cmGeneratorTarget* target, std::vector<cmSourceFile*>& sources) const; bool CreateXCodeTargets(cmLocalGenerator* gen, std::vector<cmXCodeObject*>&); + bool CreateXCodeTarget(cmGeneratorTarget* gtgt, + std::vector<cmXCodeObject*>&); bool IsHeaderFile(cmSourceFile*); void AddDependTarget(cmXCodeObject* target, cmXCodeObject* dependTarget); void CreateXCodeDependHackTarget(std::vector<cmXCodeObject*>& targets); @@ -286,6 +290,7 @@ private: std::string ObjectDirArchDefault; std::string ObjectDirArch; std::string GeneratorToolset; + std::map<cmGeneratorTarget const*, size_t> TargetOrderIndex; }; #endif diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx index 8deb8c1..4e29f39 100644 --- a/Source/cmHexFileConverter.cxx +++ b/Source/cmHexFileConverter.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmHexFileConverter.h" +#include <ctype.h> #include <stdio.h> #include <string.h> @@ -12,13 +13,6 @@ #define MOTOROLA_SREC_MIN_LINE_LENGTH (2 + 2 + 4 + 2) #define MOTOROLA_SREC_MAX_LINE_LENGTH (2 + 2 + 8 + (256 * 2) + 2) -// might go to SystemTools ? -static bool cm_IsHexChar(char c) -{ - return (((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) || - ((c >= 'A') && (c <= 'F'))); -} - static unsigned int ChompStrlen(const char* line) { if (line == nullptr) { @@ -169,7 +163,7 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType( } for (unsigned int i = 1; i < slen; i++) { - if (!cm_IsHexChar(buf[i])) { + if (!isxdigit(buf[i])) { return Binary; } } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 87dcb18..99409c2 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -362,7 +362,12 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) return false; } // Lookup this target in the current directory. - if (cmTarget* target = this->Makefile->FindLocalNonAliasTarget(tgt)) { + cmTarget* target = this->Makefile->FindLocalNonAliasTarget(tgt); + if (!target) { + // If no local target has been found, find it in the global scope. + target = this->Makefile->GetGlobalGenerator()->FindTarget(tgt, true); + } + if (target) { // Found the target. Check its type. if (target->GetType() != cmStateEnums::EXECUTABLE && target->GetType() != cmStateEnums::STATIC_LIBRARY && @@ -381,8 +386,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) } else { // Did not find the target. std::ostringstream e; - e << "TARGETS given target \"" << tgt - << "\" which does not exist in this directory."; + e << "TARGETS given target \"" << tgt << "\" which does not exist."; this->SetError(e.str()); return false; } diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index f7e6e44..3a90f4c 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmInstallScriptGenerator.h" +#include "cmGeneratorExpression.h" #include "cmScriptGenerator.h" #include <ostream> @@ -16,24 +17,47 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script, , Script(script) , Code(code) { + // We need per-config actions if the script has generator expressions. + if (cmGeneratorExpression::Find(Script) != std::string::npos) { + this->ActionsPerConfig = true; + } } cmInstallScriptGenerator::~cmInstallScriptGenerator() { } -void cmInstallScriptGenerator::GenerateScript(std::ostream& os) +void cmInstallScriptGenerator::Compute(cmLocalGenerator* lg) { - Indent indent; - std::string component_test = - this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll); - os << indent << "if(" << component_test << ")\n"; + this->LocalGenerator = lg; +} +void cmInstallScriptGenerator::AddScriptInstallRule(std::ostream& os, + Indent indent, + std::string const& script) +{ if (this->Code) { - os << indent.Next() << this->Script << "\n"; + os << indent.Next() << script << "\n"; + } else { + os << indent.Next() << "include(\"" << script << "\")\n"; + } +} + +void cmInstallScriptGenerator::GenerateScriptActions(std::ostream& os, + Indent indent) +{ + if (this->ActionsPerConfig) { + this->cmInstallGenerator::GenerateScriptActions(os, indent); } else { - os << indent.Next() << "include(\"" << this->Script << "\")\n"; + this->AddScriptInstallRule(os, indent, this->Script); } +} - os << indent << "endif()\n\n"; +void cmInstallScriptGenerator::GenerateScriptForConfig( + std::ostream& os, const std::string& config, Indent indent) +{ + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(this->Script); + this->AddScriptInstallRule(os, indent, + cge->Evaluate(this->LocalGenerator, config)); } diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index fe0f7c6..534bc1d 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -6,10 +6,13 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmInstallGenerator.h" +#include "cmScriptGenerator.h" #include <iosfwd> #include <string> +class cmLocalGenerator; + /** \class cmInstallScriptGenerator * \brief Generate target installation rules. */ @@ -20,10 +23,18 @@ public: const char* component, bool exclude_from_all); ~cmInstallScriptGenerator() override; + void Compute(cmLocalGenerator* lg) override; + protected: - void GenerateScript(std::ostream& os) override; + void GenerateScriptActions(std::ostream& os, Indent indent) override; + void GenerateScriptForConfig(std::ostream& os, const std::string& config, + Indent indent) override; + void AddScriptInstallRule(std::ostream& os, Indent indent, + std::string const& script); + std::string Script; bool Code; + cmLocalGenerator* LocalGenerator; }; #endif diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index e0afa2d..8b8f79b 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -440,7 +440,13 @@ std::string cmInstallTargetGenerator::GetInstallFilename( void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg) { + // Lookup this target in the current directory. this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName); + if (!this->Target) { + // If no local target has been found, find it in the global scope. + this->Target = + lg->GetGlobalGenerator()->FindGeneratorTarget(this->TargetName); + } } void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent indent, diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index 557fa41..c9bbde1 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -3,7 +3,9 @@ #include "cmLinkLineDeviceComputer.h" +#include <set> #include <sstream> +#include <utility> #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" @@ -28,6 +30,12 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries( { // Write the library flags to the build rule. std::ostringstream fout; + + // Generate the unique set of link items when device linking. + // The nvcc device linker is designed so that each static library + // with device symbols only needs to be listed once as it doesn't + // care about link order. + std::set<std::string> emitted; typedef cmComputeLinkInformation::ItemVector ItemVector; ItemVector const& items = cli.GetItems(); std::string config = cli.GetConfig(); @@ -50,20 +58,24 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries( } } + std::string out; if (item.IsPath) { // nvcc understands absolute paths to libraries ending in '.a' should // be passed to nvlink. Other extensions like '.so' or '.dylib' are // rejected by the nvcc front-end even though nvlink knows to ignore // them. Bypass the front-end via '-Xnvlink'. if (!cmHasLiteralSuffix(item.Value, ".a")) { - fout << "-Xnvlink "; + out += "-Xnvlink "; } - fout << this->ConvertToOutputFormat( - this->ConvertToLinkReference(item.Value)); + out += + this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value)); } else { - fout << item.Value; + out += item.Value; + } + + if (emitted.insert(out).second) { + fout << out << " "; } - fout << " "; } if (!stdLibString.empty()) { diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 1ac2cc2..d7de2fa 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -289,12 +289,10 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args) if (item < 0) { item = static_cast<int>(nitem) + item; } - if (item < 0 || nitem <= static_cast<size_t>(item)) { + if (item < 0 || nitem < static_cast<size_t>(item)) { std::ostringstream str; str << "index: " << item << " out of range (-" << varArgsExpanded.size() - << ", " - << (varArgsExpanded.empty() ? 0 : (varArgsExpanded.size() - 1)) - << ")"; + << ", " << varArgsExpanded.size() << ")"; this->SetError(str.str()); return false; } @@ -963,14 +961,193 @@ bool cmListCommand::HandleTransformCommand( return true; } +class cmStringSorter +{ +public: + enum class Order + { + UNINITIALIZED, + ASCENDING, + DESCENDING, + }; + + enum class Compare + { + UNINITIALIZED, + STRING, + FILE_BASENAME, + }; + enum class CaseSensitivity + { + UNINITIALIZED, + SENSITIVE, + INSENSITIVE, + }; + +protected: + typedef std::string (*StringFilter)(const std::string& in); + StringFilter GetCompareFilter(Compare compare) + { + return (compare == Compare::FILE_BASENAME) ? cmSystemTools::GetFilenameName + : nullptr; + } + + StringFilter GetCaseFilter(CaseSensitivity sensitivity) + { + return (sensitivity == CaseSensitivity::INSENSITIVE) + ? cmSystemTools::LowerCase + : nullptr; + } + +public: + cmStringSorter(Compare compare, CaseSensitivity caseSensitivity, + Order desc = Order::ASCENDING) + : filters{ GetCompareFilter(compare), GetCaseFilter(caseSensitivity) } + , descending(desc == Order::DESCENDING) + { + } + + std::string ApplyFilter(const std::string& argument) + { + std::string result = argument; + for (auto filter : filters) { + if (filter != nullptr) { + result = filter(result); + } + } + return result; + } + + bool operator()(const std::string& a, const std::string& b) + { + std::string af = ApplyFilter(a); + std::string bf = ApplyFilter(b); + bool result; + if (descending) { + result = bf < af; + } else { + result = af < bf; + } + return result; + } + +protected: + StringFilter filters[2] = { nullptr, nullptr }; + bool descending; +}; + bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args) { assert(args.size() >= 2); - if (args.size() > 2) { - this->SetError("sub-command SORT only takes one argument."); + if (args.size() > 8) { + this->SetError("sub-command SORT only takes up to six arguments."); return false; } + auto sortCompare = cmStringSorter::Compare::UNINITIALIZED; + auto sortCaseSensitivity = cmStringSorter::CaseSensitivity::UNINITIALIZED; + auto sortOrder = cmStringSorter::Order::UNINITIALIZED; + + size_t argumentIndex = 2; + const std::string messageHint = "sub-command SORT "; + + while (argumentIndex < args.size()) { + const std::string option = args[argumentIndex++]; + if (option == "COMPARE") { + if (sortCompare != cmStringSorter::Compare::UNINITIALIZED) { + std::string error = messageHint + "option \"" + option + + "\" has been specified multiple times."; + this->SetError(error); + return false; + } + if (argumentIndex < args.size()) { + const std::string argument = args[argumentIndex++]; + if (argument == "STRING") { + sortCompare = cmStringSorter::Compare::STRING; + } else if (argument == "FILE_BASENAME") { + sortCompare = cmStringSorter::Compare::FILE_BASENAME; + } else { + std::string error = messageHint + "value \"" + argument + + "\" for option \"" + option + "\" is invalid."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "missing argument for option \"" + option + "\"."; + this->SetError(error); + return false; + } + } else if (option == "CASE") { + if (sortCaseSensitivity != + cmStringSorter::CaseSensitivity::UNINITIALIZED) { + std::string error = messageHint + "option \"" + option + + "\" has been specified multiple times."; + this->SetError(error); + return false; + } + if (argumentIndex < args.size()) { + const std::string argument = args[argumentIndex++]; + if (argument == "SENSITIVE") { + sortCaseSensitivity = cmStringSorter::CaseSensitivity::SENSITIVE; + } else if (argument == "INSENSITIVE") { + sortCaseSensitivity = cmStringSorter::CaseSensitivity::INSENSITIVE; + } else { + std::string error = messageHint + "value \"" + argument + + "\" for option \"" + option + "\" is invalid."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "missing argument for option \"" + option + "\"."; + this->SetError(error); + return false; + } + } else if (option == "ORDER") { + + if (sortOrder != cmStringSorter::Order::UNINITIALIZED) { + std::string error = messageHint + "option \"" + option + + "\" has been specified multiple times."; + this->SetError(error); + return false; + } + if (argumentIndex < args.size()) { + const std::string argument = args[argumentIndex++]; + if (argument == "ASCENDING") { + sortOrder = cmStringSorter::Order::ASCENDING; + } else if (argument == "DESCENDING") { + sortOrder = cmStringSorter::Order::DESCENDING; + } else { + std::string error = messageHint + "value \"" + argument + + "\" for option \"" + option + "\" is invalid."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "missing argument for option \"" + option + "\"."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "option \"" + option + "\" is unknown."; + this->SetError(error); + return false; + } + } + // set Default Values if Option is not given + if (sortCompare == cmStringSorter::Compare::UNINITIALIZED) { + sortCompare = cmStringSorter::Compare::STRING; + } + if (sortCaseSensitivity == cmStringSorter::CaseSensitivity::UNINITIALIZED) { + sortCaseSensitivity = cmStringSorter::CaseSensitivity::SENSITIVE; + } + if (sortOrder == cmStringSorter::Order::UNINITIALIZED) { + sortOrder = cmStringSorter::Order::ASCENDING; + } + const std::string& listName = args[1]; // expand the variable std::vector<std::string> varArgsExpanded; @@ -979,7 +1156,14 @@ bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args) return false; } - std::sort(varArgsExpanded.begin(), varArgsExpanded.end()); + if ((sortCompare == cmStringSorter::Compare::STRING) && + (sortCaseSensitivity == cmStringSorter::CaseSensitivity::SENSITIVE) && + (sortOrder == cmStringSorter::Order::ASCENDING)) { + std::sort(varArgsExpanded.begin(), varArgsExpanded.end()); + } else { + cmStringSorter sorter(sortCompare, sortCaseSensitivity, sortOrder); + std::sort(varArgsExpanded.begin(), varArgsExpanded.end(), sorter); + } std::string value = cmJoin(varArgsExpanded, ";"); this->Makefile->AddDefinition(listName, value.c_str()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a3f4a8f..072b958 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1042,6 +1042,10 @@ void cmLocalGenerator::GetTargetFlags( linkFlags += " "; } } + std::vector<std::string> opts; + target->GetLinkOptions(opts, config, linkLanguage); + // LINK_OPTIONS are escaped. + this->AppendCompileOptions(linkFlags, opts); if (pcli) { this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs, frameworkPath, linkPath); @@ -1113,6 +1117,10 @@ void cmLocalGenerator::GetTargetFlags( linkFlags += " "; } } + std::vector<std::string> opts; + target->GetLinkOptions(opts, config, linkLanguage); + // LINK_OPTIONS are escaped. + this->AppendCompileOptions(linkFlags, opts); } break; default: break; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 3460289..c90c5b8 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -977,6 +977,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( extraLinkOptions += " "; extraLinkOptions += targetLinkFlags; } + + std::vector<std::string> opts; + target->GetLinkOptions(opts, configName, + target->GetLinkerLanguage(configName)); + // LINK_OPTIONS are escaped. + this->AppendCompileOptions(extraLinkOptions, opts); + Options linkOptions(this, Options::Linker); if (this->FortranProject) { linkOptions.AddTable(cmLocalVisualStudio7GeneratorFortranLinkFlagTable); @@ -1226,30 +1233,56 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( } } +static std::string cmLocalVisualStudio7GeneratorEscapeForXML( + const std::string& s) +{ + std::string ret = s; + cmSystemTools::ReplaceString(ret, "&", "&"); + cmSystemTools::ReplaceString(ret, "\"", """); + cmSystemTools::ReplaceString(ret, "<", "<"); + cmSystemTools::ReplaceString(ret, ">", ">"); + cmSystemTools::ReplaceString(ret, "\n", "
"); + return ret; +} + +static std::string GetEscapedPropertyIfValueNotNULL(const char* propertyValue) +{ + return propertyValue == nullptr + ? std::string() + : cmLocalVisualStudio7GeneratorEscapeForXML(propertyValue); +} + void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool( std::ostream& fout, std::string const& config, cmGeneratorTarget* target) { if (this->WindowsCEProject) { - if (const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY")) { - /* clang-format off */ - fout << - "\t\t\t<DeploymentTool\n" - "\t\t\t\tForceDirty=\"-1\"\n" - "\t\t\t\tRemoteDirectory=\"" << this->EscapeForXML(dir) << "\"\n" - "\t\t\t\tRegisterOutput=\"0\"\n" - "\t\t\t\tAdditionalFiles=\"\"/>\n" - ; - /* clang-format on */ + const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY"); + const char* additionalFiles = + target->GetProperty("DEPLOYMENT_ADDITIONAL_FILES"); + + if (dir == nullptr && additionalFiles == nullptr) { + return; + } + + fout << "\t\t\t<DeploymentTool\n" + "\t\t\t\tForceDirty=\"-1\"\n" + "\t\t\t\tRemoteDirectory=\"" + << GetEscapedPropertyIfValueNotNULL(dir) + << "\"\n" + "\t\t\t\tRegisterOutput=\"0\"\n" + "\t\t\t\tAdditionalFiles=\"" + << GetEscapedPropertyIfValueNotNULL(additionalFiles) << "\"/>\n"; + + if (dir != nullptr) { std::string const exe = dir + std::string("\\") + target->GetFullName(config); - /* clang-format off */ - fout << - "\t\t\t<DebuggerTool\n" - "\t\t\t\tRemoteExecutable=\"" << this->EscapeForXML(exe) << "\"\n" - "\t\t\t\tArguments=\"\"\n" - "\t\t\t/>\n" - ; - /* clang-format on */ + + fout << "\t\t\t<DebuggerTool\n" + "\t\t\t\tRemoteExecutable=\"" + << this->EscapeForXML(exe) + << "\"\n" + "\t\t\t\tArguments=\"\"\n" + "\t\t\t/>\n"; } } } @@ -2049,17 +2082,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter( << "</VisualStudioProject>\n"; } -std::string cmLocalVisualStudio7GeneratorEscapeForXML(const std::string& s) -{ - std::string ret = s; - cmSystemTools::ReplaceString(ret, "&", "&"); - cmSystemTools::ReplaceString(ret, "\"", """); - cmSystemTools::ReplaceString(ret, "<", "<"); - cmSystemTools::ReplaceString(ret, ">", ">"); - cmSystemTools::ReplaceString(ret, "\n", "
"); - return ret; -} - std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s) { return cmLocalVisualStudio7GeneratorEscapeForXML(s); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3c7a4cf..a9b0b78 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -216,6 +216,16 @@ cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const .GetCompileDefinitionsEntryBacktraces(); } +cmStringRange cmMakefile::GetLinkOptionsEntries() const +{ + return this->StateSnapshot.GetDirectory().GetLinkOptionsEntries(); +} + +cmBacktraceRange cmMakefile::GetLinkOptionsBacktraces() const +{ + return this->StateSnapshot.GetDirectory().GetLinkOptionsEntryBacktraces(); +} + cmListFileBacktrace cmMakefile::GetBacktrace() const { return this->Backtrace; @@ -1205,6 +1215,11 @@ void cmMakefile::AddCompileOption(std::string const& option) this->AppendProperty("COMPILE_OPTIONS", option.c_str()); } +void cmMakefile::AddLinkOption(std::string const& option) +{ + this->AppendProperty("LINK_OPTIONS", option.c_str()); +} + bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) { // Create a regular expression to match valid definitions. diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index a7c8df5..616a37f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -171,6 +171,7 @@ public: void RemoveDefineFlag(std::string const& definition); void AddCompileDefinition(std::string const& definition); void AddCompileOption(std::string const& option); + void AddLinkOption(std::string const& option); /** Create a new imported target with the name and type given. */ cmTarget* AddImportedTarget(const std::string& name, @@ -788,6 +789,8 @@ public: cmBacktraceRange GetCompileOptionsBacktraces() const; cmStringRange GetCompileDefinitionsEntries() const; cmBacktraceRange GetCompileDefinitionsBacktraces() const; + cmStringRange GetLinkOptionsEntries() const; + cmBacktraceRange GetLinkOptionsBacktraces() const; std::set<std::string> const& GetSystemIncludeDirectories() const { diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 1e59f44..b9845ba 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -97,15 +97,15 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( std::vector<std::string> commands; - // Build list of dependencies. - std::vector<std::string> depends; - this->AppendLinkDepends(depends); - // Get the language to use for linking this library. std::string linkLanguage = "CUDA"; std::string const objExt = this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION"); + // Build list of dependencies. + std::vector<std::string> depends; + this->AppendLinkDepends(depends, linkLanguage); + // Get the name of the device object to generate. std::string const targetOutputReal = this->GeneratorTarget->ObjectDirectory + "cmake_device_link" + objExt; @@ -154,12 +154,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( linkLanguage, this->ConfigName); // Add target-specific linker flags. - this->LocalGenerator->AppendFlags( - linkFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + this->GetTargetLinkFlags(linkFlags, linkLanguage); // Construct a list of files associated with this executable that // may need to be cleaned. @@ -299,13 +294,6 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) { std::vector<std::string> commands; - // Build list of dependencies. - std::vector<std::string> depends; - this->AppendLinkDepends(depends); - if (!this->DeviceLinkObject.empty()) { - depends.push_back(this->DeviceLinkObject); - } - // Get the name of the executable to generate. std::string targetName; std::string targetNameReal; @@ -383,6 +371,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) return; } + // Build list of dependencies. + std::vector<std::string> depends; + this->AppendLinkDepends(depends, linkLanguage); + if (!this->DeviceLinkObject.empty()) { + depends.push_back(this->DeviceLinkObject); + } + this->NumberOfProgressActions++; if (!this->NoRuleMessages) { cmLocalUnixMakefileGenerator3::EchoProgress progress; @@ -437,12 +432,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) linkLanguage, this->ConfigName); // Add target-specific linker flags. - this->LocalGenerator->AppendFlags( - linkFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + this->GetTargetLinkFlags(linkFlags, linkLanguage); { std::unique_ptr<cmLinkLineComputer> linkLineComputer( diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index c538992..571e74b 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -137,10 +137,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() this->GeneratorTarget->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS"); if (hasCUDA && resolveDeviceSymbols) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; - std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, false); + this->WriteDeviceLibraryRules(linkRuleVar, false); } std::string linkLanguage = @@ -173,10 +170,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) cuda_lang) != closure->Languages.end()); if (hasCUDA) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; - std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, relink); + this->WriteDeviceLibraryRules(linkRuleVar, relink); } } @@ -187,13 +181,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) linkRuleVar += "_CREATE_SHARED_LIBRARY"; std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); - + this->GetTargetLinkFlags(extraFlags, linkLanguage); this->LocalGenerator->AddConfigVariableFlags( extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName); @@ -223,10 +211,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) cuda_lang) != closure->Languages.end()); if (hasCUDA) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; - std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, relink); + this->WriteDeviceLibraryRules(linkRuleVar, relink); } } @@ -237,12 +222,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) linkRuleVar += "_CREATE_SHARED_MODULE"; std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + this->GetTargetLinkFlags(extraFlags, linkLanguage); this->LocalGenerator->AddConfigVariableFlags( extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName); @@ -265,12 +245,7 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) linkRuleVar += "_CREATE_MACOSX_FRAMEWORK"; std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + this->GetTargetLinkFlags(extraFlags, linkLanguage); this->LocalGenerator->AddConfigVariableFlags( extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->ConfigName); @@ -278,25 +253,25 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) } void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( - const std::string& linkRuleVar, const std::string& extraFlags, bool relink) + const std::string& linkRuleVar, bool relink) { #ifdef CMAKE_BUILD_WITH_CMAKE // TODO: Merge the methods that call this method to avoid // code duplication. std::vector<std::string> commands; - // Build list of dependencies. - std::vector<std::string> depends; - this->AppendLinkDepends(depends); - // Get the language to use for linking this library. std::string linkLanguage = "CUDA"; std::string const objExt = this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION"); + // Build list of dependencies. + std::vector<std::string> depends; + this->AppendLinkDepends(depends, linkLanguage); + // Create set of linking flags. std::string linkFlags; - this->LocalGenerator->AppendFlags(linkFlags, extraFlags); + this->GetTargetLinkFlags(linkFlags, linkLanguage); // Get the name of the device object to generate. std::string const targetOutputReal = @@ -458,7 +433,6 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( this->WriteTargetDriverRule(targetOutputReal, relink); #else static_cast<void>(linkRuleVar); - static_cast<void>(extraFlags); static_cast<void>(relink); #endif } @@ -470,13 +444,6 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // code duplication. std::vector<std::string> commands; - // Build list of dependencies. - std::vector<std::string> depends; - this->AppendLinkDepends(depends); - if (!this->DeviceLinkObject.empty()) { - depends.push_back(this->DeviceLinkObject); - } - // Get the language to use for linking this library. std::string linkLanguage = this->GeneratorTarget->GetLinkerLanguage(this->ConfigName); @@ -488,6 +455,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( return; } + // Build list of dependencies. + std::vector<std::string> depends; + this->AppendLinkDepends(depends, linkLanguage); + if (!this->DeviceLinkObject.empty()) { + depends.push_back(this->DeviceLinkObject); + } + // Create set of linking flags. std::string linkFlags; this->LocalGenerator->AppendFlags(linkFlags, extraFlags); diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h index 02fa029..35e4327 100644 --- a/Source/cmMakefileLibraryTargetGenerator.h +++ b/Source/cmMakefileLibraryTargetGenerator.h @@ -27,8 +27,7 @@ protected: void WriteSharedLibraryRules(bool relink); void WriteModuleLibraryRules(bool relink); - void WriteDeviceLibraryRules(const std::string& linkRule, - const std::string& extraFlags, bool relink); + void WriteDeviceLibraryRules(const std::string& linkRule, bool relink); void WriteLibraryRules(const std::string& linkRule, const std::string& extraFlags, bool relink); // MacOSX Framework support methods diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 1f65f08..7cae305 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -82,6 +82,23 @@ cmMakefileTargetGenerator* cmMakefileTargetGenerator::New( return result; } +void cmMakefileTargetGenerator::GetTargetLinkFlags( + std::string& flags, const std::string& linkLanguage) +{ + this->LocalGenerator->AppendFlags( + flags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); + + std::string linkFlagsConfig = "LINK_FLAGS_"; + linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); + this->LocalGenerator->AppendFlags( + flags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + + std::vector<std::string> opts; + this->GeneratorTarget->GetLinkOptions(opts, this->ConfigName, linkLanguage); + // LINK_OPTIONS are escaped. + this->LocalGenerator->AppendCompileOptions(flags, opts); +} + void cmMakefileTargetGenerator::CreateRuleFile() { // Create a directory for this target. @@ -1370,7 +1387,7 @@ void cmMakefileTargetGenerator::AppendObjectDepends( } void cmMakefileTargetGenerator::AppendLinkDepends( - std::vector<std::string>& depends) + std::vector<std::string>& depends, const std::string& linkLanguage) { this->AppendObjectDepends(depends); @@ -1394,10 +1411,8 @@ void cmMakefileTargetGenerator::AppendLinkDepends( } // Add user-specified dependencies. - if (const char* linkDepends = - this->GeneratorTarget->GetProperty("LINK_DEPENDS")) { - cmSystemTools::ExpandListArgument(linkDepends, depends); - } + this->GeneratorTarget->GetLinkDepends(depends, this->ConfigName, + linkLanguage); } std::string cmMakefileTargetGenerator::GetLinkRule( diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 7af3cf3..f21362a 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -52,6 +52,8 @@ public: cmGeneratorTarget* GetGeneratorTarget() { return this->GeneratorTarget; } protected: + void GetTargetLinkFlags(std::string& flags, const std::string& linkLanguage); + // create the file and directory etc void CreateRuleFile(); @@ -126,7 +128,8 @@ protected: void AppendObjectDepends(std::vector<std::string>& depends); // Append link rule dependencies (objects, etc.). - void AppendLinkDepends(std::vector<std::string>& depends); + void AppendLinkDepends(std::vector<std::string>& depends, + const std::string& linkLanguage); // Lookup the link rule for this target. std::string GetLinkRule(const std::string& linkRuleVar); diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index c1cd1b6..a50e5fc 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -2,10 +2,12 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmMathCommand.h" -#include <stdio.h> - #include "cmExprParserHelper.h" #include "cmMakefile.h" +#include "cm_kwiml.h" +#include "cmake.h" + +#include <stdio.h> class cmExecutionStatus; @@ -27,24 +29,83 @@ bool cmMathCommand::InitialPass(std::vector<std::string> const& args, bool cmMathCommand::HandleExprCommand(std::vector<std::string> const& args) { - if (args.size() != 3) { + if ((args.size() != 3) && (args.size() != 5)) { this->SetError("EXPR called with incorrect arguments."); return false; } + enum class NumericFormat + { + UNINITIALIZED, + DECIMAL, + HEXADECIMAL, + }; + const std::string& outputVariable = args[1]; const std::string& expression = args[2]; + size_t argumentIndex = 3; + NumericFormat outputFormat = NumericFormat::UNINITIALIZED; + + this->Makefile->AddDefinition(outputVariable, "ERROR"); + + if (argumentIndex < args.size()) { + const std::string messageHint = "sub-command EXPR "; + const std::string option = args[argumentIndex++]; + if (option == "OUTPUT_FORMAT") { + if (argumentIndex < args.size()) { + const std::string argument = args[argumentIndex++]; + if (argument == "DECIMAL") { + outputFormat = NumericFormat::DECIMAL; + } else if (argument == "HEXADECIMAL") { + outputFormat = NumericFormat::HEXADECIMAL; + } else { + std::string error = messageHint + "value \"" + argument + + "\" for option \"" + option + "\" is invalid."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "missing argument for option \"" + option + "\"."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "option \"" + option + "\" is unknown."; + this->SetError(error); + return false; + } + } + + if (outputFormat == NumericFormat::UNINITIALIZED) { + outputFormat = NumericFormat::DECIMAL; + } cmExprParserHelper helper; if (!helper.ParseString(expression.c_str(), 0)) { - std::string e = "cannot parse the expression: \"" + expression + "\": "; - e += helper.GetError(); - this->SetError(e); + this->SetError(helper.GetError()); return false; } char buffer[1024]; - sprintf(buffer, "%d", helper.GetResult()); + const char* fmt; + switch (outputFormat) { + case NumericFormat::HEXADECIMAL: + fmt = "0x%" KWIML_INT_PRIx64; + break; + case NumericFormat::DECIMAL: + CM_FALLTHROUGH; + default: + fmt = "%" KWIML_INT_PRId64; + break; + } + sprintf(buffer, fmt, helper.GetResult()); + + std::string const& w = helper.GetWarning(); + if (!w.empty()) { + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w); + } this->Makefile->AddDefinition(outputVariable, buffer); return true; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 7394188..f94e5bc 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -625,7 +625,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement() outputs.push_back(targetOutputReal); // Compute specific libraries to link with. cmNinjaDeps explicitDeps = this->GetObjects(); - cmNinjaDeps implicitDeps = this->ComputeLinkDeps(); + cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage); std::string frameworkPath; std::string linkPath; @@ -794,7 +794,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // Compute specific libraries to link with. cmNinjaDeps explicitDeps = this->GetObjects(); - cmNinjaDeps implicitDeps = this->ComputeLinkDeps(); + cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage); if (!this->DeviceLinkObject.empty()) { explicitDeps.push_back(this->DeviceLinkObject); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 9d41948..df32f40 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -235,7 +235,8 @@ std::string cmNinjaTargetGenerator::ComputeIncludes( return includesString; } -cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const +cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps( + const std::string& linkLanguage) const { // Static libraries never depend on other targets for linking. if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY || @@ -270,13 +271,11 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const } // Add user-specified dependencies. - if (const char* linkDepends = - this->GeneratorTarget->GetProperty("LINK_DEPENDS")) { - std::vector<std::string> linkDeps; - cmSystemTools::ExpandListArgument(linkDepends, linkDeps); - std::transform(linkDeps.begin(), linkDeps.end(), - std::back_inserter(result), MapToNinjaPath()); - } + std::vector<std::string> linkDeps; + this->GeneratorTarget->GetLinkDepends(linkDeps, this->ConfigName, + linkLanguage); + std::transform(linkDeps.begin(), linkDeps.end(), std::back_inserter(result), + MapToNinjaPath()); return result; } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 4660a3a..e58a8a0 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -95,7 +95,7 @@ protected: } /// @return the list of link dependency for the given target @a target. - cmNinjaDeps ComputeLinkDeps() const; + cmNinjaDeps ComputeLinkDeps(const std::string& linkLanguage) const; /// @return the source file path for the given @a source. std::string GetSourceFilePath(cmSourceFile const* source) const; diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 00a2d2b..239cd00 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -2,11 +2,16 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmOptionCommand.h" +#include <sstream> + #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmPolicies.h" #include "cmState.h" +#include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" +#include "cmake.h" class cmExecutionStatus; @@ -14,19 +19,7 @@ class cmExecutionStatus; bool cmOptionCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { - bool argError = false; - if (args.size() < 2) { - argError = true; - } - // for VTK 4.0 we have to support the option command with more than 3 - // arguments if CMAKE_MINIMUM_REQUIRED_VERSION is not defined, if - // CMAKE_MINIMUM_REQUIRED_VERSION is defined, then we can have stricter - // checking. - if (this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION")) { - if (args.size() > 3) { - argError = true; - } - } + const bool argError = (args.size() < 2) || (args.size() > 3); if (argError) { std::string m = "called with incorrect number of arguments: "; m += cmJoin(args, " "); @@ -34,23 +27,62 @@ bool cmOptionCommand::InitialPass(std::vector<std::string> const& args, return false; } - std::string initialValue = "Off"; - // Now check and see if the value has been stored in the cache - // already, if so use that value and don't look for the program + // Determine the state of the option policy + bool checkAndWarn = false; + { + auto status = this->Makefile->GetPolicyStatus(cmPolicies::CMP0077); + const char* existsBeforeSet = + this->Makefile->GetStateSnapshot().GetDefinition(args[0]); + switch (status) { + case cmPolicies::WARN: + checkAndWarn = (existsBeforeSet != nullptr); + break; + case cmPolicies::OLD: + // OLD behavior does not warn. + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: { + // See if a local variable with this name already exists. + // If so we ignore the option command. + if (existsBeforeSet) { + return true; + } + } break; + } + } + + // See if a cache variable with this name already exists + // If so just make sure the doc state is correct cmState* state = this->Makefile->GetState(); const char* existingValue = state->GetCacheEntryValue(args[0]); - if (existingValue) { - if (state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED) { - state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); - return true; - } - initialValue = existingValue; + if (existingValue && + (state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED)) { + state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); + return true; } + + // Nothing in the cache so add it + std::string initialValue = existingValue ? existingValue : "Off"; if (args.size() == 3) { initialValue = args[2]; } bool init = cmSystemTools::IsOn(initialValue.c_str()); this->Makefile->AddCacheDefinition(args[0], init ? "ON" : "OFF", args[1].c_str(), cmStateEnums::BOOL); + + if (checkAndWarn) { + const char* existsAfterSet = + this->Makefile->GetStateSnapshot().GetDefinition(args[0]); + if (!existsAfterSet) { + std::ostringstream w; + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0077) + << "\n" + "For compatibility with older versions of CMake, option " + "is clearing the normal variable '" + << args[0] << "'."; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + } return true; } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 1ef1813..d6f7c54 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -223,7 +223,12 @@ class cmMakefile; 3, 12, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0075, \ "Include file check macros honor CMAKE_REQUIRED_LIBRARIES.", 3, 12, \ - 0, cmPolicies::WARN) + 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0076, \ + "target_sources() command converts relative paths to absolute.", 3, \ + 13, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0077, "option() honors normal variables.", 3, 13, 0, \ + cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ @@ -248,7 +253,8 @@ class cmMakefile; F(CMP0065) \ F(CMP0068) \ F(CMP0069) \ - F(CMP0073) + F(CMP0073) \ + F(CMP0076) /** \class cmPolicies * \brief Handles changes in CMake behavior and policies diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 34196d9..fd9829f 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -37,23 +37,6 @@ #include <utility> #include <vector> -inline static const char* SafeString(const char* value) -{ - return (value != nullptr) ? value : ""; -} - -inline static std::string GetSafeProperty(cmGeneratorTarget const* target, - const char* key) -{ - return std::string(SafeString(target->GetProperty(key))); -} - -inline static std::string GetSafeProperty(cmSourceFile const* sf, - const char* key) -{ - return std::string(SafeString(sf->GetProperty(key))); -} - static std::size_t GetParallelCPUCount() { static std::size_t count = 0; @@ -194,22 +177,36 @@ cmQtAutoGenInitializer::cmQtAutoGenInitializer( cmGeneratorTarget* target, bool mocEnabled, bool uicEnabled, bool rccEnabled, std::string const& qtVersionMajor) : Target(target) - , MocEnabled(mocEnabled) - , UicEnabled(uicEnabled) - , RccEnabled(rccEnabled) , MultiConfig(false) , QtVersionMajor(qtVersionMajor) { + Moc.Enabled = mocEnabled; + Uic.Enabled = uicEnabled; + Rcc.Enabled = rccEnabled; + this->QtVersionMinor = cmQtAutoGenInitializer::GetQtMinorVersion(target, this->QtVersionMajor); } -void cmQtAutoGenInitializer::InitCustomTargets() +bool cmQtAutoGenInitializer::InitCustomTargets() { cmMakefile* makefile = this->Target->Target->GetMakefile(); cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator(); + // Verbosity + { + this->Verbosity = makefile->GetSafeDefinition("CMAKE_AUTOGEN_VERBOSE"); + if (!this->Verbosity.empty()) { + unsigned long iVerb = 0; + if (!cmSystemTools::StringToULong(this->Verbosity.c_str(), &iVerb)) { + // Non numeric verbosity + this->Verbosity = + cmSystemTools::IsOn(this->Verbosity.c_str()) ? "1" : "0"; + } + } + } + // Configurations this->MultiConfig = globalGen->IsMultiConfig(); this->ConfigDefault = makefile->GetConfigurations(this->ConfigsList); @@ -236,7 +233,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() cmSystemTools::ConvertToUnixSlashes(this->DirInfo); // Autogen build dir - this->DirBuild = GetSafeProperty(this->Target, "AUTOGEN_BUILD_DIR"); + this->DirBuild = this->Target->GetSafeProperty("AUTOGEN_BUILD_DIR"); if (this->DirBuild.empty()) { this->DirBuild = cbd; this->DirBuild += '/'; @@ -268,7 +265,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() } // Inherit FOLDER property from target (#13688) if (folder == nullptr) { - folder = SafeString(this->Target->Target->GetProperty("FOLDER")); + folder = this->Target->GetProperty("FOLDER"); } if (folder != nullptr) { this->AutogenFolder = folder; @@ -299,15 +296,15 @@ void cmQtAutoGenInitializer::InitCustomTargets() } // Add moc compilation to generated files list - if (this->MocEnabled) { + if (this->Moc.Enabled) { std::string mocsComp = this->DirBuild + "/mocs_compilation.cpp"; this->AddGeneratedSource(mocsComp, GeneratorT::MOC); autogenProvides.push_back(std::move(mocsComp)); } // Add autogen includes directory to the origin target INCLUDE_DIRECTORIES - if (this->MocEnabled || this->UicEnabled || - (this->RccEnabled && this->MultiConfig)) { + if (this->Moc.Enabled || this->Uic.Enabled || + (this->Rcc.Enabled && this->MultiConfig)) { std::string includeDir = this->DirBuild; includeDir += "/include"; if (this->MultiConfig) { @@ -317,52 +314,9 @@ void cmQtAutoGenInitializer::InitCustomTargets() } // Acquire rcc executable and features - if (this->RccEnabled) { - { - std::string err; - if (this->QtVersionMajor == "5") { - cmGeneratorTarget* tgt = - localGen->FindGeneratorTargetToUse("Qt5::rcc"); - if (tgt != nullptr) { - this->RccExecutable = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTORCC: Qt5::rcc target not found"; - } - } else if (QtVersionMajor == "4") { - cmGeneratorTarget* tgt = - localGen->FindGeneratorTargetToUse("Qt4::rcc"); - if (tgt != nullptr) { - this->RccExecutable = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTORCC: Qt4::rcc target not found"; - } - } else { - err = "The AUTORCC feature supports only Qt 4 and Qt 5"; - } - if (!err.empty()) { - err += " ("; - err += this->Target->GetName(); - err += ")"; - cmSystemTools::Error(err.c_str()); - } - } - // Detect if rcc supports (-)-list - if (!this->RccExecutable.empty() && (this->QtVersionMajor == "5")) { - std::vector<std::string> command; - command.push_back(this->RccExecutable); - command.push_back("--help"); - std::string rccStdOut; - std::string rccStdErr; - int retVal = 0; - bool result = cmSystemTools::RunSingleCommand( - command, &rccStdOut, &rccStdErr, &retVal, nullptr, - cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); - if (result && retVal == 0 && - rccStdOut.find("--list") != std::string::npos) { - this->RccListOptions.push_back("--list"); - } else { - this->RccListOptions.push_back("-list"); - } + if (this->Rcc.Enabled) { + if (!GetRccExecutable()) { + return false; } } @@ -381,14 +335,14 @@ void cmQtAutoGenInitializer::InitCustomTargets() std::string const& fPath = sf->GetFullPath(); std::string const& ext = sf->GetExtension(); // Register generated files that will be scanned by moc or uic - if (this->MocEnabled || this->UicEnabled) { + if (this->Moc.Enabled || this->Uic.Enabled) { cmSystemTools::FileFormat const fileType = cmSystemTools::GetFileFormat(ext.c_str()); if ((fileType == cmSystemTools::CXX_FILE_FORMAT) || (fileType == cmSystemTools::HEADER_FILE_FORMAT)) { std::string const absPath = cmSystemTools::GetRealPath(fPath); - if ((this->MocEnabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) || - (this->UicEnabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) { + if ((this->Moc.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) || + (this->Uic.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) { // Register source const bool generated = sf->GetPropertyAsBool("GENERATED"); if (fileType == cmSystemTools::HEADER_FILE_FORMAT) { @@ -408,7 +362,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() } } // Register rcc enabled files - if (this->RccEnabled && (ext == qrcExt) && + if (this->Rcc.Enabled && (ext == qrcExt) && !sf->GetPropertyAsBool("SKIP_AUTORCC")) { // Register qrc file { @@ -419,12 +373,12 @@ void cmQtAutoGenInitializer::InitCustomTargets() qrc.Generated = sf->GetPropertyAsBool("GENERATED"); // RCC options { - std::string const opts = GetSafeProperty(sf, "AUTORCC_OPTIONS"); + std::string const opts = sf->GetSafeProperty("AUTORCC_OPTIONS"); if (!opts.empty()) { cmSystemTools::ExpandListArgument(opts, qrc.Options); } } - this->Qrcs.push_back(std::move(qrc)); + this->Rcc.Qrcs.push_back(std::move(qrc)); } } } @@ -435,7 +389,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() this->Target->ClearSourcesCache(); } // Read skip files from makefile sources - if (this->MocEnabled || this->UicEnabled) { + if (this->Moc.Enabled || this->Uic.Enabled) { std::string pathError; for (cmSourceFile* sf : makefile->GetSourceFiles()) { // sf->GetExtension() is only valid after sf->GetFullPath() ... @@ -453,17 +407,17 @@ void cmQtAutoGenInitializer::InitCustomTargets() continue; } const bool skipAll = sf->GetPropertyAsBool("SKIP_AUTOGEN"); - const bool mocSkip = - this->MocEnabled && (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC")); - const bool uicSkip = - this->UicEnabled && (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC")); + const bool mocSkip = this->Moc.Enabled && + (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC")); + const bool uicSkip = this->Uic.Enabled && + (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC")); if (mocSkip || uicSkip) { std::string const absFile = cmSystemTools::GetRealPath(fPath); if (mocSkip) { - this->MocSkip.insert(absFile); + this->Moc.Skip.insert(absFile); } if (uicSkip) { - this->UicSkip.insert(absFile); + this->Uic.Skip.insert(absFile); } } } @@ -508,13 +462,13 @@ void cmQtAutoGenInitializer::InitCustomTargets() msg += "\n"; std::string tools; std::string property; - if (this->MocEnabled && this->UicEnabled) { + if (this->Moc.Enabled && this->Uic.Enabled) { tools = "AUTOMOC and AUTOUIC"; property = "SKIP_AUTOGEN"; - } else if (this->MocEnabled) { + } else if (this->Moc.Enabled) { tools = "AUTOMOC"; property = "SKIP_AUTOMOC"; - } else if (this->UicEnabled) { + } else if (this->Uic.Enabled) { tools = "AUTOUIC"; property = "SKIP_AUTOUIC"; } @@ -544,23 +498,23 @@ void cmQtAutoGenInitializer::InitCustomTargets() generatedHeaders.clear(); } // Sort headers and sources - if (this->MocEnabled || this->UicEnabled) { + if (this->Moc.Enabled || this->Uic.Enabled) { std::sort(this->Headers.begin(), this->Headers.end()); std::sort(this->Sources.begin(), this->Sources.end()); } // Process qrc files - if (!this->Qrcs.empty()) { + if (!this->Rcc.Qrcs.empty()) { const bool QtV5 = (this->QtVersionMajor == "5"); // Target rcc options std::vector<std::string> optionsTarget; cmSystemTools::ExpandListArgument( - GetSafeProperty(this->Target, "AUTORCC_OPTIONS"), optionsTarget); + this->Target->GetSafeProperty("AUTORCC_OPTIONS"), optionsTarget); // Check if file name is unique - for (Qrc& qrc : this->Qrcs) { + for (Qrc& qrc : this->Rcc.Qrcs) { qrc.Unique = true; - for (Qrc const& qrc2 : this->Qrcs) { + for (Qrc const& qrc2 : this->Rcc.Qrcs) { if ((&qrc != &qrc2) && (qrc.QrcName == qrc2.QrcName)) { qrc.Unique = false; break; @@ -570,7 +524,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() // Path checksum and file names { cmFilePathChecksum const fpathCheckSum(makefile); - for (Qrc& qrc : this->Qrcs) { + for (Qrc& qrc : this->Rcc.Qrcs) { qrc.PathChecksum = fpathCheckSum.getPart(qrc.QrcFile); // RCC output file name { @@ -601,7 +555,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() } } // RCC options - for (Qrc& qrc : this->Qrcs) { + for (Qrc& qrc : this->Rcc.Qrcs) { // Target options std::vector<std::string> opts = optionsTarget; // Merge computed "-name XYZ" option @@ -622,7 +576,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() RccMergeOptions(opts, qrc.Options, QtV5); qrc.Options = std::move(opts); } - for (Qrc& qrc : this->Qrcs) { + for (Qrc& qrc : this->Rcc.Qrcs) { // Register file at target this->AddGeneratedSource(qrc.RccFile, GeneratorT::RCC); @@ -703,6 +657,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() } } else { cmSystemTools::Error(error.c_str()); + return false; } } makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends, @@ -717,11 +672,11 @@ void cmQtAutoGenInitializer::InitCustomTargets() } // Create _autogen target - if (this->MocEnabled || this->UicEnabled) { + if (this->Moc.Enabled || this->Uic.Enabled) { // Add user defined autogen target dependencies { std::string const deps = - GetSafeProperty(this->Target, "AUTOGEN_TARGET_DEPENDS"); + this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS"); if (!deps.empty()) { std::vector<std::string> extraDeps; cmSystemTools::ExpandListArgument(deps, extraDeps); @@ -741,10 +696,10 @@ void cmQtAutoGenInitializer::InitCustomTargets() std::string autogenComment; { std::string tools; - if (this->MocEnabled) { + if (this->Moc.Enabled) { tools += "MOC"; } - if (this->UicEnabled) { + if (this->Uic.Enabled) { if (!tools.empty()) { tools += " and "; } @@ -862,17 +817,20 @@ void cmQtAutoGenInitializer::InitCustomTargets() this->Target->Target->AddUtility(this->AutogenTargetName, makefile); } } + + return true; } -void cmQtAutoGenInitializer::SetupCustomTargets() +bool cmQtAutoGenInitializer::SetupCustomTargets() { cmMakefile* makefile = this->Target->Target->GetMakefile(); // Create info directory on demand if (!cmSystemTools::MakeDirectory(this->DirInfo)) { - std::string emsg = ("Could not create directory: "); + std::string emsg = ("AutoGen: Could not create directory: "); emsg += Quoted(this->DirInfo); cmSystemTools::Error(emsg.c_str()); + return false; } // Configuration include directories @@ -885,16 +843,16 @@ void cmQtAutoGenInitializer::SetupCustomTargets() } // Generate autogen target info file - if (this->MocEnabled || this->UicEnabled) { - if (this->MocEnabled) { + if (this->Moc.Enabled || this->Uic.Enabled) { + if (this->Moc.Enabled) { this->SetupCustomTargetsMoc(); } - if (this->UicEnabled) { + if (this->Uic.Enabled) { this->SetupCustomTargetsUic(); } // Parallel processing - this->Parallel = GetSafeProperty(this->Target, "AUTOGEN_PARALLEL"); + this->Parallel = this->Target->GetSafeProperty("AUTOGEN_PARALLEL"); if (this->Parallel.empty() || (this->Parallel == "AUTO")) { // Autodetect number of CPUs this->Parallel = std::to_string(GetParallelCPUCount()); @@ -944,6 +902,7 @@ void cmQtAutoGenInitializer::SetupCustomTargets() ofs << "# Meta\n"; CWrite("AM_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); CWrite("AM_PARALLEL", this->Parallel); + CWrite("AM_VERBOSITY", this->Verbosity); ofs << "# Directories\n"; CWrite("AM_CMAKE_SOURCE_DIR", MfDef("CMAKE_SOURCE_DIR")); @@ -975,43 +934,46 @@ void cmQtAutoGenInitializer::SetupCustomTargets() ofs << "# Qt\n"; CWrite("AM_QT_VERSION_MAJOR", this->QtVersionMajor); - CWrite("AM_QT_MOC_EXECUTABLE", this->MocExecutable); - CWrite("AM_QT_UIC_EXECUTABLE", this->UicExecutable); + CWrite("AM_QT_MOC_EXECUTABLE", this->Moc.Executable); + CWrite("AM_QT_UIC_EXECUTABLE", this->Uic.Executable); - if (this->MocEnabled) { + if (this->Moc.Enabled) { ofs << "# MOC settings\n"; - CWriteSet("AM_MOC_SKIP", this->MocSkip); - CWrite("AM_MOC_DEFINITIONS", this->MocDefines); - CWriteMap("AM_MOC_DEFINITIONS", this->MocDefinesConfig); - CWrite("AM_MOC_INCLUDES", this->MocIncludes); - CWriteMap("AM_MOC_INCLUDES", this->MocIncludesConfig); + CWriteSet("AM_MOC_SKIP", this->Moc.Skip); + CWrite("AM_MOC_DEFINITIONS", this->Moc.Defines); + CWriteMap("AM_MOC_DEFINITIONS", this->Moc.ConfigDefines); + CWrite("AM_MOC_INCLUDES", this->Moc.Includes); + CWriteMap("AM_MOC_INCLUDES", this->Moc.ConfigIncludes); CWrite("AM_MOC_OPTIONS", - GetSafeProperty(this->Target, "AUTOMOC_MOC_OPTIONS")); + this->Target->GetSafeProperty("AUTOMOC_MOC_OPTIONS")); CWrite("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE")); CWrite("AM_MOC_MACRO_NAMES", - GetSafeProperty(this->Target, "AUTOMOC_MACRO_NAMES")); + this->Target->GetSafeProperty("AUTOMOC_MACRO_NAMES")); CWrite("AM_MOC_DEPEND_FILTERS", - GetSafeProperty(this->Target, "AUTOMOC_DEPEND_FILTERS")); - CWrite("AM_MOC_PREDEFS_CMD", this->MocPredefsCmd); + this->Target->GetSafeProperty("AUTOMOC_DEPEND_FILTERS")); + CWrite("AM_MOC_PREDEFS_CMD", this->Moc.PredefsCmd); } - if (this->UicEnabled) { + if (this->Uic.Enabled) { ofs << "# UIC settings\n"; - CWriteSet("AM_UIC_SKIP", this->UicSkip); - CWrite("AM_UIC_TARGET_OPTIONS", this->UicOptions); - CWriteMap("AM_UIC_TARGET_OPTIONS", this->UicOptionsConfig); - CWriteList("AM_UIC_OPTIONS_FILES", this->UicFileFiles); - CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->UicFileOptions); - CWriteList("AM_UIC_SEARCH_PATHS", this->UicSearchPaths); + CWriteSet("AM_UIC_SKIP", this->Uic.Skip); + CWrite("AM_UIC_TARGET_OPTIONS", this->Uic.Options); + CWriteMap("AM_UIC_TARGET_OPTIONS", this->Uic.ConfigOptions); + CWriteList("AM_UIC_OPTIONS_FILES", this->Uic.FileFiles); + CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->Uic.FileOptions); + CWriteList("AM_UIC_SEARCH_PATHS", this->Uic.SearchPaths); } } else { - return; + std::string err = "AutoGen: Could not write file "; + err += this->AutogenInfoFile; + cmSystemTools::Error(err.c_str()); + return false; } } // Generate auto RCC info files - if (this->RccEnabled) { - for (Qrc const& qrc : this->Qrcs) { + if (this->Rcc.Enabled) { + for (Qrc const& qrc : this->Rcc.Qrcs) { // Register rcc info file as generated makefile->AddCMakeOutputFile(qrc.InfoFile); @@ -1036,7 +998,7 @@ void cmQtAutoGenInitializer::SetupCustomTargets() // Write ofs << "# Configurations\n"; CWrite("ARCC_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); - + CWrite("ARCC_VERBOSITY", this->Verbosity); ofs << "# Settings file\n"; if (this->MultiConfig) { std::map<std::string, std::string> settingsFiles; @@ -1058,8 +1020,8 @@ void cmQtAutoGenInitializer::SetupCustomTargets() } ofs << "# Rcc executable\n"; - CWrite("ARCC_RCC_EXECUTABLE", this->RccExecutable); - CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->RccListOptions, ";")); + CWrite("ARCC_RCC_EXECUTABLE", this->Rcc.Executable); + CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->Rcc.ListOptions, ";")); ofs << "# Rcc job\n"; CWrite("ARCC_LOCK_FILE", qrc.LockFile); @@ -1070,13 +1032,18 @@ void cmQtAutoGenInitializer::SetupCustomTargets() CWrite("ARCC_OPTIONS", cmJoin(qrc.Options, ";")); CWrite("ARCC_INPUTS", cmJoin(qrc.Resources, ";")); } else { - return; + std::string err = "AutoRcc: Could not write file "; + err += qrc.InfoFile; + cmSystemTools::Error(err.c_str()); + return false; } } } + + return true; } -void cmQtAutoGenInitializer::SetupCustomTargetsMoc() +bool cmQtAutoGenInitializer::SetupCustomTargetsMoc() { cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); cmMakefile* makefile = this->Target->Target->GetMakefile(); @@ -1084,7 +1051,7 @@ void cmQtAutoGenInitializer::SetupCustomTargetsMoc() // Moc predefs command if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") && this->QtVersionGreaterOrEqual(5, 8)) { - this->MocPredefsCmd = + this->Moc.PredefsCmd = makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"); } @@ -1108,71 +1075,44 @@ void cmQtAutoGenInitializer::SetupCustomTargetsMoc() }; // Default configuration settings - this->MocIncludes = GetIncludeDirs(this->ConfigDefault); - this->MocDefines = GetCompileDefinitions(this->ConfigDefault); + this->Moc.Includes = GetIncludeDirs(this->ConfigDefault); + this->Moc.Defines = GetCompileDefinitions(this->ConfigDefault); // Other configuration settings for (std::string const& cfg : this->ConfigsList) { { std::string const configIncludeDirs = GetIncludeDirs(cfg); - if (configIncludeDirs != this->MocIncludes) { - this->MocIncludesConfig[cfg] = configIncludeDirs; + if (configIncludeDirs != this->Moc.Includes) { + this->Moc.ConfigIncludes[cfg] = configIncludeDirs; } } { std::string const configCompileDefs = GetCompileDefinitions(cfg); - if (configCompileDefs != this->MocDefines) { - this->MocDefinesConfig[cfg] = configCompileDefs; + if (configCompileDefs != this->Moc.Defines) { + this->Moc.ConfigDefines[cfg] = configCompileDefs; } } } } - // Moc executable - { - std::string mocExec; - std::string err; - - if (this->QtVersionMajor == "5") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt5::moc"); - if (tgt != nullptr) { - mocExec = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTOMOC: Qt5::moc target not found"; - } - } else if (this->QtVersionMajor == "4") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt4::moc"); - if (tgt != nullptr) { - mocExec = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTOMOC: Qt4::moc target not found"; - } - } else { - err = "The AUTOMOC feature supports only Qt 4 and Qt 5"; - } - - if (err.empty()) { - this->MocExecutable = mocExec; - } else { - err += " ("; - err += this->Target->GetName(); - err += ")"; - cmSystemTools::Error(err.c_str()); - } + if (!GetMocExecutable()) { + return false; } + + return true; } -void cmQtAutoGenInitializer::SetupCustomTargetsUic() +bool cmQtAutoGenInitializer::SetupCustomTargetsUic() { cmMakefile* makefile = this->Target->Target->GetMakefile(); // Uic search paths { std::string const usp = - GetSafeProperty(this->Target, "AUTOUIC_SEARCH_PATHS"); + this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS"); if (!usp.empty()) { - cmSystemTools::ExpandListArgument(usp, this->UicSearchPaths); + cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths); std::string const srcDir = makefile->GetCurrentSourceDirectory(); - for (std::string& path : this->UicSearchPaths) { + for (std::string& path : this->Uic.SearchPaths) { path = cmSystemTools::CollapseFullPath(path, srcDir); } } @@ -1186,13 +1126,13 @@ void cmQtAutoGenInitializer::SetupCustomTargetsUic() }; // Default settings - this->UicOptions = UicGetOpts(this->ConfigDefault); + this->Uic.Options = UicGetOpts(this->ConfigDefault); // Configuration specific settings for (std::string const& cfg : this->ConfigsList) { std::string const configUicOpts = UicGetOpts(cfg); - if (configUicOpts != this->UicOptions) { - this->UicOptionsConfig[cfg] = configUicOpts; + if (configUicOpts != this->Uic.Options) { + this->Uic.ConfigOptions[cfg] = configUicOpts; } } } @@ -1214,56 +1154,28 @@ void cmQtAutoGenInitializer::SetupCustomTargetsUic() // Check if the .ui file should be skipped if (sf->GetPropertyAsBool("SKIP_AUTOUIC") || sf->GetPropertyAsBool("SKIP_AUTOGEN")) { - this->UicSkip.insert(absFile); + this->Uic.Skip.insert(absFile); } // Check if the .ui file has uic options - std::string const uicOpts = GetSafeProperty(sf, "AUTOUIC_OPTIONS"); + std::string const uicOpts = sf->GetSafeProperty("AUTOUIC_OPTIONS"); if (!uicOpts.empty()) { // Check if file isn't skipped - if (this->UicSkip.count(absFile) == 0) { - this->UicFileFiles.push_back(absFile); + if (this->Uic.Skip.count(absFile) == 0) { + this->Uic.FileFiles.push_back(absFile); std::vector<std::string> optsVec; cmSystemTools::ExpandListArgument(uicOpts, optsVec); - this->UicFileOptions.push_back(std::move(optsVec)); + this->Uic.FileOptions.push_back(std::move(optsVec)); } } } } } - // Uic executable - { - std::string err; - std::string uicExec; - - cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); - if (this->QtVersionMajor == "5") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt5::uic"); - if (tgt != nullptr) { - uicExec = SafeString(tgt->ImportedGetLocation("")); - } else { - // Project does not use Qt5Widgets, but has AUTOUIC ON anyway - } - } else if (this->QtVersionMajor == "4") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt4::uic"); - if (tgt != nullptr) { - uicExec = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTOUIC: Qt4::uic target not found"; - } - } else { - err = "The AUTOUIC feature supports only Qt 4 and Qt 5"; - } - - if (err.empty()) { - this->UicExecutable = uicExec; - } else { - err += " ("; - err += this->Target->GetName(); - err += ")"; - cmSystemTools::Error(err.c_str()); - } + if (!GetUicExecutable()) { + return false; } + + return true; } void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename, @@ -1333,6 +1245,202 @@ bool cmQtAutoGenInitializer::QtVersionGreaterOrEqual( return false; } +bool cmQtAutoGenInitializer::GetMocExecutable() +{ + std::string err; + + // Find moc executable + { + std::string targetName; + if (this->QtVersionMajor == "5") { + targetName = "Qt5::moc"; + } else if (QtVersionMajor == "4") { + targetName = "Qt4::moc"; + } else { + err = "The AUTOMOC feature supports only Qt 4 and Qt 5"; + } + if (!targetName.empty()) { + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); + if (tgt != nullptr) { + this->Moc.Executable = tgt->ImportedGetLocation(""); + } else { + err = "Could not find target " + targetName; + } + } + } + + // Test moc command + if (err.empty()) { + if (cmSystemTools::FileExists(this->Moc.Executable, true)) { + std::vector<std::string> command; + command.push_back(this->Moc.Executable); + command.push_back("-h"); + std::string stdOut; + std::string stdErr; + int retVal = 0; + bool result = cmSystemTools::RunSingleCommand( + command, &stdOut, &stdErr, &retVal, nullptr, + cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); + if (!result) { + err = "The moc test command failed: "; + err += QuotedCommand(command); + } + } else { + err = "The moc executable "; + err += Quoted(this->Moc.Executable); + err += " does not exist"; + } + } + + // Print error + if (!err.empty()) { + std::string msg = "AutoMoc ("; + msg += this->Target->GetName(); + msg += "): "; + msg += err; + cmSystemTools::Error(msg.c_str()); + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::GetUicExecutable() +{ + std::string err; + + // Find uic executable + { + std::string targetName; + if (this->QtVersionMajor == "5") { + targetName = "Qt5::uic"; + } else if (QtVersionMajor == "4") { + targetName = "Qt4::uic"; + } else { + err = "The AUTOUIC feature supports only Qt 4 and Qt 5"; + } + if (!targetName.empty()) { + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); + if (tgt != nullptr) { + this->Uic.Executable = tgt->ImportedGetLocation(""); + } else { + if (this->QtVersionMajor == "5") { + // Project does not use Qt5Widgets, but has AUTOUIC ON anyway + } else { + err = "Could not find target " + targetName; + } + } + } + } + + // Test uic command + if (err.empty()) { + if (cmSystemTools::FileExists(this->Uic.Executable, true)) { + std::vector<std::string> command; + command.push_back(this->Uic.Executable); + command.push_back("-h"); + std::string stdOut; + std::string stdErr; + int retVal = 0; + bool result = cmSystemTools::RunSingleCommand( + command, &stdOut, &stdErr, &retVal, nullptr, + cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); + if (!result) { + err = "The uic test command failed: "; + err += QuotedCommand(command); + } + } else { + err = "The uic executable "; + err += Quoted(this->Uic.Executable); + err += " does not exist"; + } + } + + // Print error + if (!err.empty()) { + std::string msg = "AutoUic ("; + msg += this->Target->GetName(); + msg += "): "; + msg += err; + cmSystemTools::Error(msg.c_str()); + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::GetRccExecutable() +{ + std::string err; + + // Find rcc executable + { + std::string targetName; + if (this->QtVersionMajor == "5") { + targetName = "Qt5::rcc"; + } else if (QtVersionMajor == "4") { + targetName = "Qt4::rcc"; + } else { + err = "The AUTORCC feature supports only Qt 4 and Qt 5"; + } + if (!targetName.empty()) { + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); + if (tgt != nullptr) { + this->Rcc.Executable = tgt->ImportedGetLocation(""); + } else { + err = "Could not find target " + targetName; + } + } + } + + // Test rcc command + if (err.empty()) { + if (cmSystemTools::FileExists(this->Rcc.Executable, true)) { + std::vector<std::string> command; + command.push_back(this->Rcc.Executable); + command.push_back("-h"); + std::string stdOut; + std::string stdErr; + int retVal = 0; + bool result = cmSystemTools::RunSingleCommand( + command, &stdOut, &stdErr, &retVal, nullptr, + cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); + if (result) { + // Detect if rcc supports (-)-list + if (this->QtVersionMajor == "5") { + if (stdOut.find("--list") != std::string::npos) { + this->Rcc.ListOptions.push_back("--list"); + } else { + this->Rcc.ListOptions.push_back("-list"); + } + } + } else { + err = "The rcc test command failed: "; + err += QuotedCommand(command); + } + } else { + err = "The rcc executable "; + err += Quoted(this->Rcc.Executable); + err += " does not exist"; + } + } + + // Print error + if (!err.empty()) { + std::string msg = "AutoRcc ("; + msg += this->Target->GetName(); + msg += "): "; + msg += err; + cmSystemTools::Error(msg.c_str()); + return false; + } + + return true; +} + /// @brief Reads the resource files list from from a .qrc file /// @arg fileName Must be the absolute path of the .qrc file /// @return True if the rcc file was successfully read @@ -1346,9 +1454,9 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName, error += "\n"; return false; } - if (!RccListOptions.empty()) { + if (!this->Rcc.ListOptions.empty()) { // Use rcc for file listing - if (RccExecutable.empty()) { + if (this->Rcc.Executable.empty()) { error = "rcc executable not available"; return false; } @@ -1367,8 +1475,9 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName, std::string rccStdErr; { std::vector<std::string> cmd; - cmd.push_back(RccExecutable); - cmd.insert(cmd.end(), RccListOptions.begin(), RccListOptions.end()); + cmd.push_back(this->Rcc.Executable); + cmd.insert(cmd.end(), this->Rcc.ListOptions.begin(), + this->Rcc.ListOptions.end()); cmd.push_back(fileNameName); result = cmSystemTools::RunSingleCommand( cmd, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(), diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 5fbf0cb..0999e0f 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -50,39 +50,37 @@ public: bool uicEnabled, bool rccEnabled, std::string const& qtVersionMajor); - void InitCustomTargets(); - void SetupCustomTargets(); + bool InitCustomTargets(); + bool SetupCustomTargets(); private: - void SetupCustomTargetsMoc(); - void SetupCustomTargetsUic(); + bool SetupCustomTargetsMoc(); + bool SetupCustomTargetsUic(); void AddGeneratedSource(std::string const& filename, GeneratorT genType); bool QtVersionGreaterOrEqual(unsigned long requestMajor, unsigned long requestMinor) const; + bool GetMocExecutable(); + bool GetUicExecutable(); + bool GetRccExecutable(); + bool RccListInputs(std::string const& fileName, std::vector<std::string>& files, std::string& errorMessage); private: cmGeneratorTarget* Target; - bool MocEnabled; - bool UicEnabled; - bool RccEnabled; bool MultiConfig; // Qt std::string QtVersionMajor; std::string QtVersionMinor; - std::string MocExecutable; - std::string UicExecutable; - std::string RccExecutable; - std::vector<std::string> RccListOptions; // Configurations std::string ConfigDefault; std::vector<std::string> ConfigsList; std::string Parallel; + std::string Verbosity; // Names std::string AutogenTargetName; std::string AutogenFolder; @@ -96,21 +94,37 @@ private: std::vector<std::string> Headers; std::vector<std::string> Sources; // Moc - std::string MocPredefsCmd; - std::set<std::string> MocSkip; - std::string MocIncludes; - std::map<std::string, std::string> MocIncludesConfig; - std::string MocDefines; - std::map<std::string, std::string> MocDefinesConfig; + struct + { + bool Enabled; + std::string Executable; + std::string PredefsCmd; + std::set<std::string> Skip; + std::string Includes; + std::map<std::string, std::string> ConfigIncludes; + std::string Defines; + std::map<std::string, std::string> ConfigDefines; + } Moc; // Uic - std::set<std::string> UicSkip; - std::vector<std::string> UicSearchPaths; - std::string UicOptions; - std::map<std::string, std::string> UicOptionsConfig; - std::vector<std::string> UicFileFiles; - std::vector<std::vector<std::string>> UicFileOptions; + struct + { + bool Enabled; + std::string Executable; + std::set<std::string> Skip; + std::vector<std::string> SearchPaths; + std::string Options; + std::map<std::string, std::string> ConfigOptions; + std::vector<std::string> FileFiles; + std::vector<std::vector<std::string>> FileOptions; + } Uic; // Rcc - std::vector<Qrc> Qrcs; + struct + { + bool Enabled; + std::string Executable; + std::vector<std::string> ListOptions; + std::vector<Qrc> Qrcs; + } Rcc; }; #endif diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 7aa792f..64ce0e3 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -17,9 +17,14 @@ // -- Class methods -void cmQtAutoGenerator::Logger::SetVerbose(bool value) +void cmQtAutoGenerator::Logger::RaiseVerbosity(std::string const& value) { - Verbose_ = value; + unsigned long verbosity = 0; + if (cmSystemTools::StringToULong(value.c_str(), &verbosity)) { + if (this->Verbosity_ < verbosity) { + this->Verbosity_ = static_cast<unsigned int>(verbosity); + } + } } void cmQtAutoGenerator::Logger::SetColorOutput(bool value) @@ -632,7 +637,18 @@ cmQtAutoGenerator::cmQtAutoGenerator() : FileSys_(&Logger_) { // Initialize logger - Logger_.SetVerbose(cmSystemTools::HasEnv("VERBOSE")); + { + std::string verbose; + if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) { + unsigned long iVerbose = 0; + if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) { + Logger_.SetVerbosity(static_cast<unsigned int>(iVerbose)); + } else { + // Non numeric verbosity + Logger_.SetVerbose(cmSystemTools::IsOn(verbose.c_str())); + } + } + } { std::string colorEnv; cmSystemTools::GetEnv("COLOR", colorEnv); diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 4e38413..75143f5 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -33,8 +33,11 @@ public: { public: // -- Verbosity - bool Verbose() const { return this->Verbose_; } - void SetVerbose(bool value); + unsigned int Verbosity() const { return this->Verbosity_; } + void SetVerbosity(unsigned int value) { this->Verbosity_ = value; } + void RaiseVerbosity(std::string const& value); + bool Verbose() const { return (this->Verbosity_ != 0); } + void SetVerbose(bool value) { this->Verbosity_ = value ? 1 : 0; } bool ColorOutput() const { return this->ColorOutput_; } void SetColorOutput(bool value); // -- Log info @@ -56,8 +59,8 @@ public: private: std::mutex Mutex_; - bool volatile Verbose_ = false; - bool volatile ColorOutput_ = false; + unsigned int Verbosity_ = 0; + bool ColorOutput_ = false; }; /// @brief Thread safe file system interface diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index f196b97..a6b0247 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1222,6 +1222,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) } // -- Meta + Log().RaiseVerbosity(InfoGet("AM_VERBOSITY")); Base_.MultiConfig = InfoGetBool("AM_MULTI_CONFIG"); { unsigned long num = Base_.NumThreads; diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx index 3064895..e49599f 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoGeneratorRcc.cxx @@ -70,6 +70,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) } // - Configurations + Log().RaiseVerbosity(InfoGet("ARCC_VERBOSITY")); MultiConfig_ = makefile->IsOn("ARCC_MULTI_CONFIG"); // - Directories diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 12817ae..32ad0b0 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -34,7 +34,7 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot) , NoteDirective("^.. note::[ \t]*(.*)$") , ModuleRST("^#\\[(=*)\\[\\.rst:$") , CMakeRole("(:cmake)?:(" - "command|generator|variable|envvar|module|policy|" + "command|cpack_gen|generator|variable|envvar|module|policy|" "prop_cache|prop_dir|prop_gbl|prop_inst|prop_sf|" "prop_test|prop_tgt|" "manual" diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 6792d66..05e26ea 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -296,6 +296,15 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const return retVal; } +const char* cmSourceFile::GetSafeProperty(const std::string& prop) const +{ + const char* ret = this->GetProperty(prop); + if (!ret) { + return ""; + } + return ret; +} + bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const { return cmSystemTools::IsOn(this->GetProperty(prop)); diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 1516d98..ab0f229 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -45,7 +45,10 @@ public: void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); + ///! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; + ///! Always returns a valid pointer + const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; /** Implement getting a property when called from a CMake language diff --git a/Source/cmState.cxx b/Source/cmState.cxx index a57be4d..dcf6ea0 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -280,6 +280,8 @@ cmStateSnapshot cmState::Reset() it->CompileDefinitionsBacktraces.clear(); it->CompileOptions.clear(); it->CompileOptionsBacktraces.clear(); + it->LinkOptions.clear(); + it->LinkOptionsBacktraces.clear(); it->DirectoryEnd = pos; it->NormalTargetNames.clear(); it->Properties.clear(); diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index 85e6366..6eac8e2 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -360,6 +360,42 @@ void cmStateDirectory::ClearCompileOptions() this->Snapshot_.Position->CompileOptionsPosition); } +cmStringRange cmStateDirectory::GetLinkOptionsEntries() const +{ + return GetPropertyContent(this->DirectoryState->LinkOptions, + this->Snapshot_.Position->LinkOptionsPosition); +} + +cmBacktraceRange cmStateDirectory::GetLinkOptionsEntryBacktraces() const +{ + return GetPropertyBacktraces(this->DirectoryState->LinkOptions, + this->DirectoryState->LinkOptionsBacktraces, + this->Snapshot_.Position->LinkOptionsPosition); +} + +void cmStateDirectory::AppendLinkOptionsEntry(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + AppendEntry(this->DirectoryState->LinkOptions, + this->DirectoryState->LinkOptionsBacktraces, + this->Snapshot_.Position->LinkOptionsPosition, vec, lfbt); +} + +void cmStateDirectory::SetLinkOptions(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + SetContent(this->DirectoryState->LinkOptions, + this->DirectoryState->LinkOptionsBacktraces, + this->Snapshot_.Position->LinkOptionsPosition, vec, lfbt); +} + +void cmStateDirectory::ClearLinkOptions() +{ + ClearContent(this->DirectoryState->LinkOptions, + this->DirectoryState->LinkOptionsBacktraces, + this->Snapshot_.Position->LinkOptionsPosition); +} + void cmStateDirectory::SetProperty(const std::string& prop, const char* value, cmListFileBacktrace const& lfbt) { @@ -387,6 +423,14 @@ void cmStateDirectory::SetProperty(const std::string& prop, const char* value, this->SetCompileDefinitions(value, lfbt); return; } + if (prop == "LINK_OPTIONS") { + if (!value) { + this->ClearLinkOptions(); + return; + } + this->SetLinkOptions(value, lfbt); + return; + } this->DirectoryState->Properties.SetProperty(prop, value); } @@ -407,6 +451,10 @@ void cmStateDirectory::AppendProperty(const std::string& prop, this->AppendCompileDefinitionsEntry(value, lfbt); return; } + if (prop == "LINK_OPTIONS") { + this->AppendLinkOptionsEntry(value, lfbt); + return; + } this->DirectoryState->Properties.AppendProperty(prop, value, asString); } @@ -490,6 +538,10 @@ const char* cmStateDirectory::GetProperty(const std::string& prop, output = cmJoin(this->GetCompileDefinitionsEntries(), ";"); return output.c_str(); } + if (prop == "LINK_OPTIONS") { + output = cmJoin(this->GetLinkOptionsEntries(), ";"); + return output.c_str(); + } const char* retVal = this->DirectoryState->Properties.GetPropertyValue(prop); if (!retVal && chain) { diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h index 79bb369..bc96cc9 100644 --- a/Source/cmStateDirectory.h +++ b/Source/cmStateDirectory.h @@ -58,6 +58,13 @@ public: cmListFileBacktrace const& lfbt); void ClearCompileOptions(); + cmStringRange GetLinkOptionsEntries() const; + cmBacktraceRange GetLinkOptionsEntryBacktraces() const; + void AppendLinkOptionsEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetLinkOptions(std::string const& vec, cmListFileBacktrace const& lfbt); + void ClearLinkOptions(); + void SetProperty(const std::string& prop, const char* value, cmListFileBacktrace const& lfbt); void AppendProperty(const std::string& prop, const char* value, diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h index f36ee37..7177221 100644 --- a/Source/cmStatePrivate.h +++ b/Source/cmStatePrivate.h @@ -42,6 +42,7 @@ struct cmStateDetail::SnapshotDataType std::vector<std::string>::size_type IncludeDirectoryPosition; std::vector<std::string>::size_type CompileDefinitionsPosition; std::vector<std::string>::size_type CompileOptionsPosition; + std::vector<std::string>::size_type LinkOptionsPosition; }; struct cmStateDetail::PolicyStackEntry : public cmPolicies::PolicyMap @@ -84,6 +85,9 @@ struct cmStateDetail::BuildsystemDirectoryStateType std::vector<std::string> CompileOptions; std::vector<cmListFileBacktrace> CompileOptionsBacktraces; + std::vector<std::string> LinkOptions; + std::vector<cmListFileBacktrace> LinkOptionsBacktraces; + std::vector<std::string> NormalTargetNames; std::string ProjectName; diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 8f5f58c..ec428a6 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -390,6 +390,13 @@ void cmStateSnapshot::InitializeFromParent() this->Position->BuildSystemDirectory->CompileOptionsBacktraces, this->Position->CompileOptionsPosition); + InitializeContentFromParent( + parent->BuildSystemDirectory->LinkOptions, + this->Position->BuildSystemDirectory->LinkOptions, + parent->BuildSystemDirectory->LinkOptionsBacktraces, + this->Position->BuildSystemDirectory->LinkOptionsBacktraces, + this->Position->LinkOptionsPosition); + const char* include_regex = parent->BuildSystemDirectory->Properties.GetPropertyValue( "INCLUDE_REGULAR_EXPRESSION"); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1868816..803a0a9 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -166,6 +166,8 @@ public: std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces; std::vector<std::string> SourceEntries; std::vector<cmListFileBacktrace> SourceBacktraces; + std::vector<std::string> LinkOptionsEntries; + std::vector<cmListFileBacktrace> LinkOptionsBacktraces; std::vector<std::string> LinkImplementationPropertyEntries; std::vector<cmListFileBacktrace> LinkImplementationPropertyBacktraces; }; @@ -343,17 +345,29 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(), parentSystemIncludes.end()); - const cmStringRange parentOptions = + const cmStringRange parentCompileOptions = this->Makefile->GetCompileOptionsEntries(); - const cmBacktraceRange parentOptionsBts = + const cmBacktraceRange parentCompileOptionsBts = this->Makefile->GetCompileOptionsBacktraces(); this->Internal->CompileOptionsEntries.insert( - this->Internal->CompileOptionsEntries.end(), parentOptions.begin(), - parentOptions.end()); + this->Internal->CompileOptionsEntries.end(), + parentCompileOptions.begin(), parentCompileOptions.end()); this->Internal->CompileOptionsBacktraces.insert( - this->Internal->CompileOptionsBacktraces.end(), parentOptionsBts.begin(), - parentOptionsBts.end()); + this->Internal->CompileOptionsBacktraces.end(), + parentCompileOptionsBts.begin(), parentCompileOptionsBts.end()); + + const cmStringRange parentLinkOptions = + this->Makefile->GetLinkOptionsEntries(); + const cmBacktraceRange parentLinkOptionsBts = + this->Makefile->GetLinkOptionsBacktraces(); + + this->Internal->LinkOptionsEntries.insert( + this->Internal->LinkOptionsEntries.end(), parentLinkOptions.begin(), + parentLinkOptions.end()); + this->Internal->LinkOptionsBacktraces.insert( + this->Internal->LinkOptionsBacktraces.end(), + parentLinkOptionsBts.begin(), parentLinkOptionsBts.end()); } if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY && @@ -822,6 +836,16 @@ cmBacktraceRange cmTarget::GetSourceBacktraces() const return cmMakeRange(this->Internal->SourceBacktraces); } +cmStringRange cmTarget::GetLinkOptionsEntries() const +{ + return cmMakeRange(this->Internal->LinkOptionsEntries); +} + +cmBacktraceRange cmTarget::GetLinkOptionsBacktraces() const +{ + return cmMakeRange(this->Internal->LinkOptionsBacktraces); +} + cmStringRange cmTarget::GetLinkImplementationEntries() const { return cmMakeRange(this->Internal->LinkImplementationPropertyEntries); @@ -847,6 +871,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) MAKE_STATIC_PROP(EXPORT_NAME); MAKE_STATIC_PROP(IMPORTED_GLOBAL); MAKE_STATIC_PROP(INCLUDE_DIRECTORIES); + MAKE_STATIC_PROP(LINK_OPTIONS); MAKE_STATIC_PROP(LINK_LIBRARIES); MAKE_STATIC_PROP(MANUALLY_ADDED_DEPENDENCIES); MAKE_STATIC_PROP(NAME); @@ -925,6 +950,14 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->CompileDefinitionsBacktraces.push_back(lfbt); } + } else if (prop == propLINK_OPTIONS) { + this->Internal->LinkOptionsEntries.clear(); + this->Internal->LinkOptionsBacktraces.clear(); + if (value) { + this->Internal->LinkOptionsEntries.push_back(value); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + this->Internal->LinkOptionsBacktraces.push_back(lfbt); + } } else if (prop == propLINK_LIBRARIES) { this->Internal->LinkImplementationPropertyEntries.clear(); this->Internal->LinkImplementationPropertyBacktraces.clear(); @@ -1030,6 +1063,12 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->CompileDefinitionsBacktraces.push_back(lfbt); } + } else if (prop == "LINK_OPTIONS") { + if (value && *value) { + this->Internal->LinkOptionsEntries.push_back(value); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + this->Internal->LinkOptionsBacktraces.push_back(lfbt); + } } else if (prop == "LINK_LIBRARIES") { if (value && *value) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); @@ -1111,6 +1150,21 @@ void cmTarget::InsertCompileDefinition(std::string const& entry, this->Internal->CompileDefinitionsBacktraces.push_back(bt); } +void cmTarget::InsertLinkOption(std::string const& entry, + cmListFileBacktrace const& bt, bool before) +{ + std::vector<std::string>::iterator position = before + ? this->Internal->LinkOptionsEntries.begin() + : this->Internal->LinkOptionsEntries.end(); + + std::vector<cmListFileBacktrace>::iterator btPosition = before + ? this->Internal->LinkOptionsBacktraces.begin() + : this->Internal->LinkOptionsBacktraces.end(); + + this->Internal->LinkOptionsEntries.insert(position, entry); + this->Internal->LinkOptionsBacktraces.insert(btPosition, bt); +} + static void cmTargetCheckLINK_INTERFACE_LIBRARIES(const std::string& prop, const char* value, cmMakefile* context, @@ -1230,6 +1284,7 @@ const char* cmTarget::GetProperty(const std::string& prop) const MAKE_STATIC_PROP(COMPILE_FEATURES); MAKE_STATIC_PROP(COMPILE_OPTIONS); MAKE_STATIC_PROP(COMPILE_DEFINITIONS); + MAKE_STATIC_PROP(LINK_OPTIONS); MAKE_STATIC_PROP(IMPORTED); MAKE_STATIC_PROP(IMPORTED_GLOBAL); MAKE_STATIC_PROP(MANUALLY_ADDED_DEPENDENCIES); @@ -1245,6 +1300,7 @@ const char* cmTarget::GetProperty(const std::string& prop) const specialProps.insert(propCOMPILE_FEATURES); specialProps.insert(propCOMPILE_OPTIONS); specialProps.insert(propCOMPILE_DEFINITIONS); + specialProps.insert(propLINK_OPTIONS); specialProps.insert(propIMPORTED); specialProps.insert(propIMPORTED_GLOBAL); specialProps.insert(propMANUALLY_ADDED_DEPENDENCIES); @@ -1303,6 +1359,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const output = cmJoin(this->Internal->CompileDefinitionsEntries, ";"); return output.c_str(); } + if (prop == propLINK_OPTIONS) { + if (this->Internal->LinkOptionsEntries.empty()) { + return nullptr; + } + + static std::string output; + output = cmJoin(this->Internal->LinkOptionsEntries, ";"); + return output.c_str(); + } if (prop == propMANUALLY_ADDED_DEPENDENCIES) { if (this->Utilities.empty()) { return nullptr; @@ -1347,6 +1412,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const return retVal; } +const char* cmTarget::GetSafeProperty(const std::string& prop) const +{ + const char* ret = this->GetProperty(prop); + if (!ret) { + return ""; + } + return ret; +} + bool cmTarget::GetPropertyAsBool(const std::string& prop) const { return cmSystemTools::IsOn(this->GetProperty(prop)); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 3abb47e..7a3ab65 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -200,7 +200,10 @@ public: void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); + ///! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; + ///! Always returns a valid pointer + const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; const char* GetComputedProperty(const std::string& prop, @@ -239,6 +242,8 @@ public: cmListFileBacktrace const& bt, bool before = false); void InsertCompileDefinition(std::string const& entry, cmListFileBacktrace const& bt); + void InsertLinkOption(std::string const& entry, + cmListFileBacktrace const& bt, bool before = false); void AppendBuildInterfaceIncludes(); @@ -265,6 +270,10 @@ public: cmStringRange GetSourceEntries() const; cmBacktraceRange GetSourceBacktraces() const; + + cmStringRange GetLinkOptionsEntries() const; + cmBacktraceRange GetLinkOptionsBacktraces() const; + cmStringRange GetLinkImplementationEntries() const; cmBacktraceRange GetLinkImplementationBacktraces() const; diff --git a/Source/cmTargetLinkOptionsCommand.cxx b/Source/cmTargetLinkOptionsCommand.cxx new file mode 100644 index 0000000..f0f13fd --- /dev/null +++ b/Source/cmTargetLinkOptionsCommand.cxx @@ -0,0 +1,41 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmTargetLinkOptionsCommand.h" + +#include <sstream> + +#include "cmAlgorithms.h" +#include "cmListFileCache.h" +#include "cmMakefile.h" +#include "cmTarget.h" +#include "cmake.h" + +class cmExecutionStatus; + +bool cmTargetLinkOptionsCommand::InitialPass( + std::vector<std::string> const& args, cmExecutionStatus&) +{ + return this->HandleArguments(args, "LINK_OPTIONS", PROCESS_BEFORE); +} + +void cmTargetLinkOptionsCommand::HandleMissingTarget(const std::string& name) +{ + std::ostringstream e; + e << "Cannot specify link options for target \"" << name + << "\" which is not built by this project."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); +} + +std::string cmTargetLinkOptionsCommand::Join( + const std::vector<std::string>& content) +{ + return cmJoin(content, ";"); +} + +bool cmTargetLinkOptionsCommand::HandleDirectContent( + cmTarget* tgt, const std::vector<std::string>& content, bool, bool) +{ + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + tgt->InsertLinkOption(this->Join(content), lfbt); + return true; // Successfully handled. +} diff --git a/Source/cmTargetLinkOptionsCommand.h b/Source/cmTargetLinkOptionsCommand.h new file mode 100644 index 0000000..a1fc9fc --- /dev/null +++ b/Source/cmTargetLinkOptionsCommand.h @@ -0,0 +1,41 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmTargetLinkOptionsCommand_h +#define cmTargetLinkOptionsCommand_h + +#include "cmConfigure.h" // IWYU pragma: keep + +#include <string> +#include <vector> + +#include "cmTargetPropCommandBase.h" + +class cmCommand; +class cmExecutionStatus; +class cmTarget; + +class cmTargetLinkOptionsCommand : public cmTargetPropCommandBase +{ +public: + /** + * This is a virtual constructor for the command. + */ + cmCommand* Clone() override { return new cmTargetLinkOptionsCommand; } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus& status) override; + +private: + void HandleMissingTarget(const std::string& name) override; + + bool HandleDirectContent(cmTarget* tgt, + const std::vector<std::string>& content, + bool prepend, bool system) override; + std::string Join(const std::vector<std::string>& content) override; +}; + +#endif diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx index 3dd3748..62e323c 100644 --- a/Source/cmTargetSourcesCommand.cxx +++ b/Source/cmTargetSourcesCommand.cxx @@ -2,10 +2,14 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmTargetSourcesCommand.h" +#include <cstring> #include <sstream> #include "cmAlgorithms.h" +#include "cmGeneratorExpression.h" #include "cmMakefile.h" +#include "cmPolicies.h" +#include "cmSystemTools.h" #include "cmTarget.h" #include "cmake.h" @@ -17,6 +21,14 @@ bool cmTargetSourcesCommand::InitialPass(std::vector<std::string> const& args, return this->HandleArguments(args, "SOURCES"); } +void cmTargetSourcesCommand::HandleInterfaceContent( + cmTarget* tgt, const std::vector<std::string>& content, bool prepend, + bool system) +{ + cmTargetPropCommandBase::HandleInterfaceContent( + tgt, ConvertToAbsoluteContent(tgt, content, true), prepend, system); +} + void cmTargetSourcesCommand::HandleMissingTarget(const std::string& name) { std::ostringstream e; @@ -35,6 +47,79 @@ std::string cmTargetSourcesCommand::Join( bool cmTargetSourcesCommand::HandleDirectContent( cmTarget* tgt, const std::vector<std::string>& content, bool, bool) { - tgt->AppendProperty("SOURCES", this->Join(content).c_str()); + tgt->AppendProperty( + "SOURCES", + this->Join(ConvertToAbsoluteContent(tgt, content, false)).c_str()); return true; // Successfully handled. } + +std::vector<std::string> cmTargetSourcesCommand::ConvertToAbsoluteContent( + cmTarget* tgt, const std::vector<std::string>& content, + bool isInterfaceContent) +{ + // Skip conversion in case old behavior has been explictly requested + if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0076) == + cmPolicies::OLD) { + return content; + } + + bool changedPath = false; + std::vector<std::string> absoluteContent; + absoluteContent.reserve(content.size()); + for (std::string const& src : content) { + std::string absoluteSrc; + if (cmSystemTools::FileIsFullPath(src) || + cmGeneratorExpression::Find(src) == 0 || + (!isInterfaceContent && + strcmp(this->Makefile->GetCurrentSourceDirectory(), + tgt->GetMakefile()->GetCurrentSourceDirectory()) == 0)) { + absoluteSrc = src; + } else { + changedPath = true; + absoluteSrc = this->Makefile->GetCurrentSourceDirectory(); + absoluteSrc += "/"; + absoluteSrc += src; + } + absoluteContent.push_back(absoluteSrc); + } + + if (!changedPath) { + return content; + } + + bool issueMessage = true; + bool useAbsoluteContent = false; + std::ostringstream e; + switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0076)) { + case cmPolicies::WARN: + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0076) << "\n"; + break; + case cmPolicies::OLD: + issueMessage = false; + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0076)); + break; + case cmPolicies::NEW: { + issueMessage = false; + useAbsoluteContent = true; + break; + } + } + + if (issueMessage) { + if (isInterfaceContent) { + e << "An interface source of target \"" << tgt->GetName() + << "\" has a relative path."; + } else { + e << "A private source from a directory other than that of target \"" + << tgt->GetName() << "\" has a relative path."; + } + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + } + + return useAbsoluteContent ? absoluteContent : content; +} diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h index ea8776a..b01e3ca 100644 --- a/Source/cmTargetSourcesCommand.h +++ b/Source/cmTargetSourcesCommand.h @@ -29,6 +29,11 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) override; +protected: + void HandleInterfaceContent(cmTarget* tgt, + const std::vector<std::string>& content, + bool prepend, bool system) override; + private: void HandleMissingTarget(const std::string& name) override; @@ -37,6 +42,10 @@ private: bool prepend, bool system) override; std::string Join(const std::vector<std::string>& content) override; + + std::vector<std::string> ConvertToAbsoluteContent( + cmTarget* tgt, const std::vector<std::string>& content, + bool isInterfaceContent); }; #endif diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index eff915b..41567a3 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2286,14 +2286,51 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions( if (const char* workingDir = this->GeneratorTarget->GetProperty( "VS_DEBUGGER_WORKING_DIRECTORY")) { + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(workingDir); + std::string genWorkingDir = + cge->Evaluate(this->LocalGenerator, config); + e1.WritePlatformConfigTag("LocalDebuggerWorkingDirectory", cond, - workingDir); + genWorkingDir); + } + + if (const char* environment = + this->GeneratorTarget->GetProperty("VS_DEBUGGER_ENVIRONMENT")) { + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(environment); + std::string genEnvironment = + cge->Evaluate(this->LocalGenerator, config); + + e1.WritePlatformConfigTag("LocalDebuggerEnvironment", cond, + genEnvironment); } if (const char* debuggerCommand = this->GeneratorTarget->GetProperty("VS_DEBUGGER_COMMAND")) { + + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(debuggerCommand); + std::string genDebuggerCommand = + cge->Evaluate(this->LocalGenerator, config); + e1.WritePlatformConfigTag("LocalDebuggerCommand", cond, - debuggerCommand); + genDebuggerCommand); + } + + if (const char* commandArguments = this->GeneratorTarget->GetProperty( + "VS_DEBUGGER_COMMAND_ARGUMENTS")) { + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(commandArguments); + std::string genCommandArguments = + cge->Evaluate(this->LocalGenerator, config); + + e1.WritePlatformConfigTag("LocalDebuggerCommandArguments", cond, + genCommandArguments); } std::string name = @@ -3235,6 +3272,11 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( flags += flagsConfig; } + std::vector<std::string> opts; + this->GeneratorTarget->GetLinkOptions(opts, config, linkLanguage); + // LINK_OPTIONS are escaped. + this->LocalGenerator->AppendCompileOptions(flags, opts); + cmComputeLinkInformation* pcli = this->GeneratorTarget->GetLinkInformation(config); if (!pcli) { diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 96088c8..516104b 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -1193,13 +1193,17 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # Some Apple compilers produce bad optimizations in this source. IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$") SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -O0") - ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL" AND - NOT (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND - NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1")) + ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL") # Tell IBM XL not to warn about our test infinite loop - # v13.1.1 and newer on Linux ppc64le is clang based and does not accept - # the -qsuppress option - SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -qsuppress=1500-010") + IF(CMAKE_SYSTEM MATCHES "Linux.*ppc64le" + AND CMAKE_C_COMPILER_VERSION VERSION_LESS "16.1.0" + AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1") + # v13.1.[1-6] on Linux ppc64le is clang based and does not accept + # the -qsuppress option, so just suppress all warnings. + SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -w") + ELSE() + SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -qsuppress=1500-010") + ENDIF() ENDIF() IF(CMAKE_C_FLAGS MATCHES "-fsanitize=") SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -DCRASH_USING_ABORT") diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index cfe62b4..7545ec7 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -3495,7 +3495,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() // Chip Model Name this->ChipID.ModelName = - this->ExtractValueFromCpuInfoFile(buffer, "model name").c_str(); + this->ExtractValueFromCpuInfoFile(buffer, "model name"); // L1 Cache size // Different architectures may show different names for the caches. @@ -4613,7 +4613,7 @@ std::string SystemInformationImplementation::ExtractValueFromSysCtl( std::string SystemInformationImplementation::RunProcess( std::vector<const char*> args) { - std::string buffer = ""; + std::string buffer; // Run the application kwsysProcess* gp = kwsysProcess_New(); @@ -4668,11 +4668,7 @@ std::string SystemInformationImplementation::RunProcess( std::string SystemInformationImplementation::ParseValueFromKStat( const char* arguments) { - std::vector<const char*> args; - args.clear(); - args.push_back("kstat"); - args.push_back("-p"); - + std::vector<std::string> args_string; std::string command = arguments; size_t start = std::string::npos; size_t pos = command.find(' ', 0); @@ -4691,35 +4687,35 @@ std::string SystemInformationImplementation::ParseValueFromKStat( } if (!inQuotes) { - std::string arg = command.substr(start + 1, pos - start - 1); + args_string.push_back(command.substr(start + 1, pos - start - 1)); + std::string& arg = args_string.back(); // Remove the quotes if any - size_t quotes = arg.find('"'); - while (quotes != std::string::npos) { - arg.erase(quotes, 1); - quotes = arg.find('"'); - } - args.push_back(arg.c_str()); + arg.erase(std::remove(arg.begin(), arg.end(), '"'), arg.end()); start = pos; } pos = command.find(' ', pos + 1); } - std::string lastArg = command.substr(start + 1, command.size() - start - 1); - args.push_back(lastArg.c_str()); + args_string.push_back(command.substr(start + 1, command.size() - start - 1)); + std::vector<const char*> args; + args.reserve(3 + args_string.size()); + args.push_back("kstat"); + args.push_back("-p"); + for (size_t i = 0; i < args_string.size(); ++i) { + args.push_back(args_string[i].c_str()); + } args.push_back(KWSYS_NULLPTR); std::string buffer = this->RunProcess(args); - std::string value = ""; + std::string value; for (size_t i = buffer.size() - 1; i > 0; i--) { if (buffer[i] == ' ' || buffer[i] == '\t') { break; } if (buffer[i] != '\n' && buffer[i] != '\r') { - std::string val = value; - value = buffer[i]; - value += val; + value.insert(0u, 1, buffer[i]); } } return value; diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 0079da2..d552d9f 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -686,7 +686,7 @@ public: for (iterator i = this->begin(); i != this->end(); ++i) { # if defined(_WIN32) const std::string s = Encoding::ToNarrow(*i); - kwsysUnPutEnv(s.c_str()); + kwsysUnPutEnv(s); # else kwsysUnPutEnv(*i); # endif @@ -1752,11 +1752,11 @@ std::string SystemTools::CropString(const std::string& s, size_t max_len) return n; } -std::vector<kwsys::String> SystemTools::SplitString(const std::string& p, - char sep, bool isPath) +std::vector<std::string> SystemTools::SplitString(const std::string& p, + char sep, bool isPath) { std::string path = p; - std::vector<kwsys::String> paths; + std::vector<std::string> paths; if (path.empty()) { return paths; } @@ -1973,7 +1973,7 @@ std::string SystemTools::ConvertToUnixOutputPath(const std::string& path) } // escape spaces and () in the path if (ret.find_first_of(" ") != std::string::npos) { - std::string result = ""; + std::string result; char lastch = 1; for (const char* ch = ret.c_str(); *ch != '\0'; ++ch) { // if it is already escaped then don't try to escape it again @@ -3140,7 +3140,7 @@ void SystemTools::AddTranslationPath(const std::string& a, void SystemTools::AddKeepPath(const std::string& dir) { std::string cdir; - Realpath(SystemTools::CollapseFullPath(dir).c_str(), cdir); + Realpath(SystemTools::CollapseFullPath(dir), cdir); SystemTools::AddTranslationPath(cdir, dir); } @@ -3279,13 +3279,12 @@ std::string SystemTools::RelativePath(const std::string& local, std::string r = SystemTools::CollapseFullPath(remote); // split up both paths into arrays of strings using / as a separator - std::vector<kwsys::String> localSplit = - SystemTools::SplitString(l, '/', true); - std::vector<kwsys::String> remoteSplit = + std::vector<std::string> localSplit = SystemTools::SplitString(l, '/', true); + std::vector<std::string> remoteSplit = SystemTools::SplitString(r, '/', true); - std::vector<kwsys::String> + std::vector<std::string> commonPath; // store shared parts of path in this array - std::vector<kwsys::String> finalPath; // store the final relative path here + std::vector<std::string> finalPath; // store the final relative path here // count up how many matching directory names there are from the start unsigned int sameCount = 0; while (((sameCount <= (localSplit.size() - 1)) && @@ -3325,7 +3324,7 @@ std::string SystemTools::RelativePath(const std::string& local, } // for each entry that is not common in the remote path add it // to the final path. - for (std::vector<String>::iterator vit = remoteSplit.begin(); + for (std::vector<std::string>::iterator vit = remoteSplit.begin(); vit != remoteSplit.end(); ++vit) { if (!vit->empty()) { finalPath.push_back(*vit); @@ -3334,7 +3333,7 @@ std::string SystemTools::RelativePath(const std::string& local, std::string relativePath; // result string // now turn the array of directories into a unix path by puttint / // between each entry that does not already have one - for (std::vector<String>::iterator vit1 = finalPath.begin(); + for (std::vector<std::string>::iterator vit1 = finalPath.begin(); vit1 != finalPath.end(); ++vit1) { if (!relativePath.empty() && *relativePath.rbegin() != '/') { relativePath += "/"; diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 928ee41..8d1f78c 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -10,8 +10,6 @@ #include <string> #include <vector> -#include <@KWSYS_NAMESPACE@/String.hxx> - #include <sys/types.h> // include sys/stat.h after sys/types.h #include <sys/stat.h> @@ -197,9 +195,9 @@ public: s starts with a / then the first element of the returned array will be /, so /foo/bar will be [/, foo, bar] */ - static std::vector<String> SplitString(const std::string& s, - char separator = '/', - bool isPath = false); + static std::vector<std::string> SplitString(const std::string& s, + char separator = '/', + bool isPath = false); /** * Perform a case-independent string comparison */ diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c index f0d9c64..1bcfd0c 100644 --- a/Source/kwsys/Terminal.c +++ b/Source/kwsys/Terminal.c @@ -209,27 +209,34 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100, } /* VT100 escape sequence strings. */ -#define KWSYS_TERMINAL_VT100_NORMAL "\33[0m" -#define KWSYS_TERMINAL_VT100_BOLD "\33[1m" -#define KWSYS_TERMINAL_VT100_UNDERLINE "\33[4m" -#define KWSYS_TERMINAL_VT100_BLINK "\33[5m" -#define KWSYS_TERMINAL_VT100_INVERSE "\33[7m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_BLACK "\33[30m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_RED "\33[31m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_GREEN "\33[32m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW "\33[33m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_BLUE "\33[34m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA "\33[35m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_CYAN "\33[36m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_WHITE "\33[37m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_BLACK "\33[40m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_RED "\33[41m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_GREEN "\33[42m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW "\33[43m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_BLUE "\33[44m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA "\33[45m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_CYAN "\33[46m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_WHITE "\33[47m" +#if defined(__MVS__) +/* if building on z/OS (aka MVS), assume we are using EBCDIC */ +# define ESCAPE_CHAR "\47" +#else +# define ESCAPE_CHAR "\33" +#endif + +#define KWSYS_TERMINAL_VT100_NORMAL ESCAPE_CHAR "[0m" +#define KWSYS_TERMINAL_VT100_BOLD ESCAPE_CHAR "[1m" +#define KWSYS_TERMINAL_VT100_UNDERLINE ESCAPE_CHAR "[4m" +#define KWSYS_TERMINAL_VT100_BLINK ESCAPE_CHAR "[5m" +#define KWSYS_TERMINAL_VT100_INVERSE ESCAPE_CHAR "[7m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_BLACK ESCAPE_CHAR "[30m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_RED ESCAPE_CHAR "[31m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_GREEN ESCAPE_CHAR "[32m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW ESCAPE_CHAR "[33m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_BLUE ESCAPE_CHAR "[34m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA ESCAPE_CHAR "[35m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_CYAN ESCAPE_CHAR "[36m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_WHITE ESCAPE_CHAR "[37m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_BLACK ESCAPE_CHAR "[40m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_RED ESCAPE_CHAR "[41m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_GREEN ESCAPE_CHAR "[42m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW ESCAPE_CHAR "[43m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_BLUE ESCAPE_CHAR "[44m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA ESCAPE_CHAR "[45m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_CYAN ESCAPE_CHAR "[46m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_WHITE ESCAPE_CHAR "[47m" /* Write VT100 escape sequences to the stream for the given color. */ static void kwsysTerminalSetVT100Color(FILE* stream, int color) diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx index 0385a3d..ef87436 100644 --- a/Source/kwsys/testCommandLineArguments.cxx +++ b/Source/kwsys/testCommandLineArguments.cxx @@ -77,7 +77,7 @@ int testCommandLineArguments(int argc, char* argv[]) int some_int_variable = 10; double some_double_variable = 10.10; char* some_string_variable = KWSYS_NULLPTR; - std::string some_stl_string_variable = ""; + std::string some_stl_string_variable; bool some_bool_variable = false; bool some_bool_variable1 = false; bool bool_arg1 = false; diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index e6f9701..0477d59 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -206,7 +206,7 @@ static bool CheckFileOperations() res = false; } - if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true)) { + if (!kwsys::SystemTools::Touch(testNewFile, true)) { std::cerr << "Problem with Touch for: " << testNewFile << std::endl; res = false; } @@ -415,7 +415,7 @@ static bool CheckFileOperations() res = false; } - kwsys::SystemTools::Touch(testNewFile.c_str(), true); + kwsys::SystemTools::Touch(testNewFile, true); if (!kwsys::SystemTools::RemoveADirectory(testNewDir)) { std::cerr << "Problem with RemoveADirectory for: " << testNewDir << std::endl; @@ -806,7 +806,7 @@ static bool CheckFind() const std::string testFindFile(TEST_SYSTEMTOOLS_BINARY_DIR "/" + testFindFileName); - if (!kwsys::SystemTools::Touch(testFindFile.c_str(), true)) { + if (!kwsys::SystemTools::Touch(testFindFile, true)) { std::cerr << "Problem with Touch for: " << testFindFile << std::endl; // abort here as the existence of the file only makes the test meaningful return false; diff --git a/Templates/MSBuild/nasm.xml b/Templates/MSBuild/nasm.xml index 92f8548..a5dcdd5 100644 --- a/Templates/MSBuild/nasm.xml +++ b/Templates/MSBuild/nasm.xml @@ -36,7 +36,7 @@ <DataSource Persistence="ProjectFile" ItemType="NASM" SourceType="Item"/> </StringProperty.DataSource> </StringProperty> - <StringProperty Name="OutputFormat" Category="Assembler Options" HelpUrl="http://www.nasm.us/doc/" DisplayName="Output File Name" Description="Specify Output Filename.-o [value]" Switch="-o [value]"/> + <StringProperty Name="OutputFormat" Category="Assembler Options" HelpUrl="http://www.nasm.us/doc/" DisplayName="Output File Name" Description="Specify Output Filename.-o [value]" Switch="-o "[value]""/> <BoolProperty Name="tasmmode" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="SciTech TASM compatible mode" Description="assemble in SciTech TASM compatible mode" Switch="-t"/> <EnumProperty Name="Outputswitch" Category="Assembler Options" HelpUrl="http://www.nasm.us/doc/" DisplayName="Output Switch" Description="Select the type of output format required. Linking Should be disabled for ELF and Binary ,else error will popup"> <EnumValue Name="0" DisplayName="Object File win32" Switch="-fwin32"/> @@ -48,8 +48,8 @@ <BoolProperty Name="GenerateDebugInformation" Category="Assembler Options" DisplayName="Generate Debug Information" Description="Generates Debug Information. (-g)" HelpUrl="http://www.nasm.us/doc/" Switch="-g"/> <StringListProperty Name="ErrorReporting" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Redirect Error Messages to File" Description="Drops the error Message on specified device" Switch="-Z "[value]""/> <StringListProperty Name="IncludePaths" Category="General" DisplayName="Include Paths" Description="Sets path for include file. (-I[path])" HelpUrl="http://www.nasm.us/doc/" Switch="-I"[value]""/> - <StringListProperty Name="PreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Preprocessor Definitions" Description="Defines a text macro with the given name. (-D[symbol])" Switch="-D[value]"/> - <StringListProperty Name="UndefinePreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Undefine Preprocessor Definitions" Description="Undefines a text macro with the given name. (-U[symbol])" Switch="-U[value]"/> + <StringListProperty Name="PreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Preprocessor Definitions" Description="Defines a text macro with the given name. (-D[symbol])" Switch="-D"[value]""/> + <StringListProperty Name="UndefinePreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Undefine Preprocessor Definitions" Description="Undefines a text macro with the given name. (-U[symbol])" Switch="-U"[value]""/> <EnumProperty Name="ErrorReportingFormat" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Error Reporting Format" Description="Select the error reporting format ie. GNU or VC"> <EnumValue Name="0" DisplayName="-Xgnu GNU format: Default format" Switch="-Xgnu"/> <EnumValue Name="1" DisplayName="-Xvc Style used by Microsoft Visual C++" Switch="-Xvc"/> diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 3b4ff60..39a5131 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -345,6 +345,17 @@ is not newer than dependency ${TEST_LINK_DEPENDS} ") endif() + + set(linkdep2 ${BuildDepends_BINARY_DIR}/Project/linkdep2${CMAKE_EXECUTABLE_SUFFIX}) + if(${linkdep2} IS_NEWER_THAN ${TEST_LINK_DEPENDS}) + message("INTERFACE_LINK_DEPENDS worked") + else() + message(SEND_ERROR "INTERFACE_LINK_DEPENDS failed. Executable + ${linkdep2} +is not newer than dependency + ${TEST_LINK_DEPENDS} +") + endif() endif() if(EXISTS "${link_depends_no_shared_check_txt}") diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 127b365..3f41b26 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -106,7 +106,12 @@ set_property( if(TEST_LINK_DEPENDS) add_executable(linkdep linkdep.cxx) - set_property(TARGET linkdep PROPERTY LINK_DEPENDS ${TEST_LINK_DEPENDS}) + set_property(TARGET linkdep PROPERTY LINK_DEPENDS $<1:${TEST_LINK_DEPENDS}>) + + add_library(foo_interface INTERFACE) + set_property(TARGET foo_interface PROPERTY INTERFACE_LINK_DEPENDS $<1:${TEST_LINK_DEPENDS}>) + add_executable(linkdep2 linkdep.cxx) + target_link_libraries(linkdep2 PRIVATE foo_interface) endif() add_library(link_depends_no_shared_lib SHARED link_depends_no_shared_lib.c diff --git a/Tests/CMakeCommands/add_link_options/CMakeLists.txt b/Tests/CMakeCommands/add_link_options/CMakeLists.txt new file mode 100644 index 0000000..bb7dcbb --- /dev/null +++ b/Tests/CMakeCommands/add_link_options/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.11) + +project(add_link_options LANGUAGES C) + + +add_link_options(-LINK_FLAG) + +add_executable(add_link_options EXCLUDE_FROM_ALL LinkOptionsExe.c) + +get_target_property(result add_link_options LINK_OPTIONS) +if (NOT result MATCHES "-LINK_FLAG") + message(SEND_ERROR "add_link_options not populated the LINK_OPTIONS target property") +endif() + + +add_library(imp UNKNOWN IMPORTED) +get_target_property(result imp LINK_OPTIONS) +if (result) + message(FATAL_ERROR "add_link_options populated the LINK_OPTIONS target property") +endif() diff --git a/Tests/CMakeCommands/add_link_options/LinkOptionsExe.c b/Tests/CMakeCommands/add_link_options/LinkOptionsExe.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/CMakeCommands/add_link_options/LinkOptionsExe.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_link_options/CMakeLists.txt b/Tests/CMakeCommands/target_link_options/CMakeLists.txt new file mode 100644 index 0000000..c66cd37 --- /dev/null +++ b/Tests/CMakeCommands/target_link_options/CMakeLists.txt @@ -0,0 +1,19 @@ + +cmake_minimum_required(VERSION 3.11) + +project(target_link_options LANGUAGES C) + +add_library(target_link_options SHARED LinkOptionsLib.c) +# Test no items +target_link_options(target_link_options PRIVATE) + +add_library(target_link_options_2 SHARED EXCLUDE_FROM_ALL LinkOptionsLib.c) +target_link_options(target_link_options_2 PRIVATE -PRIVATE_FLAG INTERFACE -INTERFACE_FLAG) +get_target_property(result target_link_options_2 LINK_OPTIONS) +if (NOT result MATCHES "-PRIVATE_FLAG") + message(SEND_ERROR "target_link_options not populated the LINK_OPTIONS target property") +endif() +get_target_property(result target_link_options_2 INTERFACE_LINK_OPTIONS) +if (NOT result MATCHES "-INTERFACE_FLAG") + message(SEND_ERROR "target_link_options not populated the INTERFACE_LINK_OPTIONS target property") +endif() diff --git a/Tests/CMakeCommands/target_link_options/LinkOptionsLib.c b/Tests/CMakeCommands/target_link_options/LinkOptionsLib.c new file mode 100644 index 0000000..9bbd24c --- /dev/null +++ b/Tests/CMakeCommands/target_link_options/LinkOptionsLib.c @@ -0,0 +1,7 @@ +#if defined(_WIN32) +__declspec(dllexport) +#endif + int flags_lib(void) +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_sources/CMakeLists.txt b/Tests/CMakeCommands/target_sources/CMakeLists.txt new file mode 100644 index 0000000..ab14855 --- /dev/null +++ b/Tests/CMakeCommands/target_sources/CMakeLists.txt @@ -0,0 +1,36 @@ + +cmake_minimum_required(VERSION 3.12) +cmake_policy(SET CMP0076 NEW) + +project(target_sources) + +add_library(target_sources_lib) +target_compile_definitions(target_sources_lib PRIVATE "-DIS_LIB") +add_subdirectory(subdir) + +set(subdir_fullpath "${CMAKE_CURRENT_LIST_DIR}/subdir") + +get_property(target_sources_lib_property TARGET target_sources_lib PROPERTY SOURCES) +if (NOT "$<1:${subdir_fullpath}/subdir_empty_1.cpp>" IN_LIST target_sources_lib_property) + message(SEND_ERROR "target_sources_lib: Generator expression to absolute sub directory file not found") +endif() +if (NOT "$<1:${subdir_fullpath}/../empty_1.cpp>" IN_LIST target_sources_lib_property) + message(SEND_ERROR "target_sources_lib: Generator expression to absolute main directory file not found") +endif() +if (NOT "${subdir_fullpath}/subdir_empty_2.cpp" IN_LIST target_sources_lib_property) + message(SEND_ERROR "target_sources_lib: Relative sub directory file not converted to absolute") +endif() +if (NOT "$<1:empty_2.cpp>" IN_LIST target_sources_lib_property) + message(SEND_ERROR "target_sources_lib: Generator expression to relative main directory file not found") +endif() +if (NOT "${subdir_fullpath}/../empty_3.cpp" IN_LIST target_sources_lib_property) + message(SEND_ERROR "target_sources_lib: Relative main directory file not converted to absolute") +endif() + +add_executable(target_sources main.cpp) +target_link_libraries(target_sources target_sources_lib) + +get_property(target_sources_property TARGET target_sources PROPERTY SOURCES) +if (NOT "main.cpp" IN_LIST target_sources_property) + message(SEND_ERROR "target_sources: Relative main directory file converted to absolute") +endif() diff --git a/Tests/CMakeCommands/target_sources/empty_1.cpp b/Tests/CMakeCommands/target_sources/empty_1.cpp new file mode 100644 index 0000000..01e5b07 --- /dev/null +++ b/Tests/CMakeCommands/target_sources/empty_1.cpp @@ -0,0 +1,21 @@ +#ifdef IS_LIB + +# ifdef _WIN32 +__declspec(dllexport) +# endif + int internal_empty_1() +{ + return 0; +} + +#else + +# ifdef _WIN32 +__declspec(dllexport) +# endif + int empty_1() +{ + return 0; +} + +#endif diff --git a/Tests/CMakeCommands/target_sources/empty_2.cpp b/Tests/CMakeCommands/target_sources/empty_2.cpp new file mode 100644 index 0000000..48ae8bb --- /dev/null +++ b/Tests/CMakeCommands/target_sources/empty_2.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty_2() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_sources/empty_3.cpp b/Tests/CMakeCommands/target_sources/empty_3.cpp new file mode 100644 index 0000000..bd3a6d1 --- /dev/null +++ b/Tests/CMakeCommands/target_sources/empty_3.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty_3() +{ + return 0; +} diff --git a/Tests/CMakeCommands/target_sources/main.cpp b/Tests/CMakeCommands/target_sources/main.cpp new file mode 100644 index 0000000..622771c --- /dev/null +++ b/Tests/CMakeCommands/target_sources/main.cpp @@ -0,0 +1,16 @@ +#include <iostream> + +int empty_1(); +int subdir_empty_1(); +int subdir_empty_2(); + +int main() +{ + int e1 = empty_1(); + int se1 = subdir_empty_1(); + int se2 = subdir_empty_2(); + + std::cout << e1 << " " << se1 << " " << se2 << std::endl; + + return 0; +} diff --git a/Tests/CMakeCommands/target_sources/subdir/CMakeLists.txt b/Tests/CMakeCommands/target_sources/subdir/CMakeLists.txt new file mode 100644 index 0000000..f749f1d --- /dev/null +++ b/Tests/CMakeCommands/target_sources/subdir/CMakeLists.txt @@ -0,0 +1,6 @@ + +target_sources(target_sources_lib PUBLIC $<1:${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp> + $<1:${CMAKE_CURRENT_LIST_DIR}/../empty_1.cpp> + subdir_empty_2.cpp + PRIVATE $<1:empty_2.cpp> + ../empty_3.cpp) diff --git a/Tests/CMakeCommands/target_sources/subdir/subdir_empty_1.cpp b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_1.cpp new file mode 100644 index 0000000..3c61321 --- /dev/null +++ b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_1.cpp @@ -0,0 +1,21 @@ +#ifdef IS_LIB + +# ifdef _WIN32 +__declspec(dllexport) +# endif + int internal_subdir_empty_1() +{ + return 0; +} + +#else + +# ifdef _WIN32 +__declspec(dllexport) +# endif + int subdir_empty_1() +{ + return 0; +} + +#endif diff --git a/Tests/CMakeCommands/target_sources/subdir/subdir_empty_2.cpp b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_2.cpp new file mode 100644 index 0000000..47fa736 --- /dev/null +++ b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_2.cpp @@ -0,0 +1,21 @@ +#ifdef IS_LIB + +# ifdef _WIN32 +__declspec(dllexport) +# endif + int internal_subdir_empty_2() +{ + return 0; +} + +#else + +# ifdef _WIN32 +__declspec(dllexport) +# endif + int subdir_empty_2() +{ + return 0; +} + +#endif diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect index 1ffd6b9..d7b91d1 100644 --- a/Tests/CMakeLib/testRST.expect +++ b/Tests/CMakeLib/testRST.expect @@ -19,6 +19,7 @@ Variable ``VARIABLE_<PLACEHOLDER>`` with trailing placeholder and target. Environment variable ``SOME_ENV_VAR``. Environment variable ``some env var`` with space and target. Generator ``Some Generator`` with space. +Generator ``Some Generator`` with space. Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``. Inline link Link Text. Inline link Link Text <With \-escaped Brackets>. diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst index c8587c0..633219f 100644 --- a/Tests/CMakeLib/testRST.rst +++ b/Tests/CMakeLib/testRST.rst @@ -26,6 +26,7 @@ Variable :variable:`VARIABLE_<PLACEHOLDER> <target>` with trailing placeholder a Environment variable :envvar:`SOME_ENV_VAR`. Environment variable :envvar:`some env var <SOME_ENV_VAR>` with space and target. Generator :generator:`Some Generator` with space. +Generator :cpack_gen:`Some Generator` with space. Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``. Inline link `Link Text <ExternalDest>`_. Inline link `Link Text \<With \\-escaped Brackets\> <ExternalDest>`_. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b8b724e..971d7ff 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -869,33 +869,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends") - set(SimpleInstallInstallDir - "${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory") - add_test(SimpleInstall ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/SimpleInstall" - "${CMake_BINARY_DIR}/Tests/SimpleInstall" - ${build_generator_args} - --build-project TestSimpleInstall - --build-two-config - --build-options ${build_options} - "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" - "-DCTEST_TEST_CPACK:BOOL=${CTEST_TEST_CPACK}" - --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstall") - add_test(SimpleInstall-Stage2 ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/SimpleInstallS2" - "${CMake_BINARY_DIR}/Tests/SimpleInstallS2" - ${build_generator_args} - --build-project TestSimpleInstall - --build-two-config - --build-options ${build_options} - "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" - "-DSTAGE2:BOOL=1" - --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2") - set(MissingInstallInstallDir "${CMake_BINARY_DIR}/Tests/MissingInstall/InstallDirectory") add_test(MissingInstall ${CMAKE_CTEST_COMMAND} @@ -1821,7 +1794,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_tests_properties ( testdriver2 PROPERTIES DEPENDS testdriver1) set_tests_properties ( testdriver3 PROPERTIES DEPENDS testdriver2) set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1) - set_tests_properties ( SimpleInstall-Stage2 PROPERTIES DEPENDS SimpleInstall) # Test static linking on toolchains known to support it. if(CMAKE_C_COMPILER_ID STREQUAL "GNU" @@ -1940,6 +1912,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release message(STATUS ".vcproj file association indicates VCExpress, avoiding MFC test") set(CTEST_RUN_MFC OFF) + elseif( NOT ov ) + message(STATUS + ".vcproj has no file association, avoiding MFC test") + set(CTEST_RUN_MFC OFF) endif() endif() @@ -2256,7 +2232,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-generator "Green Hills MULTI" --build-project ReturnNum --build-config $<CONFIGURATION> - --build-options -DGHS_PRIMARY_TARGET="arm_integrity.tgt" + --build-options -DGHS_PRIMARY_TARGET=arm_integrity.tgt -DGHS_BSP_NAME="simarm" ) endif () @@ -2843,6 +2819,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories) ADD_TEST_MACRO(CMakeCommands.target_compile_definitions target_compile_definitions) ADD_TEST_MACRO(CMakeCommands.target_compile_options target_compile_options) + ADD_TEST_MACRO(CMakeCommands.target_sources target_sources) + + ADD_TEST_MACRO(CMakeCommands.add_link_options) + ADD_TEST_MACRO(CMakeCommands.target_link_options) # The cmake server-mode test requires python for a simple client. find_package(PythonInterp QUIET) @@ -3437,10 +3417,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) endif() - add_test(NAME CMakeWizardTest COMMAND cmake -i) - set_property(TEST CMakeWizardTest PROPERTY PASS_REGULAR_EXPRESSION - "The \"cmake -i\" wizard mode is no longer supported.") - # Define a set of "contract" tests, each activated by a cache entry # named "CMake_TEST_CONTRACT_<project>". For each Contract test, # the project should provide a directory with a CMakeLists.txt file diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index 76f5e4f..f517e64 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -53,6 +53,10 @@ set(result andy brad) list(INSERT result -1 bill ken) TEST("INSERT result -1 bill ken" "andy;bill;ken;brad") +set(result andy brad) +list(INSERT result 2 bill ken) +TEST("INSERT result 2 bill ken" "andy;brad;bill;ken") + set(result andy bill brad ken bob) list(REMOVE_ITEM result bob) TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index 59f3e84..5b7c0e6 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -1,4 +1,5 @@ +ADD_TEST_MACRO(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine) ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard) ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX) ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag) diff --git a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt new file mode 100644 index 0000000..c978e51 --- /dev/null +++ b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.7) +project (CudaOnlyCircularLinkLine CUDA) + +#Goal for this example: +# Verify that we de-duplicate the device link line +# Verify that a de-duplicated link line still works with circular static libraries + +string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30]") +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CUDA_STANDARD 11) + +add_library(CUDACircularDeviceLinking1 STATIC file1.cu) +add_library(CUDACircularDeviceLinking2 STATIC file2.cu) +add_library(CUDACircularDeviceLinking3 STATIC file3.cu) +add_executable(CudaOnlyCircularLinkLine main.cu) + +target_link_libraries(CUDACircularDeviceLinking1 PUBLIC CUDACircularDeviceLinking2) +target_link_libraries(CUDACircularDeviceLinking2 PUBLIC CUDACircularDeviceLinking3) +target_link_libraries(CUDACircularDeviceLinking3 PUBLIC CUDACircularDeviceLinking1) + +target_link_libraries(CudaOnlyCircularLinkLine PRIVATE CUDACircularDeviceLinking3) + + +set_target_properties(CUDACircularDeviceLinking1 + PROPERTIES + CUDA_SEPARABLE_COMPILATION ON) + +set_target_properties(CUDACircularDeviceLinking2 + PROPERTIES + CUDA_SEPARABLE_COMPILATION ON) + +set_target_properties(CUDACircularDeviceLinking3 + PROPERTIES + CUDA_SEPARABLE_COMPILATION ON) diff --git a/Tests/CudaOnly/CircularLinkLine/file1.cu b/Tests/CudaOnly/CircularLinkLine/file1.cu new file mode 100644 index 0000000..88ac4e3 --- /dev/null +++ b/Tests/CudaOnly/CircularLinkLine/file1.cu @@ -0,0 +1,6 @@ + +extern __device__ int file2_func(int); +int __device__ file1_func(int x) +{ + return file2_func(x); +} diff --git a/Tests/CudaOnly/CircularLinkLine/file2.cu b/Tests/CudaOnly/CircularLinkLine/file2.cu new file mode 100644 index 0000000..b32dbff --- /dev/null +++ b/Tests/CudaOnly/CircularLinkLine/file2.cu @@ -0,0 +1,6 @@ + +extern __device__ int file3_func(int); +int __device__ file2_func(int x) +{ + return x + file3_func(x); +} diff --git a/Tests/CudaOnly/CircularLinkLine/file3.cu b/Tests/CudaOnly/CircularLinkLine/file3.cu new file mode 100644 index 0000000..7f67187 --- /dev/null +++ b/Tests/CudaOnly/CircularLinkLine/file3.cu @@ -0,0 +1,8 @@ + +extern __device__ int file1_func(int); +int __device__ file3_func(int x) +{ + if (x > 0) + return file1_func(-x); + return x; +} diff --git a/Tests/CudaOnly/CircularLinkLine/main.cu b/Tests/CudaOnly/CircularLinkLine/main.cu new file mode 100644 index 0000000..1c19e8d --- /dev/null +++ b/Tests/CudaOnly/CircularLinkLine/main.cu @@ -0,0 +1,5 @@ + +int main(int argc, char** argv) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 0f1a556..fdb2fa1 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -510,9 +510,9 @@ install( cmp0022NEW cmp0022OLD systemlib EXPORT exp - RUNTIME DESTINATION $<1:bin> - LIBRARY DESTINATION $<1:lib> NAMELINK_SKIP - ARCHIVE DESTINATION $<1:lib> + RUNTIME DESTINATION $<1:bin>$<0:/wrong> + LIBRARY DESTINATION $<1:lib>$<0:/wrong> NAMELINK_SKIP + ARCHIVE DESTINATION $<1:lib>$<0:/wrong> ${maybe_OBJECTS_DESTINATION} FRAMEWORK DESTINATION Frameworks BUNDLE DESTINATION Applications @@ -597,3 +597,27 @@ install( ) install(DIRECTORY $<1:include/abs>$<0:/wrong> DESTINATION $<1:include>$<0:/wrong>) install(EXPORT expAbs NAMESPACE expAbs_ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/expAbs) + + +#------------------------------------------------------------------------------ +# test export of INTERFACE_LINK_OPTIONS +add_library(testLinkOptions INTERFACE) +target_link_options(testLinkOptions INTERFACE INTERFACE_FLAG) + +install(TARGETS testLinkOptions + EXPORT RequiredExp DESTINATION lib) +export(TARGETS testLinkOptions NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake) + + +#------------------------------------------------------------------------------ +# test export of INTERFACE_LINK_DEPENDS +if(CMAKE_GENERATOR MATCHES "Make|Ninja") + add_library(testLinkDepends INTERFACE) + set_property(TARGET testLinkDepends PROPERTY INTERFACE_LINK_DEPENDS + $<BUILD_INTERFACE:BUILD_LINK_DEPENDS> + $<INSTALL_INTERFACE:INSTALL_LINK_DEPENDS>) + + install(TARGETS testLinkDepends + EXPORT RequiredExp DESTINATION lib) + export(TARGETS testLinkDepends NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake) +endif() diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 39a89dc..7510d7e 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -472,3 +472,15 @@ if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREA endif() endif() endif() + +#--------------------------------------------------------------------------------- +# check that imported libraries have the expected INTERFACE_LINK_OPTIONS property +checkForProperty(bld_testLinkOptions "INTERFACE_LINK_OPTIONS" "INTERFACE_FLAG") +checkForProperty(Req::testLinkOptions "INTERFACE_LINK_OPTIONS" "INTERFACE_FLAG") + +#--------------------------------------------------------------------------------- +# check that imported libraries have the expected INTERFACE_LINK_DEPENDS property +if(CMAKE_GENERATOR MATCHES "Make|Ninja") + checkForProperty(bld_testLinkDepends "INTERFACE_LINK_DEPENDS" "BUILD_LINK_DEPENDS") + checkForProperty(Req::testLinkDepends "INTERFACE_LINK_DEPENDS" "${CMAKE_INSTALL_PREFIX}/INSTALL_LINK_DEPENDS") +endif() diff --git a/Tests/ExportImport/Import/A/imp_testLinkOptions.cpp b/Tests/ExportImport/Import/A/imp_testLinkOptions.cpp new file mode 100644 index 0000000..2b18b2e --- /dev/null +++ b/Tests/ExportImport/Import/A/imp_testLinkOptions.cpp @@ -0,0 +1,8 @@ + +#include "testSharedLibRequired.h" + +int foo() +{ + TestSharedLibRequired req; + return req.foo(); +} diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt index f764b3a..5403d29 100644 --- a/Tests/MathTest/CMakeLists.txt +++ b/Tests/MathTest/CMakeLists.txt @@ -13,14 +13,35 @@ set(expressions "-1 + +1" "+1 - -1" "+1 - - + + -(-3 + - - +1)" + "1000 -12*5" + "1000 +12*-5" + "1000 -12*-5" ) -set(FILE_EXPRESSIONS "") -foreach(expression - ${expressions}) - math(EXPR expr "${expression}") - string(APPEND FILE_EXPRESSIONS "TEST_EXPRESSION(${expression}, ${expr})\n") -endforeach() +set(FILE_EXPRESSIONS "extern void test_expression(int x, int y, const char * text);\n") + + +macro(add_math_test expression) + math(EXPR result ${expression} ${ARGV1} ${ARGV2}) + set(CODE "test_expression(${expression}, ${result}, \"${expression}\");") + string(APPEND FILE_EXPRESSIONS "${CODE}\n") +endmacro() + +macro(add_math_tests) + foreach (expression ${expressions}) + add_math_test(${expression} ${ARGV0} ${ARGV1}) + endforeach () +endmacro() + +add_math_tests() +add_math_tests("OUTPUT_FORMAT" "DECIMAL") +add_math_tests("OUTPUT_FORMAT" "HEXADECIMAL") + +# Avoid the test with negative result and hexadecimal formatting +# therefore more tests with a negative result +add_math_test("-12*5") +add_math_test("12*-5") + configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/MathTestTests.h.in" diff --git a/Tests/MathTest/MathTestExec.cxx b/Tests/MathTest/MathTestExec.cxx index 124eba4..fbcddc4 100644 --- a/Tests/MathTest/MathTestExec.cxx +++ b/Tests/MathTest/MathTestExec.cxx @@ -1,21 +1,43 @@ #include <stdio.h> +#include <stdlib.h> +#include <string.h> -#define TEST_EXPRESSION(x, y) \ - if ((x) != (y)) { \ - printf("Problem with EXPR: Expression: \"%s\" in C returns %d while in " \ - "CMake returns: %d\n", \ - #x, (x), (y)); \ - res++; \ +int res = 0; +bool print = false; + +void test_expression(int x, int y, const char* text) +{ + bool fail = (x) != (y); + if (fail) { + res++; + printf("Problem with EXPR:"); + } + if (fail || print) { + printf("Expression: \"%s\" in CMake returns %d", text, (y)); + if (fail) { + printf(" while in C returns: %d", (x)); + } + printf("\n"); } +} int main(int argc, char* argv[]) { - if (argc > 1) { - printf("Usage: %s\n", argv[0]); + if (argc > 2) { + printf("Usage: %s [print]\n", argv[0]); return 1; } - int res = 0; + + if (argc > 1) { + if (strcmp(argv[1], "print") != 0) { + printf("Usage: %s [print]\n", argv[0]); + return 1; + } + print = true; + } + #include "MathTestTests.h" + if (res != 0) { printf("%s: %d math tests failed\n", argv[0], res); return 1; diff --git a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt index 0bb0339..6fad80c 100644 --- a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt +++ b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt @@ -16,6 +16,7 @@ try_compile(MOC_RERUN "${mocBasicSrcDir}" MocBasic CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" OUTPUT_VARIABLE output ) diff --git a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt index 8a89b38..b5287c1 100644 --- a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt +++ b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt @@ -19,6 +19,7 @@ try_compile(MOC_PLUGIN "${mocPlugSrcDir}" MocPlugin CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" OUTPUT_VARIABLE output ) diff --git a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt index f09865d..4dc24fe 100644 --- a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt +++ b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt @@ -19,6 +19,7 @@ try_compile(RCC_DEPENDS "${rccDepSD}" RccConfigChange CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" OUTPUT_VARIABLE output ) diff --git a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt index 52e2488..4268de2 100644 --- a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt +++ b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt @@ -21,6 +21,7 @@ try_compile(RCC_DEPENDS "${rccDepSD}" RccDepends CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" OUTPUT_VARIABLE output ) diff --git a/Tests/QtAutogen/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake index bc7c7e2..8e4bea2 100644 --- a/Tests/QtAutogen/TestMacros.cmake +++ b/Tests/QtAutogen/TestMacros.cmake @@ -4,6 +4,7 @@ if(NOT _isMultiConfig) # Set in Tests/CMakeLists.txt list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_BUILD_TYPE=$<CONFIGURATION>") endif() list(APPEND Autogen_BUILD_OPTIONS + "-DCMAKE_AUTOGEN_VERBOSE=1" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" ) diff --git a/Tests/RunCMake/AndroidMK/AndroidMK.cmake b/Tests/RunCMake/AndroidMK/AndroidMK.cmake index 3fbb2cf..9137f2b 100644 --- a/Tests/RunCMake/AndroidMK/AndroidMK.cmake +++ b/Tests/RunCMake/AndroidMK/AndroidMK.cmake @@ -5,7 +5,9 @@ add_library(car foo.cxx) add_library(bar bar.c) add_library(dog foo.cxx) target_link_libraries(foo PRIVATE car bar dog debug -lm) -export(TARGETS bar dog car foo ANDROID_MK +add_library(foo2 foo.cxx) +target_link_options(foo2 INTERFACE -lm) +export(TARGETS bar dog car foo foo2 ANDROID_MK ${build_BINARY_DIR}/Android.mk) -install(TARGETS bar dog car foo DESTINATION lib EXPORT myexp) +install(TARGETS bar dog car foo foo2 DESTINATION lib EXPORT myexp) install(EXPORT_ANDROID_MK myexp DESTINATION share/ndk-modules) diff --git a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt index bbf67a5..a0e5044 100644 --- a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt +++ b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt @@ -24,3 +24,11 @@ LOCAL_STATIC_LIBRARIES.*car bar dog LOCAL_EXPORT_LDLIBS := -lm LOCAL_HAS_CPP := true include.*PREBUILT_STATIC_LIBRARY.* +.* +include.*CLEAR_VARS.* +LOCAL_MODULE.*foo2 +LOCAL_SRC_FILES.*.*foo2.* +LOCAL_CPP_FEATURES.*rtti exceptions +LOCAL_EXPORT_LDFLAGS := -lm +LOCAL_HAS_CPP := true +include.*PREBUILT_STATIC_LIBRARY.* diff --git a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt index 3515fb9..28b1c21 100644 --- a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt +++ b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt @@ -26,3 +26,11 @@ LOCAL_STATIC_LIBRARIES.*car bar dog LOCAL_EXPORT_LDLIBS := -lm LOCAL_HAS_CPP := true include.*PREBUILT_STATIC_LIBRARY.* + +include.*CLEAR_VARS.* +LOCAL_MODULE.*foo2 +LOCAL_SRC_FILES.*_IMPORT_PREFIX\)/lib.*foo2.* +LOCAL_CPP_FEATURES.*rtti exceptions +LOCAL_EXPORT_LDFLAGS := -lm +LOCAL_HAS_CPP := true +include.*PREBUILT_STATIC_LIBRARY.* diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bb46144..97c3178 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -238,7 +238,9 @@ add_RunCMake_test(include) add_RunCMake_test(include_directories) add_RunCMake_test(include_guard) add_RunCMake_test(list) +add_RunCMake_test(math) add_RunCMake_test(message) +add_RunCMake_test(option) add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES}) add_RunCMake_test(return) add_RunCMake_test(separate_arguments) @@ -332,6 +334,8 @@ endif() add_RunCMake_test(File_Generate) add_RunCMake_test(ExportWithoutLanguage) add_RunCMake_test(target_link_libraries) +add_RunCMake_test(add_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) +add_RunCMake_test(target_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) add_RunCMake_test(target_compile_features) add_RunCMake_test(CheckModules) @@ -420,7 +424,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_RunCMake_test(ctest_labels_for_subprojects) endif() -add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ") +add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext") # add a test to make sure symbols are exported from a shared library # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used add_RunCMake_test(AutoExportDll) diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index 447b08b..8c9f4b4 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -1,10 +1,14 @@ cmake_policy(SET CMP0057 NEW) -function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE) +function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE package_target) if(TEST_TYPE IN_LIST types) set(RunCMake_TEST_NO_CLEAN TRUE) - set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") - set(full_test_name_ "${TEST_NAME}") + if(package_target) + set(full_test_name_ "${TEST_NAME}-package-target") + else() + set(full_test_name_ "${TEST_NAME}") + endif() + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${full_test_name_}-build") if(SUBTEST_SUFFIX) set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_BINARY_DIR}-${SUBTEST_SUFFIX}-subtest") @@ -67,9 +71,15 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK unset(pack_params_) endif() + if(package_target) + set(cpack_command_ ${CMAKE_COMMAND} --build "${RunCMake_TEST_BINARY_DIR}" --target package) + else() + set(cpack_command_ ${CMAKE_CPACK_COMMAND} ${pack_params_}) + endif() + # execute cpack execute_process( - COMMAND ${CMAKE_CPACK_COMMAND} ${pack_params_} + COMMAND ${cpack_command_} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" RESULT_VARIABLE "result_" OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" @@ -113,18 +123,24 @@ endfunction() function(run_cpack_test TEST_NAME types build PACKAGING_TYPES) foreach(packaging_type_ IN LISTS PACKAGING_TYPES) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}") + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" false) + endforeach() +endfunction() + +function(run_cpack_test_package_target TEST_NAME types build PACKAGING_TYPES) + foreach(packaging_type_ IN LISTS PACKAGING_TYPES) + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" true) endforeach() endfunction() function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build PACKAGING_TYPES) foreach(suffix_ IN LISTS SUBTEST_SUFFIXES) foreach(packaging_type_ IN LISTS PACKAGING_TYPES) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}") + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}" false) endforeach() endforeach() endfunction() function(run_cpack_source_test TEST_NAME types) - run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "") + run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "" false) endfunction() diff --git a/Tests/RunCMake/CPack/Ext/Helpers.cmake b/Tests/RunCMake/CPack/Ext/Helpers.cmake new file mode 100644 index 0000000..2c67e06 --- /dev/null +++ b/Tests/RunCMake/CPack/Ext/Helpers.cmake @@ -0,0 +1,31 @@ +function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR) + set(${RESULT_VAR} "${NAME}-${VERSION}-*.json" PARENT_SCOPE) +endfunction() + +function(getPackageContentList FILE RESULT_VAR) + set("${RESULT_VAR}" "" PARENT_SCOPE) +endfunction() + +function(toExpectedContentList FILE_NO CONTENT_VAR) + set("${CONTENT_VAR}" "" PARENT_SCOPE) +endfunction() + +set(ALL_FILES_GLOB "*.json") + +function(check_ext_json EXPECTED_FILE ACTUAL_FILE) + file(READ "${EXPECTED_FILE}" _expected_regex) + file(READ "${ACTUAL_FILE}" _actual_contents) + + string(REGEX REPLACE "\n+$" "" _expected_regex "${_expected_regex}") + string(REGEX REPLACE "\n+$" "" _actual_contents "${_actual_contents}") + + if(NOT "${_actual_contents}" MATCHES "${_expected_regex}") + message(FATAL_ERROR + "Output JSON does not match expected regex.\n" + "Expected regex:\n" + "${_expected_regex}\n" + "Actual output:\n" + "${_actual_contents}\n" + ) + endif() +endfunction() diff --git a/Tests/RunCMake/CPack/Ext/Prerequirements.cmake b/Tests/RunCMake/CPack/Ext/Prerequirements.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CPack/Ext/Prerequirements.cmake diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt index 4a0e4e6..f02f9d6 100644 --- a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt +++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt @@ -1 +1 @@ -^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ +^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index 4b7f146..33ffa14 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -18,7 +18,8 @@ run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT") run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT") run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC") run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false "COMPONENT") -run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ" false "MONOLITHIC;COMPONENT") +run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext" false "MONOLITHIC;COMPONENT") +run_cpack_test_package_target(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;Ext" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC") run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false "COMPONENT") run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false "COMPONENT") @@ -31,3 +32,4 @@ run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC") run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT") run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC") run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB" false "MONOLITHIC;COMPONENT") +run_cpack_test_subtests(EXT "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad" "Ext" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 1f5ab87..af12d37 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -56,8 +56,12 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0) set(EXPECTED_FILE_CONTENT_${file_no_} "${EXPECTED_FILE_CONTENT_${file_no_}_LIST}") toExpectedContentList("${file_no_}" "EXPECTED_FILE_CONTENT_${file_no_}") - list(SORT PACKAGE_CONTENT) - list(SORT EXPECTED_FILE_CONTENT_${file_no_}) + if(NOT PACKAGE_CONTENT STREQUAL "") + list(SORT PACKAGE_CONTENT) + endif() + if(NOT EXPECTED_FILE_CONTENT_${file_no_} STREQUAL "") + list(SORT EXPECTED_FILE_CONTENT_${file_no_}) + endif() if(PACKAGE_CONTENT STREQUAL EXPECTED_FILE_CONTENT_${file_no_}) set(expected_content_list TRUE) diff --git a/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake new file mode 100644 index 0000000..2634111 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake @@ -0,0 +1,6 @@ +if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)$") + set(EXPECTED_FILES_COUNT "1") + set(EXPECTED_FILE_CONTENT_1_LIST "/share;/share/cpack-test;/share/cpack-test/f1.txt;/share/cpack-test/f2.txt;/share/cpack-test/f3.txt;/share/cpack-test/f4.txt") +else() + set(EXPECTED_FILES_COUNT "0") +endif() diff --git a/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake new file mode 100644 index 0000000..97b74f7 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/VerifyResult.cmake @@ -0,0 +1,3 @@ +if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)") + check_ext_json("${src_dir}/tests/EXT/expected-json-1.0.txt" "${FOUND_FILE_1}") +endif() diff --git a/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/bad_major-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/bad_minor-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt b/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt new file mode 100644 index 0000000..b96cf0b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/expected-json-1.0.txt @@ -0,0 +1,176 @@ +^\{ + "componentGroups" :[ ] + \{ + "f12" :[ ] + \{ + "components" :[ ] + \[ + "f1", + "f2" + \], + "description" : "Component group for files 1 and 2", + "displayName" : "Files 1 and 2", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f12", + "parentGroup" : "f1234", + "subgroups" : \[\] + \}, + "f1234" :[ ] + \{ + "components" : \[\], + "description" : "Component group for all files", + "displayName" : "Files 1-4", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f1234", + "subgroups" :[ ] + \[ + "f12", + "f34" + \] + \}, + "f34" :[ ] + \{ + "components" :[ ] + \[ + "f3", + "f4" + \], + "description" : "Component group for files 3 and 4", + "displayName" : "Files 3 and 4", + "isBold" : false, + "isExpandedByDefault" : false, + "name" : "f34", + "parentGroup" : "f1234", + "subgroups" : \[\] + \} + \}, + "components" :[ ] + \{ + "f1" :[ ] + \{ + "archiveFile" : "", + "dependencies" : \[\], + "description" : "Component for file 1", + "displayName" : "File 1", + "group" : "f12", + "installationTypes" :[ ] + \[ + "full", + "f12" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f1" + \}, + "f2" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f1" + \], + "description" : "Component for file 2", + "displayName" : "File 2", + "group" : "f12", + "installationTypes" :[ ] + \[ + "full", + "f12" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f2" + \}, + "f3" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f1", + "f2" + \], + "description" : "Component for file 3", + "displayName" : "File 3", + "group" : "f34", + "installationTypes" :[ ] + \[ + "full" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f3" + \}, + "f4" :[ ] + \{ + "archiveFile" : "", + "dependencies" :[ ] + \[ + "f2", + "f3", + "f1" + \], + "description" : "Component for file 4", + "displayName" : "File 4", + "group" : "f34", + "installationTypes" :[ ] + \[ + "full" + \], + "isDisabledByDefault" : false, + "isDownloaded" : false, + "isHidden" : false, + "isRequired" : false, + "name" : "f4" + \} + \}, + "errorOnAbsoluteInstallDestination" : false, + "formatVersionMajor" : 1, + "formatVersionMinor" : 0, + "installationTypes" :[ ] + \{ + "f12" :[ ] + \{ + "displayName" : "Only files 1 and 2", + "index" : 2, + "name" : "f12" + \}, + "full" :[ ] + \{ + "displayName" : "Full installation", + "index" : 1, + "name" : "full" + \} + \}, + "packageDescriptionFile" : ".*/Templates/CPack\.GenericDescription\.txt", + "packageDescriptionSummary" : "EXT-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type built using CMake", + "packageName" : "ext", + "packageVersion" : "0\.1\.1", + "projects" :[ ] + \[ + \{ + "component" : "ALL", + "components" :[ ] + \[ + "f1", + "f2", + "f3", + "f4" + \], + "directory" : ".*/Tests/RunCMake/Ext/CPack/EXT-build-(none|good(_multi)?|invalid_good)-subtest", + "installationTypes" : \[\], + "projectName" : "EXT-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type", + "subDirectory" : "/" + \} + \], + "setDestdir" : false, + "stripFiles" : false, + "warnOnAbsoluteInstallDestination" : false +\}$ diff --git a/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt new file mode 100644 index 0000000..372c5e4 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/invalid_bad-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/Internal/CPack/CPackExt\.cmake:[0-9]+ \(message\): + Could not find a suitable version in CPACK_EXT_REQUESTED_VERSIONS + + +CPack Error: Error while executing CPackExt\.cmake +CPack Error: Cannot initialize the generator Ext diff --git a/Tests/RunCMake/CPack/tests/EXT/test.cmake b/Tests/RunCMake/CPack/tests/EXT/test.cmake new file mode 100644 index 0000000..6bd3cb8 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/test.cmake @@ -0,0 +1,83 @@ +include(CPackComponent) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "none") + unset(CPACK_EXT_REQUESTED_VERSIONS) +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good") + set(CPACK_EXT_REQUESTED_VERSIONS "1.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good_multi") + set(CPACK_EXT_REQUESTED_VERSIONS "1.0;2.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_major") + set(CPACK_EXT_REQUESTED_VERSIONS "2.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_minor") + set(CPACK_EXT_REQUESTED_VERSIONS "1.1") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_good") + set(CPACK_EXT_REQUESTED_VERSIONS "1;1.0") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad") + set(CPACK_EXT_REQUESTED_VERSIONS "1") +endif() + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" test2) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" test3) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" test4) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" DESTINATION share/cpack-test COMPONENT f1) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" DESTINATION share/cpack-test COMPONENT f2) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" DESTINATION share/cpack-test COMPONENT f3) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" DESTINATION share/cpack-test COMPONENT f4) + +cpack_add_component(f1 + DISPLAY_NAME "File 1" + DESCRIPTION "Component for file 1" + GROUP f12 + INSTALL_TYPES full f12 +) + +cpack_add_component(f2 + DISPLAY_NAME "File 2" + DESCRIPTION "Component for file 2" + GROUP f12 + DEPENDS f1 + INSTALL_TYPES full f12 +) + +cpack_add_component(f3 + DISPLAY_NAME "File 3" + DESCRIPTION "Component for file 3" + GROUP f34 + DEPENDS f1 f2 + INSTALL_TYPES full +) + +cpack_add_component(f4 + DISPLAY_NAME "File 4" + DESCRIPTION "Component for file 4" + GROUP f34 + DEPENDS f2 f3 f1 + INSTALL_TYPES full +) + +cpack_add_component_group(f12 + DISPLAY_NAME "Files 1 and 2" + DESCRIPTION "Component group for files 1 and 2" + PARENT_GROUP f1234 +) + +cpack_add_component_group(f34 + DISPLAY_NAME "Files 3 and 4" + DESCRIPTION "Component group for files 3 and 4" + PARENT_GROUP f1234 +) + +cpack_add_component_group(f1234 + DISPLAY_NAME "Files 1-4" + DESCRIPTION "Component group for all files" +) + +cpack_add_install_type(full + DISPLAY_NAME "Full installation" +) + +cpack_add_install_type(f12 + DISPLAY_NAME "Only files 1 and 2" +) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 3bb2a89..cef2b9b 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.1) include(RunCMake) run_cmake_command(NoArgs ${CMAKE_COMMAND}) +run_cmake_command(Wizard ${CMAKE_COMMAND} -i) run_cmake_command(C-no-arg ${CMAKE_COMMAND} -C) run_cmake_command(C-no-file ${CMAKE_COMMAND} -C nosuchcachefile.txt) run_cmake_command(cache-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeCache.txt) diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-result.txt b/Tests/RunCMake/CommandLine/Wizard-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/list/SORT-TooManyArguments-result.txt +++ b/Tests/RunCMake/CommandLine/Wizard-result.txt diff --git a/Tests/RunCMake/CommandLine/Wizard-stderr.txt b/Tests/RunCMake/CommandLine/Wizard-stderr.txt new file mode 100644 index 0000000..f757aff --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wizard-stderr.txt @@ -0,0 +1 @@ +^The "cmake -i" wizard mode is no longer supported\. diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 5af6fcd..6c861fa 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -24,6 +24,7 @@ \* CMP0068 \* CMP0069 \* CMP0073 + \* CMP0076 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt b/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt +++ b/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt b/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt index d47dd4d..d47dd4d 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt +++ b/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake b/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake new file mode 100644 index 0000000..4d8c268 --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake @@ -0,0 +1,10 @@ +cmake_policy(SET CMP0076 OLD) + +add_library(iface INTERFACE) +target_sources(iface INTERFACE empty_1.cpp) + +get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES) +message(STATUS "iface: ${iface_sources}") + +add_executable(main main.cpp) +target_link_libraries(main iface) diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt new file mode 100644 index 0000000..217c762 --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt @@ -0,0 +1,21 @@ +CMake Warning \(dev\) at CMP0076-WARN/CMakeLists.txt:2 \(target_sources\): + Policy CMP0076 is not set: target_sources\(\) command converts relative paths + to absolute. Run "cmake --help-policy CMP0076" for policy details. Use + the cmake_policy command to set the policy and suppress this warning. + + An interface source of target "publiclib" has a relative path. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at CMP0076-WARN/CMakeLists.txt:2 \(target_sources\): + Policy CMP0076 is not set: target_sources\(\) command converts relative paths + to absolute. Run "cmake --help-policy CMP0076" for policy details. Use + the cmake_policy command to set the policy and suppress this warning. + + A private source from a directory other than that of target "publiclib" has + a relative path. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error in CMakeLists.txt: + Target "publiclib" contains relative path in its INTERFACE_SOURCES: + + "CMP0076-WARN/subdir_empty_1.cpp" diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake b/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake new file mode 100644 index 0000000..2e07331 --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) + +add_library(publiclib) + +add_subdirectory(CMP0076-WARN) + +add_executable(main main.cpp) +target_link_libraries(main publiclib) diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt new file mode 100644 index 0000000..f9c7d6d --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt @@ -0,0 +1,3 @@ + +target_sources(publiclib INTERFACE CMP0076-WARN/subdir_empty_1.cpp + PRIVATE empty_1.cpp) diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt new file mode 100644 index 0000000..4581d8a --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt @@ -0,0 +1 @@ +-- iface: .*Tests/RunCMake/TargetSources/empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake b/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake index 8bb6149..0d3e9a4 100644 --- a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake +++ b/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake @@ -1,6 +1,10 @@ +cmake_policy(SET CMP0076 NEW) add_library(iface INTERFACE) target_sources(iface INTERFACE empty_1.cpp) +get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES) +message(STATUS "iface: ${iface_sources}") + add_executable(main main.cpp) target_link_libraries(main iface) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt new file mode 100644 index 0000000..7f48082 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt @@ -0,0 +1 @@ +-- genexlib: \$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp>;\$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/../empty_1.cpp>;\$<1:empty_2.cpp> diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake new file mode 100644 index 0000000..1cdc2a7 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake @@ -0,0 +1,10 @@ +cmake_policy(SET CMP0076 NEW) + +add_library(genexlib) +add_subdirectory(RelativePathInSubdirGenEx) + +get_property(genexlib_sources TARGET genexlib PROPERTY SOURCES) +message(STATUS "genexlib: ${genexlib_sources}") + +add_executable(genexmain main.cpp) +target_link_libraries(genexmain genexlib) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt new file mode 100644 index 0000000..3bcf454 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt @@ -0,0 +1,4 @@ + +target_sources(genexlib PUBLIC $<1:${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp> + $<1:${CMAKE_CURRENT_LIST_DIR}/../empty_1.cpp> + PRIVATE $<1:empty_2.cpp>) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt new file mode 100644 index 0000000..aa4851f --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt @@ -0,0 +1 @@ +-- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp;empty_1.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake new file mode 100644 index 0000000..4acbeca --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0076 NEW) + +add_library(privatelib) + +include("RelativePathInSubdirInclude/CMakeLists.txt") + +get_property(privatelib_sources TARGET privatelib PROPERTY SOURCES) +message(STATUS "privatelib: ${privatelib_sources}") diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt new file mode 100644 index 0000000..3dcb135 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt @@ -0,0 +1,3 @@ + +target_sources(privatelib PRIVATE "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp" + empty_1.cpp) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt new file mode 100644 index 0000000..5990a05 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt @@ -0,0 +1 @@ +-- iface: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_2.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake new file mode 100644 index 0000000..3652b4f --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake @@ -0,0 +1,11 @@ +cmake_policy(SET CMP0076 NEW) + +add_library(iface INTERFACE) + +add_subdirectory(RelativePathInSubdirInterface) + +get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES) +message(STATUS "iface: ${iface_sources}") + +add_executable(main main.cpp) +target_link_libraries(main iface) diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt new file mode 100644 index 0000000..02e6966 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt @@ -0,0 +1,5 @@ + +target_sources(iface INTERFACE subdir_empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_2.cpp" + ../empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/../empty_2.cpp") diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt new file mode 100644 index 0000000..fa5bcbf --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt @@ -0,0 +1 @@ +-- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_2.cpp diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake new file mode 100644 index 0000000..d0d3dc4 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake @@ -0,0 +1,8 @@ +cmake_policy(SET CMP0076 NEW) + +add_library(privatelib) + +add_subdirectory(RelativePathInSubdirPrivate) + +get_property(privatelib_sources TARGET privatelib PROPERTY SOURCES) +message(STATUS "privatelib: ${privatelib_sources}") diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt new file mode 100644 index 0000000..56ee853 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt @@ -0,0 +1,5 @@ + +target_sources(privatelib PRIVATE subdir_empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_2.cpp" + ../empty_1.cpp + "${CMAKE_CURRENT_LIST_DIR}/../empty_2.cpp") diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index 36d01de..bee8c4e 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -6,5 +6,11 @@ endif() run_cmake(OriginDebug) run_cmake(CMP0026-LOCATION) +run_cmake(CMP0076-OLD) +run_cmake(CMP0076-WARN) run_cmake(RelativePathInInterface) +run_cmake(RelativePathInSubdirGenEx) +run_cmake(RelativePathInSubdirInterface) +run_cmake(RelativePathInSubdirPrivate) +run_cmake(RelativePathInSubdirInclude) run_cmake(ExportBuild) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 0d178ce..d50de3d 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -7,6 +7,8 @@ run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) run_cmake(VsDebuggerWorkingDir) run_cmake(VsDebuggerCommand) +run_cmake(VsDebuggerCommandArguments) +run_cmake(VsDebuggerEnvironment) run_cmake(VsCSharpCustomTags) run_cmake(VsCSharpReferenceProps) run_cmake(VsCSharpWithoutSources) diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake index 0ded780..440f9f2 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake @@ -9,7 +9,7 @@ set(debuggerCommandSet FALSE) file(STRINGS "${vcProjectFile}" lines) foreach(line IN LISTS lines) if(line MATCHES "^ *<LocalDebuggerCommand[^>]*>([^<>]+)</LocalDebuggerCommand>$") - if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command foo") message(STATUS "foo.vcxproj has debugger command set") set(debuggerCommandSet TRUE) endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake index e29adc4..5dcb6d1 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake @@ -2,4 +2,4 @@ enable_language(CXX) add_library(foo foo.cpp) set_target_properties(foo PROPERTIES - VS_DEBUGGER_COMMAND "my-debugger-command") + VS_DEBUGGER_COMMAND "my-debugger-command $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake new file mode 100644 index 0000000..b2e0a43 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake @@ -0,0 +1,22 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(debuggerCommandArgumentsSet FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<LocalDebuggerCommandArguments[^>]*>([^<>]+)</LocalDebuggerCommandArguments>$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command-arguments foo") + message(STATUS "foo.vcxproj has debugger command arguments set") + set(debuggerCommandArgumentsSet TRUE) + endif() + endif() +endforeach() + +if(NOT debuggerCommandArgumentsSet) + set(RunCMake_TEST_FAILED "LocalDebuggerCommandArguments not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake new file mode 100644 index 0000000..aa87cdc --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(foo foo.cpp) + +set_target_properties(foo PROPERTIES + VS_DEBUGGER_COMMAND_ARGUMENTS "my-debugger-command-arguments $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake new file mode 100644 index 0000000..2427ad4 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake @@ -0,0 +1,22 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(debuggerEnvironmentSet FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *<LocalDebuggerEnvironment[^>]*>([^<>]+)</LocalDebuggerEnvironment>$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-environment foo") + message(STATUS "foo.vcxproj has debugger environment set") + set(debuggerEnvironmentSet TRUE) + endif() + endif() +endforeach() + +if(NOT debuggerEnvironmentSet) + set(RunCMake_TEST_FAILED "LocalDebuggerEnvironment not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake new file mode 100644 index 0000000..d5bec4c --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(foo foo.cpp) + +set_target_properties(foo PROPERTIES + VS_DEBUGGER_ENVIRONMENT "my-debugger-environment $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake index 637c68c..6a142f8 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake @@ -9,7 +9,7 @@ set(debuggerWorkDirSet FALSE) file(STRINGS "${vcProjectFile}" lines) foreach(line IN LISTS lines) if(line MATCHES "^ *<LocalDebuggerWorkingDirectory[^>]*>([^<>]+)</LocalDebuggerWorkingDirectory>$") - if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory foo") message(STATUS "foo.vcxproj has debugger working dir set") set(debuggerWorkDirSet TRUE) endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake index a277c65..36daed0 100644 --- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake +++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake @@ -2,4 +2,4 @@ enable_language(CXX) add_library(foo foo.cpp) set_target_properties(foo PROPERTIES - VS_DEBUGGER_WORKING_DIRECTORY "my-debugger-directory") + VS_DEBUGGER_WORKING_DIRECTORY "my-debugger-directory $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/add_link_options/CMakeLists.txt b/Tests/RunCMake/add_link_options/CMakeLists.txt new file mode 100644 index 0000000..14ef56e --- /dev/null +++ b/Tests/RunCMake/add_link_options/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.11) + +project(${RunCMake_TEST} LANGUAGES NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake new file mode 100644 index 0000000..d0ef8de --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake @@ -0,0 +1,2 @@ + +include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake") diff --git a/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake new file mode 100644 index 0000000..7316ef5 --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake @@ -0,0 +1,4 @@ + +set (LINKER_OPTION "LINKER:SHELL:-foo bar") + +include ("LINKER_expansion-list.cmake") diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake new file mode 100644 index 0000000..d0ef8de --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake @@ -0,0 +1,2 @@ + +include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake") diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake new file mode 100644 index 0000000..34dcc67 --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake @@ -0,0 +1,36 @@ + +enable_language(C) + +add_executable(dump dump.c) + +add_link_options("${LINKER_OPTION}") + +# ensure no temp file will be used +string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}") +string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}") + +add_library(example SHARED LinkOptionsLib.c) +# use LAUNCH facility to dump linker command +set_property(TARGET example PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"") + +add_dependencies (example dump) + +# generate reference for LINKER flag +if (CMAKE_C_LINKER_WRAPPER_FLAG) + set(linker_flag ${CMAKE_C_LINKER_WRAPPER_FLAG}) + list(GET linker_flag -1 linker_space) + if (linker_space STREQUAL " ") + list(REMOVE_AT linker_flag -1) + else() + set(linker_space) + endif() + list (JOIN linker_flag " " linker_flag) + if (CMAKE_C_LINKER_WRAPPER_FLAG_SEP) + string (APPEND linker_flag "${linker_space}" "-foo${CMAKE_C_LINKER_WRAPPER_FLAG_SEP}bar") + else() + set (linker_flag "${linker_flag}${linker_space}-foo ${linker_flag}${linker_space}bar") + endif() +else() + set(linker_flag "-foo bar") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LINKER.txt" "${linker_flag}") diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake new file mode 100644 index 0000000..bebd6c7 --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake @@ -0,0 +1,15 @@ + +if (actual_stdout MATCHES "(LINKER|SHELL):") + set (RunCMake_TEST_FAILED "LINKER: prefix was not expanded.") + return() +endif() + +if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/LINKER.txt") + set (RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/LINKER.txt: Reference file not found.") + return() +endif() +file(READ "${RunCMake_TEST_BINARY_DIR}/LINKER.txt" linker_flag) + +if (NOT actual_stdout MATCHES "${linker_flag}") + set (RunCMake_TEST_FAILED "LINKER: was not expanded correctly.") +endif() diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion.cmake new file mode 100644 index 0000000..42b286d --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINKER_expansion.cmake @@ -0,0 +1,4 @@ + +set (LINKER_OPTION "LINKER:-foo,bar") + +include ("LINKER_expansion-list.cmake") diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake new file mode 100644 index 0000000..4a22d7e --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_EXECUTABLE_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_EXECUTABLE_RELEASE'.") +endif() +if (actual_stdout MATCHES "BADFLAG_(SHARED|MODULE)_RELEASE") + set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(SHARED|MODULE)_RELEASE'.") +endif() diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake new file mode 100644 index 0000000..d695761 --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_MODULE_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_MODULE_RELEASE'.") +endif() +if (actual_stdout MATCHES "BADFLAG_(SHARED|EXECUTABLE)_RELEASE") + set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(SHARED|EXECUTABLE)_RELEASE'.") +endif() diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake new file mode 100644 index 0000000..eaac8e3 --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_SHARED_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_SHARED_RELEASE'.") +endif() +if (actual_stdout MATCHES "BADFLAG_(MODULE|EXECUTABLE)_RELEASE") + set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(MODULE|EXECUTABLE)_RELEASE'.") +endif() diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake new file mode 100644 index 0000000..802ff4f --- /dev/null +++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake @@ -0,0 +1,17 @@ + +enable_language(C) + +set(obj "${CMAKE_C_OUTPUT_EXTENSION}") +if(BORLAND) + set(pre -) +endif() + +add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>,$<CONFIG:Release>>:${pre}BADFLAG_SHARED_RELEASE${obj}>) +add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>,$<CONFIG:Release>>:${pre}BADFLAG_MODULE_RELEASE${obj}>) +add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>,$<CONFIG:Release>>:${pre}BADFLAG_EXECUTABLE_RELEASE${obj}>) + +add_library(LinkOptions_shared SHARED LinkOptionsLib.c) + +add_library(LinkOptions_mod MODULE LinkOptionsLib.c) + +add_executable(LinkOptions_exe LinkOptionsExe.c) diff --git a/Tests/RunCMake/add_link_options/LinkOptionsExe.c b/Tests/RunCMake/add_link_options/LinkOptionsExe.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/add_link_options/LinkOptionsExe.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/add_link_options/LinkOptionsLib.c b/Tests/RunCMake/add_link_options/LinkOptionsLib.c new file mode 100644 index 0000000..9bbd24c --- /dev/null +++ b/Tests/RunCMake/add_link_options/LinkOptionsLib.c @@ -0,0 +1,7 @@ +#if defined(_WIN32) +__declspec(dllexport) +#endif + int flags_lib(void) +{ + return 0; +} diff --git a/Tests/RunCMake/add_link_options/RunCMakeTest.cmake b/Tests/RunCMake/add_link_options/RunCMakeTest.cmake new file mode 100644 index 0000000..4f5df72 --- /dev/null +++ b/Tests/RunCMake/add_link_options/RunCMakeTest.cmake @@ -0,0 +1,38 @@ + +include(RunCMake) + +macro(run_cmake_target test subtest target) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN}) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") + # Intel compiler does not reject bad flags or objects! + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + + run_cmake(LINK_OPTIONS) + + run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release) + run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release) + run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release) + + unset(RunCMake_TEST_OPTIONS) + unset(RunCMake_TEST_OUTPUT_MERGE) +endif() + +run_cmake(bad_SHELL_usage) + +if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)") + run_cmake(LINKER_expansion) + run_cmake_target(LINKER_expansion build all) + + run_cmake(LINKER_SHELL_expansion) + run_cmake_target(LINKER_SHELL_expansion build all) +endif() diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt b/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt b/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt new file mode 100644 index 0000000..02d09f3 --- /dev/null +++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at bad_SHELL_usage.cmake:6 \(add_library\): + 'SHELL:' prefix is not supported as part of 'LINKER:' arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:5 \(include\) diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake b/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake new file mode 100644 index 0000000..324893d --- /dev/null +++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake @@ -0,0 +1,6 @@ + +enable_language(C) + +add_link_options("LINKER:-foo,SHELL:-bar") + +add_library(example SHARED LinkOptionsLib.c) diff --git a/Tests/RunCMake/add_link_options/dump.c b/Tests/RunCMake/add_link_options/dump.c new file mode 100644 index 0000000..8baa313 --- /dev/null +++ b/Tests/RunCMake/add_link_options/dump.c @@ -0,0 +1,13 @@ + +#include "stdio.h" + +int main(int argc, char* argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + printf("%s ", argv[i]); + printf("\n"); + + return 0; +} diff --git a/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt new file mode 100644 index 0000000..cb3c99f --- /dev/null +++ b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt @@ -0,0 +1,6 @@ +-- PROG_ABS='PROG_ABS-NOTFOUND' +-- PROG_ABS_NPD='PROG_ABS_NPD-NOTFOUND' +-- PROG_CWD='PROG_CWD-NOTFOUND' +-- PROG_CWD_NPD='PROG_CWD_NPD-NOTFOUND' +-- PROG_CWD_DOT='[^']*/Tests/RunCMake/find_program/testCWD' +-- PROG_CWD_DOT_NPD='[^']*/Tests/RunCMake/find_program/testCWD' diff --git a/Tests/RunCMake/find_program/RelAndAbsPath.cmake b/Tests/RunCMake/find_program/RelAndAbsPath.cmake new file mode 100644 index 0000000..9a42c5e --- /dev/null +++ b/Tests/RunCMake/find_program/RelAndAbsPath.cmake @@ -0,0 +1,63 @@ +# testNoSuchFile should only be found if the file absolute path is +# incorrectly prepended with the search path. + +function(strip_windows_path_prefix p outvar) + if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + string(REGEX REPLACE "^.:" "" p "${p}") + endif() + set(${outvar} "${p}" PARENT_SCOPE) +endfunction() + +strip_windows_path_prefix("${CMAKE_CURRENT_SOURCE_DIR}" srcdir) + +file(MAKE_DIRECTORY "tmp${srcdir}") +configure_file(testCWD "tmp${srcdir}/testNoSuchFile" COPYONLY) + +find_program(PROG_ABS + NAMES "${srcdir}/testNoSuchFile" + PATHS "${CMAKE_CURRENT_BINARY_DIR}/tmp" + NO_DEFAULT_PATH + ) +message(STATUS "PROG_ABS='${PROG_ABS}'") + +find_program(PROG_ABS_NPD + NAMES "${srcdir}/testNoSuchFile" + PATHS "${CMAKE_CURRENT_BINARY_DIR}/tmp" + NAMES_PER_DIR + NO_DEFAULT_PATH + ) +message(STATUS "PROG_ABS_NPD='${PROG_ABS_NPD}'") + +# ./testCWD should not be found without '.' being in the path list. + +configure_file(testCWD testCWD COPYONLY) + +find_program(PROG_CWD + NAMES testCWD + NO_DEFAULT_PATH + ) +message(STATUS "PROG_CWD='${PROG_CWD}'") + +find_program(PROG_CWD_NPD + NAMES testCWD + NAMES_PER_DIR + NO_DEFAULT_PATH + ) +message(STATUS "PROG_CWD_NPD='${PROG_CWD_NPD}'") + +# Confirm that adding '.' to path does locate ./testCWD. + +find_program(PROG_CWD_DOT + NAMES testCWD + PATHS . + NO_DEFAULT_PATH + ) +message(STATUS "PROG_CWD_DOT='${PROG_CWD_DOT}'") + +find_program(PROG_CWD_DOT_NPD + NAMES testCWD + PATHS . + NAMES_PER_DIR + NO_DEFAULT_PATH + ) +message(STATUS "PROG_CWD_DOT_NPD='${PROG_CWD_DOT_NPD}'") diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake index 89307c1..6903f05 100644 --- a/Tests/RunCMake/find_program/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake @@ -3,6 +3,7 @@ include(RunCMake) run_cmake(EnvAndHints) run_cmake(DirsPerName) run_cmake(NamesPerDir) +run_cmake(RelAndAbsPath) if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN)$") run_cmake(WindowsCom) diff --git a/Tests/RunCMake/find_program/testCWD b/Tests/RunCMake/find_program/testCWD new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/Tests/RunCMake/find_program/testCWD @@ -0,0 +1 @@ +#!/bin/sh diff --git a/Tests/RunCMake/install/CODE-genex-bad-result.txt b/Tests/RunCMake/install/CODE-genex-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/CODE-genex-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/CODE-genex-bad-stderr.txt b/Tests/RunCMake/install/CODE-genex-bad-stderr.txt new file mode 100644 index 0000000..9844158 --- /dev/null +++ b/Tests/RunCMake/install/CODE-genex-bad-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$<NOTAGENEX> + + Expression did not evaluate to a known generator expression diff --git a/Tests/RunCMake/install/CODE-genex-bad.cmake b/Tests/RunCMake/install/CODE-genex-bad.cmake new file mode 100644 index 0000000..1663b39 --- /dev/null +++ b/Tests/RunCMake/install/CODE-genex-bad.cmake @@ -0,0 +1 @@ +install(CODE "message(\"$<NOTAGENEX>\")") diff --git a/Tests/RunCMake/install/CODE-genex-check.cmake b/Tests/RunCMake/install/CODE-genex-check.cmake new file mode 100644 index 0000000..422c532 --- /dev/null +++ b/Tests/RunCMake/install/CODE-genex-check.cmake @@ -0,0 +1,7 @@ +execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake + OUTPUT_VARIABLE out ERROR_VARIABLE err) +if(NOT out MATCHES "-- Install configuration: .*-- codegenexlib") + string(REGEX REPLACE "\n" "\n " out " ${out}") + string(APPEND RunCMake_TEST_FAILED + "\"-- codegenexlib\" was not found:\n${out}") +endif() diff --git a/Tests/RunCMake/install/CODE-genex.cmake b/Tests/RunCMake/install/CODE-genex.cmake new file mode 100644 index 0000000..3b8513d --- /dev/null +++ b/Tests/RunCMake/install/CODE-genex.cmake @@ -0,0 +1,2 @@ +add_library( codegenexlib INTERFACE ) +install(CODE "message( STATUS \"$<TARGET_PROPERTY:codegenexlib,NAME>\")") diff --git a/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake new file mode 100644 index 0000000..c14998e --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^dir;dir/empty.txt$]]) diff --git a/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake new file mode 100644 index 0000000..e57aab0 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake @@ -0,0 +1 @@ +install(DIRECTORY dir/ noexist/ DESTINATION dir OPTIONAL) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake new file mode 100644 index 0000000..7a20edc --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^dir1;dir1/empty\.c;dir1/empty\.h;dir2;dir2/pattern;dir2/pattern/empty\.txt;dir3;dir3/empty\.c;dir3/empty\.h;dir3/empty\.txt;dir4;dir4/empty\.c;dir4/empty\.h;dir4/empty\.txt;empty$]]) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake new file mode 100644 index 0000000..74d8043 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake @@ -0,0 +1,36 @@ +install( + DIRECTORY pattern/ + DESTINATION dir1 + FILES_MATCHING + PATTERN "*.h" + REGEX "\\.c$" + ) + +# FIXME: If/when CMake gains a good way to read file permissions, we should +# check that these permissions were set correctly. +install( + DIRECTORY pattern + DESTINATION dir2 + FILE_PERMISSIONS OWNER_READ OWNER_WRITE + DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + PATTERN "*.h" EXCLUDE + REGEX "\\.c$" EXCLUDE + ) + +install( + DIRECTORY pattern/ + DESTINATION dir3 + PATTERN "*.h" + PERMISSIONS OWNER_READ OWNER_WRITE + ) + +install( + DIRECTORY pattern/ + DESTINATION dir4 + USE_SOURCE_PERMISSIONS + ) + +install( + DIRECTORY + DESTINATION empty + ) diff --git a/Tests/RunCMake/install/Deprecated-all-check.cmake b/Tests/RunCMake/install/Deprecated-all-check.cmake new file mode 100644 index 0000000..9ea33a6 --- /dev/null +++ b/Tests/RunCMake/install/Deprecated-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?;scripts1;scripts1/script;scripts1/script\.bat;scripts2;scripts2/script;scripts2/script\.bat;scripts3;scripts3/script;scripts3/script\.bat;src;src/empty\.c;src/obj1\.c;src/obj\2.c$]]) diff --git a/Tests/RunCMake/install/Deprecated.cmake b/Tests/RunCMake/install/Deprecated.cmake new file mode 100644 index 0000000..c435cb5 --- /dev/null +++ b/Tests/RunCMake/install/Deprecated.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +add_executable(myexe main.c) + +install_files(/src FILES empty.c) +install_files(/src .c obj1) +install_files(/src "^obj2.c$") + +install_targets(/bin myexe) + +install_programs(/scripts1 FILES script script.bat) +install_programs(/scripts2 script script.bat) +install_programs(/scripts3 "^script(\.bat)?$") diff --git a/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake new file mode 100644 index 0000000..2997a8d --- /dev/null +++ b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src;src/main.c$]]) diff --git a/Tests/RunCMake/install/FILES-OPTIONAL.cmake b/Tests/RunCMake/install/FILES-OPTIONAL.cmake new file mode 100644 index 0000000..812bf4f --- /dev/null +++ b/Tests/RunCMake/install/FILES-OPTIONAL.cmake @@ -0,0 +1 @@ +install(FILES main.c noexist.c DESTINATION src OPTIONAL) diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake new file mode 100644 index 0000000..b8ba6d0 --- /dev/null +++ b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src;src/empty.c]]) diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake new file mode 100644 index 0000000..999c271 --- /dev/null +++ b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake @@ -0,0 +1,5 @@ +install( + FILES empty.c + DESTINATION src + PERMISSIONS OWNER_READ OWNER_WRITE + ) diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake new file mode 100644 index 0000000..27ff683 --- /dev/null +++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake @@ -0,0 +1,10 @@ +enable_language(C) +set(CMAKE_INSTALL_MFC_LIBRARIES 1) +set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) +set(CMAKE_INSTALL_UCRT_LIBRARIES 1) +set(CMAKE_INSTALL_OPENMP_LIBRARIES 1) +include(InstallRequiredSystemLibraries) + +# FIXME: This test emits warnings because InstallRequiredSystemLibraries +# doesn't currently work properly. The warnings have been suppressed in +# InstallRequiredSystemLibraries-stderr.txt. This needs to be fixed. diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake new file mode 100644 index 0000000..16ff1e1 --- /dev/null +++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?;postinstall;preinstall]]) diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake new file mode 100644 index 0000000..357c688 --- /dev/null +++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_executable(myexe main.c) +set_property(TARGET myexe PROPERTY PRE_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/preinstall.cmake") +set_property(TARGET myexe PROPERTY POST_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/postinstall.cmake") + +install(TARGETS myexe DESTINATION bin) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index f004ce9..91524a6 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -65,12 +65,34 @@ run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) run_cmake(TARGETS-NAMELINK_COMPONENT-bad-all) run_cmake(TARGETS-NAMELINK_COMPONENT-bad-exc) +run_cmake(CODE-genex) +run_cmake(CODE-genex-bad) if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") run_install_test(FILES-TARGET_OBJECTS) endif() +run_install_test(TARGETS-InstallFromSubDir) +run_install_test(TARGETS-OPTIONAL) +run_install_test(FILES-OPTIONAL) +run_install_test(DIRECTORY-OPTIONAL) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug") +run_install_test(TARGETS-OUTPUT_NAME) +unset(RunCMake_TEST_OPTIONS) + +run_install_test(Deprecated) +run_install_test(PRE_POST_INSTALL_SCRIPT) +run_install_test(SCRIPT) +run_install_test(TARGETS-CONFIGURATIONS) +run_install_test(DIRECTORY-PATTERN) +run_install_test(TARGETS-Parts) +run_install_test(FILES-PERMISSIONS) +run_install_test(TARGETS-RPATH) +run_install_test(InstallRequiredSystemLibraries) + set(run_install_test_components 1) run_install_test(FILES-EXCLUDE_FROM_ALL) run_install_test(TARGETS-EXCLUDE_FROM_ALL) run_install_test(TARGETS-NAMELINK_COMPONENT) +run_install_test(SCRIPT-COMPONENT) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake new file mode 100644 index 0000000..e09a102 --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake @@ -0,0 +1 @@ +check_installed([[^$]]) diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake new file mode 100644 index 0000000..aaa9bd4 --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake @@ -0,0 +1,5 @@ +install( + SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake" + CODE "write_empty_file(empty2.txt)" + COMPONENT dev + ) diff --git a/Tests/RunCMake/install/SCRIPT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-all-check.cmake new file mode 100644 index 0000000..48d8e1a --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^empty1.txt;empty2.txt$]]) diff --git a/Tests/RunCMake/install/SCRIPT.cmake b/Tests/RunCMake/install/SCRIPT.cmake new file mode 100644 index 0000000..f857b54 --- /dev/null +++ b/Tests/RunCMake/install/SCRIPT.cmake @@ -0,0 +1,4 @@ +install( + SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake" + CODE "write_empty_file(empty2.txt)" + ) diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake new file mode 100644 index 0000000..2866e7f --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src;src/main-d.c$]]) diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake new file mode 100644 index 0000000..5531cd2 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake @@ -0,0 +1,2 @@ +install(FILES main.c DESTINATION src CONFIGURATIONS Debug RENAME main-d.c) +install(FILES main.c DESTINATION src CONFIGURATIONS Release RENAME main-r.c) diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake b/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake new file mode 100644 index 0000000..1d747c3 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?;bin/subexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake b/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake new file mode 100644 index 0000000..8615d6e --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_executable(myexe main.c) +add_subdirectory(TARGETS-InstallFromSubDir) +install(TARGETS myexe subexe DESTINATION bin) diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt b/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt new file mode 100644 index 0000000..477d938 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(subexe ../main.c) diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake new file mode 100644 index 0000000..bcf71dd --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^bin;bin/myexe(\.exe)?$]]) diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt new file mode 100644 index 0000000..86e3ec0 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt @@ -0,0 +1 @@ +^WARNING: Target "notall" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it\. CMake does not define behavior for this case\.$ diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake new file mode 100644 index 0000000..d3c5cda --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_executable(myexe main.c) +add_executable(notall EXCLUDE_FROM_ALL main.c) +install(TARGETS myexe notall DESTINATION bin OPTIONAL) diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake new file mode 100644 index 0000000..5daecc8 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake @@ -0,0 +1,13 @@ +if(WIN32) + set(test123 [[bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe]]) + set(libtest45 [[bin/libtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a]]) + set(test45 [[bin/test4\.dll;bin/test4\.lib;bin/test5ar\.lib]]) + + check_installed("^bin;(${libtest45};${test123})|(${test123};${test45})\$") +elseif(CYGWIN) + check_installed([[^bin;bin/cygtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a;bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe$]]) +elseif(APPLE) + check_installed([[^bin;bin/libtest4lib\.dylib;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]]) +else() + check_installed([[^bin;bin/libtest4lib\.so;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]]) +endif() diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake new file mode 100644 index 0000000..67e7069 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake @@ -0,0 +1,27 @@ +enable_language(C) + +add_executable(test1 main.c) +set_property(TARGET test1 PROPERTY OUTPUT_NAME test1out) +set_property(TARGET test1 PROPERTY RELEASE_OUTPUT_NAME test1rel) + +add_executable(test2 main.c) +set_property(TARGET test2 PROPERTY OUTPUT_NAME test2out) +set_property(TARGET test2 PROPERTY DEBUG_OUTPUT_NAME test2deb) + +add_executable(test3 main.c) +set_property(TARGET test3 PROPERTY RUNTIME_OUTPUT_NAME test3exc) + +add_library(test4 SHARED obj1.c) +set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4lib) + +add_library(test5 STATIC obj1.c) +set_property(TARGET test5 PROPERTY ARCHIVE_OUTPUT_NAME test5ar) + +install(TARGETS + test1 + test2 + test3 + test4 + test5 + DESTINATION bin + ) diff --git a/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake new file mode 100644 index 0000000..6245839 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^include;include/obj1\.h;lib;lib/(mylib\.lib|(lib|cyg)mylib\.a)$]]) diff --git a/Tests/RunCMake/install/TARGETS-Parts.cmake b/Tests/RunCMake/install/TARGETS-Parts.cmake new file mode 100644 index 0000000..2a46ab9 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-Parts.cmake @@ -0,0 +1,7 @@ +enable_language(C) +add_library(mylib STATIC obj1.c) +set_property(TARGET mylib PROPERTY PUBLIC_HEADER obj1.h) +install(TARGETS mylib + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include + ) diff --git a/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake new file mode 100644 index 0000000..fa52d65 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake @@ -0,0 +1,14 @@ +execute_process( + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/myexe" + RESULT_VARIABLE MYEXE_RESULT + OUTPUT_VARIABLE MYEXE_OUTPUT + ERROR_VARIABLE MYEXE_ERROR + ) + +if(NOT MYEXE_RESULT EQUAL "0") + set(RunCMake_TEST_FAILED "myexe returned [${MYEXE_RESULT}], was expecting [0]") +elseif(NOT MYEXE_OUTPUT STREQUAL "") + set(RunCMake_TEST_FAILED "myexe printed nonempty output:\n${MYEXE_OUTPUT}") +elseif(NOT MYEXE_ERROR STREQUAL "") + set(RunCMake_TEST_FAILED "myexe printed nonempty error:\n${MYEXE_ERROR}") +endif() diff --git a/Tests/RunCMake/install/TARGETS-RPATH.cmake b/Tests/RunCMake/install/TARGETS-RPATH.cmake new file mode 100644 index 0000000..b75deff --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-RPATH.cmake @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.9) + +enable_language(C) + +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) +add_library(mylib SHARED obj1.c) +add_executable(myexe testobj1.c) +target_link_libraries(myexe mylib) +set_property(TARGET myexe PROPERTY INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/root-all/bin") +set_target_properties(mylib PROPERTIES VERSION 1.0 SOVERSION 1) + +install(TARGETS mylib myexe + DESTINATION bin + ) diff --git a/Tests/RunCMake/install/install_script.cmake b/Tests/RunCMake/install/install_script.cmake new file mode 100644 index 0000000..1f8522c --- /dev/null +++ b/Tests/RunCMake/install/install_script.cmake @@ -0,0 +1,5 @@ +function(write_empty_file FILENAME) + file(WRITE "${CMAKE_INSTALL_PREFIX}/${FILENAME}" "") +endfunction() + +write_empty_file(empty1.txt) diff --git a/Tests/RunCMake/install/obj1.c b/Tests/RunCMake/install/obj1.c index 2411aab..70007df 100644 --- a/Tests/RunCMake/install/obj1.c +++ b/Tests/RunCMake/install/obj1.c @@ -1,4 +1,7 @@ -int obj1(void) +#ifdef _WIN32 +__declspec(dllexport) +#endif + int obj1(void) { return 0; } diff --git a/Tests/RunCMake/install/obj1.h b/Tests/RunCMake/install/obj1.h new file mode 100644 index 0000000..d88d5d2 --- /dev/null +++ b/Tests/RunCMake/install/obj1.h @@ -0,0 +1,6 @@ +#ifndef OBJ1_H +#define OBJ1_H + +int obj1(void); + +#endif /* OBJ1_H */ diff --git a/Tests/RunCMake/install/pattern/empty.c b/Tests/RunCMake/install/pattern/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/install/pattern/empty.c diff --git a/Tests/RunCMake/install/pattern/empty.h b/Tests/RunCMake/install/pattern/empty.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/install/pattern/empty.h diff --git a/Tests/RunCMake/install/pattern/empty.txt b/Tests/RunCMake/install/pattern/empty.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/install/pattern/empty.txt diff --git a/Tests/RunCMake/install/postinstall.cmake b/Tests/RunCMake/install/postinstall.cmake new file mode 100644 index 0000000..7607f40 --- /dev/null +++ b/Tests/RunCMake/install/postinstall.cmake @@ -0,0 +1 @@ +file(WRITE "${CMAKE_INSTALL_PREFIX}/postinstall" "postinstall") diff --git a/Tests/RunCMake/install/preinstall.cmake b/Tests/RunCMake/install/preinstall.cmake new file mode 100644 index 0000000..4b28d16 --- /dev/null +++ b/Tests/RunCMake/install/preinstall.cmake @@ -0,0 +1 @@ +file(WRITE "${CMAKE_INSTALL_PREFIX}/preinstall" "preinstall") diff --git a/Tests/SimpleInstallS2/scripts/sample_script b/Tests/RunCMake/install/script index 81f9f53..81f9f53 100755 --- a/Tests/SimpleInstallS2/scripts/sample_script +++ b/Tests/RunCMake/install/script diff --git a/Tests/SimpleInstallS2/scripts/sample_script.bat b/Tests/RunCMake/install/script.bat index a9af38c..a9af38c 100755 --- a/Tests/SimpleInstallS2/scripts/sample_script.bat +++ b/Tests/RunCMake/install/script.bat diff --git a/Tests/RunCMake/install/testobj1.c b/Tests/RunCMake/install/testobj1.c new file mode 100644 index 0000000..081ef20 --- /dev/null +++ b/Tests/RunCMake/install/testobj1.c @@ -0,0 +1,9 @@ +#ifdef _WIN32 +__declspec(dllimport) +#endif + int obj1(void); + +int main(void) +{ + return obj1(); +} diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt index 6e15c0b..9b9c5e0 100644 --- a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt +++ b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at INSERT-InvalidIndex.cmake:2 \(list\): - list index: 3 out of range \(-3, 2\) + list index: 4 out of range \(-3, 3\) Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex.cmake b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake index 4103d97..12ac114 100644 --- a/Tests/RunCMake/list/INSERT-InvalidIndex.cmake +++ b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake @@ -1,2 +1,2 @@ set(mylist alpha bravo charlie) -list(INSERT mylist 3 delta) +list(INSERT mylist 4 delta) diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index bdc23a4..a8a0b57 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -20,7 +20,6 @@ run_cmake(JOIN-TooManyArguments) run_cmake(LENGTH-TooManyArguments) run_cmake(REMOVE_DUPLICATES-TooManyArguments) run_cmake(REVERSE-TooManyArguments) -run_cmake(SORT-TooManyArguments) run_cmake(SUBLIST-TooManyArguments) run_cmake(FILTER-NotList) @@ -84,3 +83,16 @@ run_cmake(TRANSFORM-GENEX_STRIP) run_cmake(TRANSFORM-APPEND) run_cmake(TRANSFORM-PREPEND) run_cmake(TRANSFORM-REPLACE) + +# argument tests +run_cmake(SORT-WrongOption) +run_cmake(SORT-BadCaseOption) +run_cmake(SORT-BadCompareOption) +run_cmake(SORT-BadOrderOption) +run_cmake(SORT-DuplicateOrderOption) +run_cmake(SORT-DuplicateCompareOption) +run_cmake(SORT-DuplicateCaseOption) +run_cmake(SORT-NoCaseOption) + +# Successful tests +run_cmake(SORT) diff --git a/Tests/RunCMake/list/SORT-BadCaseOption-result.txt b/Tests/RunCMake/list/SORT-BadCaseOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCaseOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt new file mode 100644 index 0000000..87dd502 --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-BadCaseOption.cmake:1 \(list\): + list sub-command SORT value "BAD_CASE_OPTION" for option "CASE" is invalid. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-BadCaseOption.cmake b/Tests/RunCMake/list/SORT-BadCaseOption.cmake new file mode 100644 index 0000000..ac5c102 --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCaseOption.cmake @@ -0,0 +1 @@ +list(SORT mylist CASE BAD_CASE_OPTION) diff --git a/Tests/RunCMake/list/SORT-BadCompareOption-result.txt b/Tests/RunCMake/list/SORT-BadCompareOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCompareOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt b/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt new file mode 100644 index 0000000..51b4de2 --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at SORT-BadCompareOption.cmake:1 \(list\): + list sub-command SORT value "BAD_COMPARE_OPTION" for option "COMPARE" is + invalid. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-BadCompareOption.cmake b/Tests/RunCMake/list/SORT-BadCompareOption.cmake new file mode 100644 index 0000000..d5c632e --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadCompareOption.cmake @@ -0,0 +1 @@ +list(SORT mylist COMPARE BAD_COMPARE_OPTION) diff --git a/Tests/RunCMake/list/SORT-BadOrderOption-result.txt b/Tests/RunCMake/list/SORT-BadOrderOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadOrderOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt b/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt new file mode 100644 index 0000000..7984e5c --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at SORT-BadOrderOption.cmake:1 \(list\): + list sub-command SORT value "BAD_ODER_OPTION" for option "ORDER" is + invalid. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-BadOrderOption.cmake b/Tests/RunCMake/list/SORT-BadOrderOption.cmake new file mode 100644 index 0000000..e232197 --- /dev/null +++ b/Tests/RunCMake/list/SORT-BadOrderOption.cmake @@ -0,0 +1 @@ +list(SORT mylist ORDER BAD_ODER_OPTION) diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt new file mode 100644 index 0000000..b893f50 --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-DuplicateCaseOption.cmake:2 \(list\): + list sub-command SORT option "CASE" has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake b/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake new file mode 100644 index 0000000..ba52b24 --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake @@ -0,0 +1,2 @@ +set (mylist a b c) +list(SORT mylist CASE INSENSITIVE CASE INSENSITIVE ) diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt new file mode 100644 index 0000000..83624be --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-DuplicateCompareOption.cmake:2 \(list\): + list sub-command SORT option "COMPARE" has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake b/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake new file mode 100644 index 0000000..fd2e31d --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake @@ -0,0 +1,2 @@ +set (mylist a b c) +list(SORT mylist COMPARE STRING COMPARE STRING) diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt new file mode 100644 index 0000000..9e95178 --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-DuplicateOrderOption.cmake:2 \(list\): + list sub-command SORT option "ORDER" has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake b/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake new file mode 100644 index 0000000..26d9c7d --- /dev/null +++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake @@ -0,0 +1,2 @@ +set (mylist a b c) +list(SORT mylist ORDER ASCENDING ORDER ASCENDING) diff --git a/Tests/RunCMake/list/SORT-NoCaseOption-result.txt b/Tests/RunCMake/list/SORT-NoCaseOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-NoCaseOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt new file mode 100644 index 0000000..5c63e77 --- /dev/null +++ b/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-NoCaseOption.cmake:1 \(list\): + list sub-command SORT missing argument for option "CASE". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-NoCaseOption.cmake b/Tests/RunCMake/list/SORT-NoCaseOption.cmake new file mode 100644 index 0000000..57cc429 --- /dev/null +++ b/Tests/RunCMake/list/SORT-NoCaseOption.cmake @@ -0,0 +1 @@ +list(SORT mylist CASE) diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt b/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt deleted file mode 100644 index d3fad60..0000000 --- a/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at SORT-TooManyArguments.cmake:1 \(list\): - list sub-command SORT only takes one argument. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-WrongOption-result.txt b/Tests/RunCMake/list/SORT-WrongOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-WrongOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-WrongOption-stderr.txt b/Tests/RunCMake/list/SORT-WrongOption-stderr.txt new file mode 100644 index 0000000..597cb29 --- /dev/null +++ b/Tests/RunCMake/list/SORT-WrongOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-WrongOption.cmake:1 \(list\): + list sub-command SORT option "one_too_many" is unknown. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-TooManyArguments.cmake b/Tests/RunCMake/list/SORT-WrongOption.cmake index 81b195d..81b195d 100644 --- a/Tests/RunCMake/list/SORT-TooManyArguments.cmake +++ b/Tests/RunCMake/list/SORT-WrongOption.cmake diff --git a/Tests/RunCMake/list/SORT.cmake b/Tests/RunCMake/list/SORT.cmake new file mode 100644 index 0000000..4a9e064 --- /dev/null +++ b/Tests/RunCMake/list/SORT.cmake @@ -0,0 +1,114 @@ +set(source_unsorted + c/B.h + a/c.h + B/a.h + ) + +## Test with default options +set(expected + B/a.h + a/c.h + c/B.h + ) +set(list ${source_unsorted}) +list(SORT list) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)") +endif () + + +## Test CASE INSENSITIVE ORDER ASCENDING COMPARE STRING +set(expected + a/c.h + B/a.h + c/B.h + ) +set(list ${source_unsorted}) +list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE STRING) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE STRING)") +endif () + +## Test CASE INSENSITIVE ORDER DESCENDING COMPARE STRING +set(expected + c/B.h + B/a.h + a/c.h + ) +set(list ${source_unsorted}) +list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE STRING) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE STRING)") +endif () + +## Test CASE SENSITIVE ORDER ASCENDING COMPARE STRING +set(expected + B/a.h + a/c.h + c/B.h + ) +set(list ${source_unsorted}) +list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)") +endif () + +## Test CASE SENSITIVE ORDER DESCENDING COMPARE STRING +set(expected + c/B.h + a/c.h + B/a.h + ) +set(list ${source_unsorted}) +list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE STRING) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE STRING)") +endif () + +## Test CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME +set(expected + B/a.h + c/B.h + a/c.h + ) +set(list ${source_unsorted}) +list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)") +endif () + +## Test CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME +set(expected + a/c.h + c/B.h + B/a.h + ) +set(list ${source_unsorted}) +list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)") +endif () + +## Test CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME +set(expected + c/B.h + B/a.h + a/c.h + ) +set(list ${source_unsorted}) +list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)") +endif () + +## Test CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME +set(expected + a/c.h + B/a.h + c/B.h + ) +set(list ${source_unsorted}) +list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME) +if (NOT expected STREQUAL list) + message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)") +endif () diff --git a/Tests/RunCMake/math/CMakeLists.txt b/Tests/RunCMake/math/CMakeLists.txt new file mode 100644 index 0000000..12cd3c7 --- /dev/null +++ b/Tests/RunCMake/math/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/math/MATH-DivideByZero-result.txt b/Tests/RunCMake/math/MATH-DivideByZero-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-DivideByZero-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt new file mode 100644 index 0000000..66ad633 --- /dev/null +++ b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-DivideByZero.cmake:1 \(math\): + math cannot evaluate the expression: "100/0": divide by zero. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-DivideByZero.cmake b/Tests/RunCMake/math/MATH-DivideByZero.cmake new file mode 100644 index 0000000..3ac161e --- /dev/null +++ b/Tests/RunCMake/math/MATH-DivideByZero.cmake @@ -0,0 +1 @@ +math(EXPR var "100/0") diff --git a/Tests/RunCMake/math/MATH-DoubleOption-result.txt b/Tests/RunCMake/math/MATH-DoubleOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-DoubleOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt new file mode 100644 index 0000000..767a060 --- /dev/null +++ b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-DoubleOption.cmake:1 \(math\): + math EXPR called with incorrect arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-DoubleOption.cmake b/Tests/RunCMake/math/MATH-DoubleOption.cmake new file mode 100644 index 0000000..7bcb78e --- /dev/null +++ b/Tests/RunCMake/math/MATH-DoubleOption.cmake @@ -0,0 +1 @@ +math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT HEXADECIMAL) diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-result.txt b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt new file mode 100644 index 0000000..9e73ed5 --- /dev/null +++ b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at MATH-InvalidExpression.cmake:1 \(math\): + math cannot parse the expression: "INVALID": syntax error, unexpected \$end, + expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER \(7\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-InvalidExpression.cmake b/Tests/RunCMake/math/MATH-InvalidExpression.cmake new file mode 100644 index 0000000..6e37128 --- /dev/null +++ b/Tests/RunCMake/math/MATH-InvalidExpression.cmake @@ -0,0 +1 @@ +math(EXPR var "INVALID") diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt new file mode 100644 index 0000000..732ce6f --- /dev/null +++ b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) at MATH-ToleratedExpression.cmake:1 \(math\): + Unexpected character in expression at position 1: ' + + Unexpected character in expression at position 7: ' + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression.cmake b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake new file mode 100644 index 0000000..d1be218 --- /dev/null +++ b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake @@ -0,0 +1,4 @@ +math(EXPR var "'2*1-1'") +if(NOT var EQUAL 1) + message(FATAL_ERROR "Expression did not evaluate to 1") +endif() diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-result.txt b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt new file mode 100644 index 0000000..fdcfecf --- /dev/null +++ b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-TooManyArguments.cmake:1 \(math\): + math EXPR called with incorrect arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-TooManyArguments.cmake b/Tests/RunCMake/math/MATH-TooManyArguments.cmake new file mode 100644 index 0000000..969dc80 --- /dev/null +++ b/Tests/RunCMake/math/MATH-TooManyArguments.cmake @@ -0,0 +1 @@ +math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT ) diff --git a/Tests/RunCMake/math/MATH-WrongArgument-result.txt b/Tests/RunCMake/math/MATH-WrongArgument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/math/MATH-WrongArgument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt new file mode 100644 index 0000000..bbe54bf --- /dev/null +++ b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at MATH-WrongArgument.cmake:1 \(math\): + math sub-command EXPR option "OUT" is unknown. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/math/MATH-WrongArgument.cmake b/Tests/RunCMake/math/MATH-WrongArgument.cmake new file mode 100644 index 0000000..fb6d2e7 --- /dev/null +++ b/Tests/RunCMake/math/MATH-WrongArgument.cmake @@ -0,0 +1 @@ +math(EXPR var "10*10" OUT HEX ) diff --git a/Tests/RunCMake/math/MATH.cmake b/Tests/RunCMake/math/MATH.cmake new file mode 100644 index 0000000..a5f50cd --- /dev/null +++ b/Tests/RunCMake/math/MATH.cmake @@ -0,0 +1,12 @@ +macro(math_test expression expected) + math(EXPR evaluated ${expression} ${ARGN}) + if (NOT evaluated STREQUAL ${expected}) + message(FATAL_ERROR "wrong math result: ${evaluated} != ${expected}") + endif () +endmacro() + + +math_test("100 * 10" 1000) +math_test("100 * 10" 1000 OUTPUT_FORMAT DECIMAL) +math_test("100 * 0xA" 1000 OUTPUT_FORMAT DECIMAL) +math_test("100 * 0xA" 0x3e8 OUTPUT_FORMAT HEXADECIMAL) diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake new file mode 100644 index 0000000..a4d5c31 --- /dev/null +++ b/Tests/RunCMake/math/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +run_cmake(MATH) +run_cmake(MATH-WrongArgument) +run_cmake(MATH-DoubleOption) +run_cmake(MATH-TooManyArguments) +run_cmake(MATH-InvalidExpression) +run_cmake(MATH-ToleratedExpression) +run_cmake(MATH-DivideByZero) diff --git a/Tests/RunCMake/option/CMP0077-NEW.cmake b/Tests/RunCMake/option/CMP0077-NEW.cmake new file mode 100644 index 0000000..d4c518b --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-NEW.cmake @@ -0,0 +1,14 @@ + +#Verify that option DOESN'T overwrite existing normal variable when the policy +#is set to NEW +cmake_policy(SET CMP0077 NEW) +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) +if(OPT_LOCAL_VAR) + message(FATAL_ERROR "option failed to overwrite existing normal variable") +endif() + +get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET) +if(_exists_in_cache) + message(FATAL_ERROR "value should not exist in cache as it was already a local variable") +endif() diff --git a/Tests/RunCMake/option/CMP0077-OLD.cmake b/Tests/RunCMake/option/CMP0077-OLD.cmake new file mode 100644 index 0000000..4c52d4b --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-OLD.cmake @@ -0,0 +1,9 @@ + +#Verify that option overwrites existing normal variable when the policy +#is set to OLD +cmake_policy(SET CMP0077 OLD) +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) +if(NOT OPT_LOCAL_VAR) + message(FATAL_ERROR "option failed to overwrite existing normal variable") +endif() diff --git a/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake new file mode 100644 index 0000000..f62a853 --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake @@ -0,0 +1,14 @@ + +#Verify that when both a cache and local version of a value exist that CMake +#doesn't produce a CMP0077 warning and that we get the expected values. +option(OPT_LOCAL_VAR "TEST_VAR" ON) +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) +if(OPT_LOCAL_VAR) + message(FATAL_ERROR "option improperly set a cache variable that already exists") +endif() + +get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET) +if(NOT _exists_in_cache) + message(FATAL_ERROR "value should exist in cache") +endif() diff --git a/Tests/RunCMake/option/CMP0077-WARN-stderr.txt b/Tests/RunCMake/option/CMP0077-WARN-stderr.txt new file mode 100644 index 0000000..0d02ffb --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-WARN-stderr.txt @@ -0,0 +1,7 @@ +CMake Warning \(dev\) at CMP0077-WARN.cmake:5 \(option\): + Policy CMP0077 is not set: option\(\) honors normal variables. Run "cmake + --help-policy CMP0077" for policy details. Use the cmake_policy command to + set the policy and suppress this warning. + + For compatibility with older versions of CMake, option is clearing the + normal variable 'OPT_LOCAL_VAR'. diff --git a/Tests/RunCMake/option/CMP0077-WARN.cmake b/Tests/RunCMake/option/CMP0077-WARN.cmake new file mode 100644 index 0000000..7f99456 --- /dev/null +++ b/Tests/RunCMake/option/CMP0077-WARN.cmake @@ -0,0 +1,5 @@ + +#Verify that option overwrites existing normal variable when the policy +#is set to OLD +set(OPT_LOCAL_VAR FALSE) +option(OPT_LOCAL_VAR "TEST_VAR" ON) diff --git a/Tests/RunCMake/option/CMakeLists.txt b/Tests/RunCMake/option/CMakeLists.txt new file mode 100644 index 0000000..11dc49a --- /dev/null +++ b/Tests/RunCMake/option/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.12) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/option/RunCMakeTest.cmake b/Tests/RunCMake/option/RunCMakeTest.cmake new file mode 100644 index 0000000..979afa1 --- /dev/null +++ b/Tests/RunCMake/option/RunCMakeTest.cmake @@ -0,0 +1,6 @@ +include(RunCMake) + +run_cmake(CMP0077-OLD) +run_cmake(CMP0077-NEW) +run_cmake(CMP0077-WARN) +run_cmake(CMP0077-SECOND-PASS) diff --git a/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt b/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt new file mode 100644 index 0000000..033792a --- /dev/null +++ b/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt @@ -0,0 +1,2 @@ +-- Target LINK_OPTIONS is 'a;b;c;d;;e' +-- Directory LINK_OPTIONS is 'a;b;c;d;;e' diff --git a/Tests/RunCMake/set_property/LINK_OPTIONS.cmake b/Tests/RunCMake/set_property/LINK_OPTIONS.cmake new file mode 100644 index 0000000..6daf41b --- /dev/null +++ b/Tests/RunCMake/set_property/LINK_OPTIONS.cmake @@ -0,0 +1,3 @@ +include(Common.cmake) +test_target_property(LINK_OPTIONS) +test_directory_property(LINK_OPTIONS) diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake index b966e89..77da703 100644 --- a/Tests/RunCMake/set_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake @@ -5,6 +5,7 @@ run_cmake(COMPILE_FEATURES) run_cmake(COMPILE_OPTIONS) run_cmake(IMPORTED_GLOBAL) run_cmake(INCLUDE_DIRECTORIES) +run_cmake(LINK_OPTIONS) run_cmake(LINK_LIBRARIES) run_cmake(SOURCES) run_cmake(TYPE) diff --git a/Tests/RunCMake/target_link_options/CMakeLists.txt b/Tests/RunCMake/target_link_options/CMakeLists.txt new file mode 100644 index 0000000..14ef56e --- /dev/null +++ b/Tests/RunCMake/target_link_options/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.11) + +project(${RunCMake_TEST} LANGUAGES NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake new file mode 100644 index 0000000..d0ef8de --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake @@ -0,0 +1,2 @@ + +include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake") diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake new file mode 100644 index 0000000..d0ef8de --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake @@ -0,0 +1,2 @@ + +include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake") diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake new file mode 100644 index 0000000..1af8f13 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake @@ -0,0 +1,15 @@ + +if (actual_stdout MATCHES "LINKER:") + set (RunCMake_TEST_FAILED "LINKER: prefix was not expanded.") + return() +endif() + +if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/LINKER.txt") + set (RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/LINKER.txt: Reference file not found.") + return() +endif() +file(READ "${RunCMake_TEST_BINARY_DIR}/LINKER.txt" linker_flag) + +if (NOT actual_stdout MATCHES "${linker_flag}") + set (RunCMake_TEST_FAILED "LINKER: was not expanded correctly.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion.cmake new file mode 100644 index 0000000..b344867 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINKER_expansion.cmake @@ -0,0 +1,49 @@ + +enable_language(C) + +add_executable(dump dump.c) + +# ensure no temp file will be used +string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}") +string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}") + + +# Use LINKER alone +add_library(linker SHARED LinkOptionsLib.c) +target_link_options(linker PRIVATE "LINKER:-foo,bar") + +# use LAUNCH facility to dump linker command +set_property(TARGET linker PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"") + +add_dependencies (linker dump) + + +# Use LINKER with SHELL +add_library(linker_shell SHARED LinkOptionsLib.c) +target_link_options(linker_shell PRIVATE "LINKER:SHELL:-foo bar") + +# use LAUNCH facility to dump linker command +set_property(TARGET linker_shell PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"") + +add_dependencies (linker_shell dump) + + +# generate reference for LINKER flag +if (CMAKE_C_LINKER_WRAPPER_FLAG) + set(linker_flag ${CMAKE_C_LINKER_WRAPPER_FLAG}) + list(GET linker_flag -1 linker_space) + if (linker_space STREQUAL " ") + list(REMOVE_AT linker_flag -1) + else() + set(linker_space) + endif() + list (JOIN linker_flag " " linker_flag) + if (CMAKE_C_LINKER_WRAPPER_FLAG_SEP) + string (APPEND linker_flag "${linker_space}" "-foo${CMAKE_C_LINKER_WRAPPER_FLAG_SEP}bar") + else() + set (linker_flag "${linker_flag}${linker_space}-foo ${linker_flag}${linker_space}bar") + endif() +else() + set(linker_flag "-foo bar") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LINKER.txt" "${linker_flag}") diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake new file mode 100644 index 0000000..7799506 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_PRIVATE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_PRIVATE'.") +endif() +if (actual_stdout MATCHES "BADFLAG_INTERFACE") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected 'BADFLAG_INTERFACE'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake new file mode 100644 index 0000000..a686de9 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.") +endif() +if (actual_stdout MATCHES "SHELL:") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake new file mode 100644 index 0000000..6c5ffdb --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_INTERFACE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_INTERFACE'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake new file mode 100644 index 0000000..a686de9 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.") +endif() +if (actual_stdout MATCHES "SHELL:") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake new file mode 100644 index 0000000..a686de9 --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake @@ -0,0 +1,7 @@ + +if (NOT actual_stdout MATCHES "BADFLAG_RELEASE") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.") +endif() +if (actual_stdout MATCHES "SHELL:") + string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.") +endif() diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake new file mode 100644 index 0000000..f17195d --- /dev/null +++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake @@ -0,0 +1,39 @@ + +enable_language(C) + +set(obj "${CMAKE_C_OUTPUT_EXTENSION}") +if(BORLAND) + set(pre -) +endif() + +# basic configuration +add_library(LinkOptions SHARED LinkOptionsLib.c) +target_link_options(LinkOptions + PRIVATE ${pre}BADFLAG_PRIVATE${obj} + INTERFACE ${pre}BADFLAG_INTERFACE${obj}) + + +# INTERFACE_LINK_OPTIONS +add_library(LinkOptions_producer SHARED LinkOptionsLib.c) +target_link_options(LinkOptions_producer + INTERFACE ${pre}BADFLAG_INTERFACE${obj}) + +add_executable(LinkOptions_consumer LinkOptionsExe.c) +target_link_libraries(LinkOptions_consumer PRIVATE LinkOptions_producer) + + +# shared library with generator expression +add_library(LinkOptions_shared SHARED LinkOptionsLib.c) +target_link_options(LinkOptions_shared PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}> + "SHELL:" # produces no options + ) + + +# module library with generator expression +add_library(LinkOptions_mod MODULE LinkOptionsLib.c) +target_link_options(LinkOptions_mod PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>) + + +# executable with generator expression +add_executable(LinkOptions_exe LinkOptionsExe.c) +target_link_options(LinkOptions_exe PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>) diff --git a/Tests/RunCMake/target_link_options/LinkOptionsExe.c b/Tests/RunCMake/target_link_options/LinkOptionsExe.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/target_link_options/LinkOptionsExe.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/target_link_options/LinkOptionsLib.c b/Tests/RunCMake/target_link_options/LinkOptionsLib.c new file mode 100644 index 0000000..9bbd24c --- /dev/null +++ b/Tests/RunCMake/target_link_options/LinkOptionsLib.c @@ -0,0 +1,7 @@ +#if defined(_WIN32) +__declspec(dllexport) +#endif + int flags_lib(void) +{ + return 0; +} diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake new file mode 100644 index 0000000..121a0ce --- /dev/null +++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake @@ -0,0 +1,39 @@ + +include(RunCMake) + +macro(run_cmake_target test subtest target) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN}) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") + # Intel compiler does not reject bad flags or objects! + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + + run_cmake(LINK_OPTIONS) + + run_cmake_target(LINK_OPTIONS basic LinkOptions) + run_cmake_target(LINK_OPTIONS interface LinkOptions_consumer) + run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release) + run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release) + run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release) + + unset(RunCMake_TEST_OPTIONS) + unset(RunCMake_TEST_OUTPUT_MERGE) +endif() + +run_cmake(bad_SHELL_usage) + +if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)") + run_cmake(LINKER_expansion) + + run_cmake_target(LINKER_expansion LINKER linker) + run_cmake_target(LINKER_expansion LINKER_SHELL linker_shell) +endif() diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt b/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt b/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt new file mode 100644 index 0000000..bffd80a --- /dev/null +++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at bad_SHELL_usage.cmake:4 \(add_library\): + 'SHELL:' prefix is not supported as part of 'LINKER:' arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:5 \(include\) diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake b/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake new file mode 100644 index 0000000..b0adf19 --- /dev/null +++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake @@ -0,0 +1,5 @@ + +enable_language(C) + +add_library(example SHARED LinkOptionsLib.c) +target_link_options(example PRIVATE "LINKER:-foo,SHELL:-bar") diff --git a/Tests/RunCMake/target_link_options/dump.c b/Tests/RunCMake/target_link_options/dump.c new file mode 100644 index 0000000..8baa313 --- /dev/null +++ b/Tests/RunCMake/target_link_options/dump.c @@ -0,0 +1,13 @@ + +#include "stdio.h" + +int main(int argc, char* argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + printf("%s ", argv[i]); + printf("\n"); + + return 0; +} diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt deleted file mode 100644 index a07f687..0000000 --- a/Tests/SimpleInstall/CMakeLists.txt +++ /dev/null @@ -1,398 +0,0 @@ -cmake_minimum_required (VERSION 3.9) -project (TestSimpleInstall) -set(CMAKE_VERBOSE_MAKEFILE 1) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/bin") -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/lib/static") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/lib") - -# Skip generating the rpath pointing at the build tree to make sure -# the executable is installed with the proper rpath in the install -# tree. -set(CMAKE_SKIP_BUILD_RPATH 1) - -# Make sure the executable can run from the install tree. -set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - -# Skip the dependency that causes a build when installing. This -# avoids infinite loops when the post-build rule below installs. -set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1) -set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1) - -set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") - -set(EXTRA_INSTALL_FLAGS) -message("Extra install: ${EXTRA_INSTALL_FLAGS}") - -if(STAGE2) - set(LIBPATHS - ${CMAKE_INSTALL_PREFIX}/MyTest/lib/static - ${CMAKE_INSTALL_PREFIX}/MyTest/lib - ) - set(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel) - set(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX}) - set(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX}) - - # Make sure the install script ran. - set(CMAKE_INSTALL_SCRIPT_DID_RUN 0) - include(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL) - if(CMAKE_INSTALL_SCRIPT_DID_RUN) - message(STATUS "Stage 1 did run install script 2.") - else() - message(SEND_ERROR "Stage 1 did not run install script 2.") - endif() - - if(CYGWIN OR MINGW) - set(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin") - endif() - message("Search for library in: ${LIBPATHS}") - - set(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - set(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - set(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - - find_library(TEST1_LIBRARY - NAMES ${t1NAMES} - PATHS ${LIBPATHS} - DOC "First library") - find_library(TEST2_LIBRARY - NAMES ${t2NAMES} - PATHS ${LIBPATHS} - DOC "Second library") - find_library(TEST4_LIBRARY - NAMES ${t4NAMES} - PATHS ${LIBPATHS} - DOC "Fourth library") - - # Test importing a library found on disk. - add_library(lib_test4 UNKNOWN IMPORTED) - set_property(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY}) - - include_directories(${CMAKE_INSTALL_PREFIX}/MyTest/include) - add_executable (SimpleInstExeS2 inst2.cxx foo.c foo.h) - target_link_libraries(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4) - set(install_target SimpleInstExeS2) - - if("${TEST1_LIBRARY}" MATCHES "static") - message(STATUS "test1 correctly found in lib/static") - else() - message(SEND_ERROR "test1 not found in lib/static!") - endif() - - # Check for failure of configuration-specific installation. - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h") - message(FATAL_ERROR "Debug-configuration file installed for Release!") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h") - message(FATAL_ERROR "Release-configuration file installed for Debug!") - endif() - - # Check for failure of directory installation. - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h") - message(FATAL_ERROR "Directory installation did not install TSD.h") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - message(FATAL_ERROR "Directory installation installed CVS directory.") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - message(FATAL_ERROR "Directory installation installed CVS directory.") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt") - message(FATAL_ERROR "Directory installation installed CMakeLists.txt.") - endif() - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h") - message(FATAL_ERROR "Directory installation did not install alternate TSD.h") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx") - message(FATAL_ERROR "Directory installation installed alternate TSD.cxx") - endif() - - # Check that scripts properly installed. - if(WIN32 AND NOT CYGWIN) - set(BAT .bat) - else() - set(BAT) - endif() - foreach(loc share share/old1 share/old2 share/old3 share/alt) - set(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}") - execute_process( - COMMAND ${CUR_SCRIPT} - RESULT_VARIABLE SAMPLE_SCRIPT_RESULT - OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT - ) - if(NOT "${SAMPLE_SCRIPT_RESULT}" STREQUAL "0") - message(FATAL_ERROR - "Sample script [${CUR_SCRIPT}] failed: [${SAMPLE_SCRIPT_RESULT}]") - endif() - if(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output") - message(FATAL_ERROR - "Bad sample script [${CUR_SCRIPT}] output: [${SAMPLE_SCRIPT_OUTPUT}]") - endif() - endforeach() - - # Check for failure of empty directory installation. - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty") - message(FATAL_ERROR "Empty directory installation did not install.") - endif() - file(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*") - if(EMPTY_FILES) - message(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].") - endif() - - # Make sure the test executable can run from the install tree. - set_target_properties(SimpleInstExeS2 PROPERTIES - INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - - install_targets(/MyTest/bin SimpleInstExeS2) - -# try to import the exported targets again - set(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - find_package(SimpleInstallS1 REQUIRED) - get_target_property(simpleInstallImported S1_SimpleInstall IMPORTED) - if(NOT simpleInstallImported) - message(FATAL_ERROR "Target S1_SimpleInstall could not be imported") - endif() - -else() - # Wipe out the install directory to do a fresh test. - file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest) - - # this is stage 1, so create libraries and modules and install everything - add_library(test1 STATIC lib1.cxx) - add_library(test2 SHARED lib2.cxx) - add_library(test3 MODULE lib3.cxx) - add_library(test4 SHARED lib4.cxx) - - # Test <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME properties. - set_property(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out) - set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out) - - add_executable (SimpleInstall inst.cxx foo.c foo.h) - target_link_libraries(SimpleInstall test1 test2 test4) - set(install_target SimpleInstall) - - set_target_properties(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe) - # Disable VERSION test until it is implemented in the Xcode generator. - if(NOT XCODE) - set_target_properties(SimpleInstall PROPERTIES VERSION 1.2) - endif() - - # Make sure the test executable can run from the install tree. - set_target_properties(SimpleInstall PROPERTIES - INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - - # Test per-configuration output name. - set_target_properties(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel) - set_target_properties(test2 PROPERTIES PUBLIC_HEADER foo.h) - - if(CMAKE_GENERATOR MATCHES "Makefiles") - add_subdirectory(TestSubDir) - add_dependencies(SimpleInstall TSD) - endif() - - add_dependencies(SimpleInstall test3) - add_dependencies(test2 test3) - add_dependencies(test4 test2) - - install(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1 - RUNTIME DESTINATION MyTest/bin COMPONENT Runtime # .exe, .dll - LIBRARY DESTINATION MyTest/lib COMPONENT Runtime # .so, mod.dll - ARCHIVE DESTINATION MyTest/lib/static COMPONENT Development # .a, .lib - PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development - ) - - install(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - RUNTIME DESTINATION MyTest/bin - LIBRARY DESTINATION MyTest/lib - ARCHIVE DESTINATION MyTest/lib/static - OPTIONAL # for coverage...target should always exist - ) - install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>) - install(FILES lib2.h - DESTINATION $<1:MyTest/include/foo>$<0:/wrong> - COMPONENT Development - PERMISSIONS OWNER_READ OWNER_WRITE - RENAME lib2renamed.h - ) - - # Test old-style install commands. - install_files(/MyTest/include FILES lib3.h) - install_files(/MyTest/include/old .h lib3) - install_files(/MyTest/include/old "^lib2.h$") - install_programs(/MyTest/share/old1 FILES - scripts/sample_script scripts/sample_script.bat) - install_programs(/MyTest/share/old2 - scripts/sample_script scripts/sample_script.bat) - -# "export" the targets collected in "SimpleInstallS1" - install(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake - DESTINATION MyTest/lib - NAMESPACE S1_ ) - - export(TARGETS SimpleInstall test1 test2 test3 - FILE "${CMAKE_CURRENT_BINARY_DIR}/SimpleInstallS1Config.cmake" - NAMESPACE S2_ ) - - add_subdirectory(scripts) - - # Test optional installation. - install(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL) - - # Test configuration-specific installation. - install(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release - DESTINATION MyTest/include/Release - ) - install(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug - DESTINATION MyTest/include/Debug - ) - - # Test directory installation. - file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - install( - DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong> - FILE_PERMISSIONS OWNER_READ OWNER_WRITE - DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - PATTERN "CVS" EXCLUDE - REGEX "\\.txt$" EXCLUDE - PATTERN "scripts/*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ - ) - - # Alternate directory installation for coverage. - install( - DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong> - COMPONENT Development - USE_SOURCE_PERMISSIONS - PATTERN "CVS" EXCLUDE - REGEX "\\.txt$" EXCLUDE - ) - install( - DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong> - FILE_PERMISSIONS OWNER_READ OWNER_WRITE - DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - FILES_MATCHING PATTERN "*.h" - ) - - # Test empty directory installation. - install(DIRECTORY DESTINATION MyTest/share/empty) - - # Test optional directory installation. - install(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL) - - # Test user-specified install scripts, with and without COMPONENT. - install( - SCRIPT InstallScript1.cmake - CODE "set(INSTALL_CODE_DID_RUN 1)" - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake - ) - install( - SCRIPT InstallScript3.cmake - CODE "set(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)" - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript4.cmake - COMPONENT Development - ) - set_directory_properties(PROPERTIES - ADDITIONAL_MAKE_CLEAN_FILES - "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake") - - set_target_properties(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT - ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake) - set_target_properties(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT - ${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake) - set_target_properties(test4 PROPERTIES VERSION 1.2 SOVERSION 3 - INSTALL_NAME_DIR @executable_path/../lib) -endif() - -get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(_isMultiConfig) - set(SI_CONFIG --config $<CONFIGURATION>) -else() - set(SI_CONFIG) -endif() - -# Dummy test of CPack -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") -set(CPACK_PACKAGE_VENDOR "Kitware") -set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake") - -if(WIN32 AND NOT UNIX) - find_program(NSIS_MAKENSIS NAMES makensis - PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] - DOC "Where is makensis.exe located" - ) - if(NOT NSIS_MAKENSIS) - set(CPACK_GENERATOR TGZ) - endif() -endif() -if(UNIX AND NOT APPLE) - set(CPACK_GENERATOR "TGZ;STGZ;TZ") - # find_program(found_compress - # NAMES compress) - # if(found_compress) - # find_program(file_command NAMES file) - # if(NOT file_command) - # set(file_command file) - # endif() - # execute_process(COMMAND ${file_command} ${found_compress} - # OUTPUT_VARIABLE output) - # set(SKIP_TZ FALSE) - # if("${output}" MATCHES "script") - # set(SKIP_TZ TRUE) - # endif() - # if("${output}" MATCHES "dummy.sh") - # set(SKIP_TZ TRUE) - # endif() - # if(NOT SKIP_TZ) - # message("compress found and it was not a script") - # message("output from file command: [${output}]") - # list(APPEND CPACK_GENERATOR "TZ") - # else() - # message("compress found, but it was a script so don't use it") - # message("output from file command: [${output}]") - # endif() - # endif() - find_program(found_bz2 - NAMES bzip2) - if(found_bz2) - list(APPEND CPACK_GENERATOR "TBZ2") - endif() -endif() - -set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") -set(CMAKE_INSTALL_MFC_LIBRARIES 1) -set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) -set(CMAKE_INSTALL_UCRT_LIBRARIES 1) -set(CMAKE_INSTALL_OPENMP_LIBRARIES 1) -include(InstallRequiredSystemLibraries) - -if(CTEST_TEST_CPACK) - set(package_command COMMAND - ${CMAKE_COMMAND} --build . --target package ${SI_CONFIG} - ) - - # Avoid settings that require the .zip file command line tools... - # (just build an NSIS installer without component support) - # - set(CPACK_BINARY_ZIP OFF) - set(CPACK_MONOLITHIC_INSTALL ON) -else() - set(package_command) -endif() - -include(CPack) - -set(install_command COMMAND - ${CMAKE_COMMAND} --build . --target install ${SI_CONFIG} - ) - -add_custom_command( - TARGET ${install_target} - POST_BUILD - ${install_command} - ${package_command} - COMMENT "Install Project" - ) diff --git a/Tests/SimpleInstall/InstallScript1.cmake b/Tests/SimpleInstall/InstallScript1.cmake deleted file mode 100644 index ef9da57..0000000 --- a/Tests/SimpleInstall/InstallScript1.cmake +++ /dev/null @@ -1,5 +0,0 @@ -message("This is install script 1.") -set(INSTALL_SCRIPT_1_DID_RUN 1) -if(INSTALL_CODE_DID_RUN) - message(FATAL_ERROR "Install script 1 did not run before install code.") -endif() diff --git a/Tests/SimpleInstall/InstallScript2.cmake b/Tests/SimpleInstall/InstallScript2.cmake deleted file mode 100644 index c1d20a3..0000000 --- a/Tests/SimpleInstall/InstallScript2.cmake +++ /dev/null @@ -1,14 +0,0 @@ -message("This is install script 2.") -if(INSTALL_SCRIPT_1_DID_RUN) - message("Install script ordering works.") -else() - message(FATAL_ERROR "Install script 1 did not run before install script 2.") -endif() -if(INSTALL_CODE_DID_RUN) - message("Install code ordering works.") -else() - message(FATAL_ERROR "Install script 2 did not run after install code.") -endif() -file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake" - "set(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n" - ) diff --git a/Tests/SimpleInstall/InstallScript3.cmake b/Tests/SimpleInstall/InstallScript3.cmake deleted file mode 100644 index 6485156..0000000 --- a/Tests/SimpleInstall/InstallScript3.cmake +++ /dev/null @@ -1,12 +0,0 @@ -message("This is install script 3.") -set(INSTALL_SCRIPT_3_DID_RUN 1) -if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - message(FATAL_ERROR "Install script 3 did not run before install code with component.") -endif() - -if(CMAKE_INSTALL_COMPONENT) -if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - message(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.") -endif() -endif() diff --git a/Tests/SimpleInstall/InstallScript4.cmake b/Tests/SimpleInstall/InstallScript4.cmake deleted file mode 100644 index 34d0a73..0000000 --- a/Tests/SimpleInstall/InstallScript4.cmake +++ /dev/null @@ -1,22 +0,0 @@ -message("This is install script 4.") -if(INSTALL_SCRIPT_3_DID_RUN) - message("Install script ordering works.") -else() - message(FATAL_ERROR "Install script 3 did not run before install script 4.") -endif() -if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - message("Install code ordering works.") -else() - message(FATAL_ERROR "Install script 4 did not run after install with component code.") -endif() - -if(CMAKE_INSTALL_COMPONENT) -if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - message(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.") -endif() -endif() - -file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake" - "set(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n" - ) diff --git a/Tests/SimpleInstall/PackageScript.cmake b/Tests/SimpleInstall/PackageScript.cmake deleted file mode 100644 index 53b7909..0000000 --- a/Tests/SimpleInstall/PackageScript.cmake +++ /dev/null @@ -1,10 +0,0 @@ -message("This is packaging script") -message("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt") - -file(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "") -get_cmake_property(res VARIABLES) -foreach(var ${res}) - file(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt - "${var} \"${${var}}\"\n") -endforeach() - diff --git a/Tests/SimpleInstall/PostInstall.cmake b/Tests/SimpleInstall/PostInstall.cmake deleted file mode 100644 index d616221..0000000 --- a/Tests/SimpleInstall/PostInstall.cmake +++ /dev/null @@ -1,6 +0,0 @@ -message("In post install") -if(PRE_INSTALL_DID_RUN) - message("Pre and post install work fine") -else() - message(FATAL_ERROR "Pre install did not run before post install") -endif() diff --git a/Tests/SimpleInstall/PreInstall.cmake b/Tests/SimpleInstall/PreInstall.cmake deleted file mode 100644 index 7a9851e..0000000 --- a/Tests/SimpleInstall/PreInstall.cmake +++ /dev/null @@ -1,2 +0,0 @@ -message("This is in pre install") -set(PRE_INSTALL_DID_RUN 1) diff --git a/Tests/SimpleInstall/TestSubDir/CMakeLists.txt b/Tests/SimpleInstall/TestSubDir/CMakeLists.txt deleted file mode 100644 index 860e104..0000000 --- a/Tests/SimpleInstall/TestSubDir/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_executable(TSD TSD.cxx TSD_utils.cxx) -install_files(/MyTest/include FILES TSD.h) -install_targets(/MyTest/bin TSD) diff --git a/Tests/SimpleInstall/TestSubDir/TSD.cxx b/Tests/SimpleInstall/TestSubDir/TSD.cxx deleted file mode 100644 index 8fc3878..0000000 --- a/Tests/SimpleInstall/TestSubDir/TSD.cxx +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdio.h> - -#include "TSD.h" - -int main() -{ - int res = TSD("TEST"); - printf("Hello from TSD\n"); - return res; -} diff --git a/Tests/SimpleInstall/TestSubDir/TSD.h b/Tests/SimpleInstall/TestSubDir/TSD.h deleted file mode 100644 index 6a3c1af..0000000 --- a/Tests/SimpleInstall/TestSubDir/TSD.h +++ /dev/null @@ -1 +0,0 @@ -int TSD(const char*); diff --git a/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx b/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx deleted file mode 100644 index 0f32894..0000000 --- a/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx +++ /dev/null @@ -1,9 +0,0 @@ -#include <string.h> - -int TSD(const char* foo) -{ - if (strcmp(foo, "TEST") == 0) { - return 0; - } - return 1; -} diff --git a/Tests/SimpleInstall/foo.c b/Tests/SimpleInstall/foo.c deleted file mode 100644 index 45d5b2b..0000000 --- a/Tests/SimpleInstall/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -char* foo = "Foo"; - -int SomeFunctionInFoo() -{ - return 5; -} diff --git a/Tests/SimpleInstall/foo.h b/Tests/SimpleInstall/foo.h deleted file mode 100644 index 216cdf6..0000000 --- a/Tests/SimpleInstall/foo.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -extern char* foo; -extern int SomeFunctionInFoo(); - -#ifdef __cplusplus -} -#endif diff --git a/Tests/SimpleInstall/inst.cxx b/Tests/SimpleInstall/inst.cxx deleted file mode 100644 index 7815f86..0000000 --- a/Tests/SimpleInstall/inst.cxx +++ /dev/null @@ -1,34 +0,0 @@ -#include "foo.h" - -#ifdef STAGE_2 -# include <foo/lib1.h> -# include <foo/lib2renamed.h> -# include <lib3.h> -# include <old/lib2.h> -# include <old/lib3.h> -#else -# include "lib1.h" -# include "lib2.h" -#endif - -#include "lib4.h" - -#include <stdio.h> - -int main() -{ - if (Lib1Func() != 2.0) { - printf("Problem with lib1\n"); - return 1; - } - if (Lib2Func() != 1.0) { - printf("Problem with lib2\n"); - return 1; - } - if (Lib4Func() != 4.0) { - printf("Problem with lib4\n"); - return 1; - } - printf("The value of Foo: %s\n", foo); - return SomeFunctionInFoo() - 5; -} diff --git a/Tests/SimpleInstall/inst2.cxx b/Tests/SimpleInstall/inst2.cxx deleted file mode 100644 index c70b93a..0000000 --- a/Tests/SimpleInstall/inst2.cxx +++ /dev/null @@ -1,2 +0,0 @@ -#define STAGE_2 -#include "inst.cxx" diff --git a/Tests/SimpleInstall/lib1.cxx b/Tests/SimpleInstall/lib1.cxx deleted file mode 100644 index 7aa9052..0000000 --- a/Tests/SimpleInstall/lib1.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib1.h" - -float Lib1Func() -{ - return 2.0; -} diff --git a/Tests/SimpleInstall/lib1.h b/Tests/SimpleInstall/lib1.h deleted file mode 100644 index 0d64e76..0000000 --- a/Tests/SimpleInstall/lib1.h +++ /dev/null @@ -1 +0,0 @@ -extern float Lib1Func(); diff --git a/Tests/SimpleInstall/lib2.cxx b/Tests/SimpleInstall/lib2.cxx deleted file mode 100644 index dccc48b..0000000 --- a/Tests/SimpleInstall/lib2.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib2.h" - -float Lib2Func() -{ - return 1.0; -} diff --git a/Tests/SimpleInstall/lib2.h b/Tests/SimpleInstall/lib2.h deleted file mode 100644 index 044e775..0000000 --- a/Tests/SimpleInstall/lib2.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test2_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib2Func(); diff --git a/Tests/SimpleInstall/lib3.cxx b/Tests/SimpleInstall/lib3.cxx deleted file mode 100644 index da8dbf9..0000000 --- a/Tests/SimpleInstall/lib3.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib3.h" - -float Lib3Func() -{ - return 2.0; -} diff --git a/Tests/SimpleInstall/lib3.h b/Tests/SimpleInstall/lib3.h deleted file mode 100644 index e02bbc4..0000000 --- a/Tests/SimpleInstall/lib3.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test3_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib3Func(); diff --git a/Tests/SimpleInstall/lib4.cxx b/Tests/SimpleInstall/lib4.cxx deleted file mode 100644 index fbede5c..0000000 --- a/Tests/SimpleInstall/lib4.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib4.h" - -float Lib4Func() -{ - return 4.0; -} diff --git a/Tests/SimpleInstall/lib4.h b/Tests/SimpleInstall/lib4.h deleted file mode 100644 index e1a221e..0000000 --- a/Tests/SimpleInstall/lib4.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test4_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib4Func(); diff --git a/Tests/SimpleInstall/scripts/.gitattributes b/Tests/SimpleInstall/scripts/.gitattributes deleted file mode 100644 index 5e3db2f..0000000 --- a/Tests/SimpleInstall/scripts/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -sample_script crlf=input diff --git a/Tests/SimpleInstall/scripts/CMakeLists.txt b/Tests/SimpleInstall/scripts/CMakeLists.txt deleted file mode 100644 index ec34e8c..0000000 --- a/Tests/SimpleInstall/scripts/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -install_programs(/MyTest/share/old3 "^sample_script(\\.bat)?$") diff --git a/Tests/SimpleInstall/scripts/sample_script b/Tests/SimpleInstall/scripts/sample_script deleted file mode 100755 index 81f9f53..0000000 --- a/Tests/SimpleInstall/scripts/sample_script +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo "Sample Script Output" diff --git a/Tests/SimpleInstall/scripts/sample_script.bat b/Tests/SimpleInstall/scripts/sample_script.bat deleted file mode 100755 index a9af38c..0000000 --- a/Tests/SimpleInstall/scripts/sample_script.bat +++ /dev/null @@ -1 +0,0 @@ -@echo Sample Script Output diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt deleted file mode 100644 index 22150ca..0000000 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ /dev/null @@ -1,397 +0,0 @@ -cmake_minimum_required (VERSION 3.9) -project (TestSimpleInstall) -set(CMAKE_VERBOSE_MAKEFILE 1) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/bin") -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/lib/static") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY - "${TestSimpleInstall_BINARY_DIR}/lib") - -# Skip generating the rpath pointing at the build tree to make sure -# the executable is installed with the proper rpath in the install -# tree. -set(CMAKE_SKIP_BUILD_RPATH 1) - -# Make sure the executable can run from the install tree. -set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - -# Skip the dependency that causes a build when installing. This -# avoids infinite loops when the post-build rule below installs. -set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1) -set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1) - -set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix") - -set(EXTRA_INSTALL_FLAGS) -message("Extra install: ${EXTRA_INSTALL_FLAGS}") - -if(STAGE2) - set(LIBPATHS - ${CMAKE_INSTALL_PREFIX}/MyTest/lib/static - ${CMAKE_INSTALL_PREFIX}/MyTest/lib - ) - set(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel) - set(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX}) - set(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX}) - - # Make sure the install script ran. - set(CMAKE_INSTALL_SCRIPT_DID_RUN 0) - include(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL) - if(CMAKE_INSTALL_SCRIPT_DID_RUN) - message(STATUS "Stage 1 did run install script 2.") - else() - message(SEND_ERROR "Stage 1 did not run install script 2.") - endif() - - if(CYGWIN OR MINGW) - set(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin") - endif() - message("Search for library in: ${LIBPATHS}") - - set(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - set(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - set(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE) - - find_library(TEST1_LIBRARY - NAMES ${t1NAMES} - PATHS ${LIBPATHS} - DOC "First library") - find_library(TEST2_LIBRARY - NAMES ${t2NAMES} - PATHS ${LIBPATHS} - DOC "Second library") - find_library(TEST4_LIBRARY - NAMES ${t4NAMES} - PATHS ${LIBPATHS} - DOC "Fourth library") - - # Test importing a library found on disk. - add_library(lib_test4 UNKNOWN IMPORTED) - set_property(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY}) - - include_directories(${CMAKE_INSTALL_PREFIX}/MyTest/include) - add_executable (SimpleInstExeS2 inst2.cxx foo.c foo.h) - target_link_libraries(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4) - set(install_target SimpleInstExeS2) - - if("${TEST1_LIBRARY}" MATCHES "static") - message(STATUS "test1 correctly found in lib/static") - else() - message(SEND_ERROR "test1 not found in lib/static!") - endif() - - # Check for failure of configuration-specific installation. - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h") - message(FATAL_ERROR "Debug-configuration file installed for Release!") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h") - message(FATAL_ERROR "Release-configuration file installed for Debug!") - endif() - - # Check for failure of directory installation. - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h") - message(FATAL_ERROR "Directory installation did not install TSD.h") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - message(FATAL_ERROR "Directory installation installed CVS directory.") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - message(FATAL_ERROR "Directory installation installed CVS directory.") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt") - message(FATAL_ERROR "Directory installation installed CMakeLists.txt.") - endif() - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h") - message(FATAL_ERROR "Directory installation did not install alternate TSD.h") - endif() - if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx") - message(FATAL_ERROR "Directory installation installed alternate TSD.cxx") - endif() - - # Check that scripts properly installed. - if(WIN32 AND NOT CYGWIN) - set(BAT .bat) - else() - set(BAT) - endif() - foreach(loc share share/old1 share/old2 share/old3 share/alt) - set(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}") - execute_process( - COMMAND ${CUR_SCRIPT} - RESULT_VARIABLE SAMPLE_SCRIPT_RESULT - OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT - ) - if(NOT "${SAMPLE_SCRIPT_RESULT}" STREQUAL "0") - message(FATAL_ERROR - "Sample script [${CUR_SCRIPT}] failed: [${SAMPLE_SCRIPT_RESULT}]") - endif() - if(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output") - message(FATAL_ERROR - "Bad sample script [${CUR_SCRIPT}] output: [${SAMPLE_SCRIPT_OUTPUT}]") - endif() - endforeach() - - # Check for failure of empty directory installation. - if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty") - message(FATAL_ERROR "Empty directory installation did not install.") - endif() - file(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*") - if(EMPTY_FILES) - message(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].") - endif() - - # Make sure the test executable can run from the install tree. - set_target_properties(SimpleInstExeS2 PROPERTIES - INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - - install_targets(/MyTest/bin SimpleInstExeS2) - -# try to import the exported targets again - set(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - find_package(SimpleInstallS1 REQUIRED) - get_target_property(simpleInstallImported S1_SimpleInstall IMPORTED) - if(NOT simpleInstallImported) - message(FATAL_ERROR "Target S1_SimpleInstall could not be imported") - endif() - -else() - # Wipe out the install directory to do a fresh test. - file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest) - - # this is stage 1, so create libraries and modules and install everything - add_library(test1 STATIC lib1.cxx) - add_library(test2 SHARED lib2.cxx) - add_library(test3 MODULE lib3.cxx) - add_library(test4 SHARED lib4.cxx) - - # Test <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME properties. - set_property(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out) - set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out) - - add_executable (SimpleInstall inst.cxx foo.c foo.h) - target_link_libraries(SimpleInstall test1 test2 test4) - set(install_target SimpleInstall) - - set_target_properties(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe) - # Disable VERSION test until it is implemented in the Xcode generator. - if(NOT XCODE) - set_target_properties(SimpleInstall PROPERTIES VERSION 1.2) - endif() - - # Make sure the test executable can run from the install tree. - set_target_properties(SimpleInstall PROPERTIES - INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) - - # Test per-configuration output name. - set_target_properties(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel) - set_target_properties(test2 PROPERTIES PUBLIC_HEADER foo.h) - - if(CMAKE_GENERATOR MATCHES "Makefiles") - add_subdirectory(TestSubDir) - add_dependencies(SimpleInstall TSD) - endif() - - add_dependencies(SimpleInstall test3) - add_dependencies(test2 test3) - add_dependencies(test4 test2) - - install(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1 - RUNTIME DESTINATION MyTest/bin COMPONENT Runtime # .exe, .dll - LIBRARY DESTINATION MyTest/lib COMPONENT Runtime # .so, mod.dll - ARCHIVE DESTINATION MyTest/lib/static COMPONENT Development # .a, .lib - PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development - ) - - install(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - RUNTIME DESTINATION MyTest/bin - LIBRARY DESTINATION MyTest/lib - ARCHIVE DESTINATION MyTest/lib/static - OPTIONAL # for coverage...target should always exist - ) - install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>) - install(FILES lib2.h - DESTINATION $<1:MyTest/include/foo>$<0:/wrong> - COMPONENT Development - PERMISSIONS OWNER_READ OWNER_WRITE - RENAME lib2renamed.h - ) - - # Test old-style install commands. - install_files(/MyTest/include FILES lib3.h) - install_files(/MyTest/include/old .h lib3) - install_files(/MyTest/include/old "^lib2.h$") - install_programs(/MyTest/share/old1 FILES - scripts/sample_script scripts/sample_script.bat) - install_programs(/MyTest/share/old2 - scripts/sample_script scripts/sample_script.bat) - -# "export" the targets collected in "SimpleInstallS1" - install(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake - DESTINATION MyTest/lib - NAMESPACE S1_ ) - - export(TARGETS SimpleInstall test1 test2 test3 - FILE "${CMAKE_CURRENT_BINARY_DIR}/SimpleInstallS1Config.cmake" - NAMESPACE S2_ ) - - add_subdirectory(scripts) - - # Test optional installation. - install(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL) - - # Test configuration-specific installation. - install(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release - DESTINATION MyTest/include/Release - ) - install(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug - DESTINATION MyTest/include/Debug - ) - - # Test directory installation. - file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") - file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") - install( - DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong> - FILE_PERMISSIONS OWNER_READ OWNER_WRITE - DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - PATTERN "CVS" EXCLUDE - REGEX "\\.txt$" EXCLUDE - PATTERN "scripts/*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ - ) - - # Alternate directory installation for coverage. - install( - DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong> - COMPONENT Development - USE_SOURCE_PERMISSIONS - PATTERN "CVS" EXCLUDE - REGEX "\\.txt$" EXCLUDE - ) - install( - DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong> - FILE_PERMISSIONS OWNER_READ OWNER_WRITE - DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - FILES_MATCHING PATTERN "*.h" - ) - - # Test empty directory installation. - install(DIRECTORY DESTINATION MyTest/share/empty) - - # Test optional directory installation. - install(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL) - - # Test user-specified install scripts, with and without COMPONENT. - install( - SCRIPT InstallScript1.cmake - CODE "set(INSTALL_CODE_DID_RUN 1)" - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake - ) - install( - SCRIPT InstallScript3.cmake - CODE "set(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)" - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript4.cmake - COMPONENT Development - ) - set_directory_properties(PROPERTIES - ADDITIONAL_MAKE_CLEAN_FILES - "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake") - - set_target_properties(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT - ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake) - set_target_properties(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT - ${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake) - set_target_properties(test4 PROPERTIES VERSION 1.2 SOVERSION 3 - INSTALL_NAME_DIR @executable_path/../lib) -endif() - -get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(_isMultiConfig) - set(SI_CONFIG --config $<CONFIGURATION>) -else() - set(SI_CONFIG) -endif() - -# Dummy test of CPack -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack") -set(CPACK_PACKAGE_VENDOR "Kitware") -set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake") - -if(WIN32 AND NOT UNIX) - find_program(NSIS_MAKENSIS NAMES makensis - PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] - DOC "Where is makensis.exe located" - ) - if(NOT NSIS_MAKENSIS) - set(CPACK_GENERATOR TGZ) - endif() -endif() -if(UNIX AND NOT APPLE) - set(CPACK_GENERATOR "TGZ;STGZ;TZ") - # find_program(found_compress - # NAMES compress) - # if(found_compress) - # find_program(file_command NAMES file) - # if(NOT file_command) - # set(file_command file) - # endif() - # execute_process(COMMAND ${file_command} ${found_compress} - # OUTPUT_VARIABLE output) - # set(SKIP_TZ FALSE) - # if("${output}" MATCHES "script") - # set(SKIP_TZ TRUE) - # endif() - # if("${output}" MATCHES "dummy.sh") - # set(SKIP_TZ TRUE) - # endif() - # if(NOT SKIP_TZ) - # message("compress found and it was not a script") - # message("output from file command: [${output}]") - # list(APPEND CPACK_GENERATOR "TZ") - # else() - # message("compress found, but it was a script so don't use it") - # message("output from file command: [${output}]") - # endif() - # endif() - find_program(found_bz2 - NAMES bzip2) - if(found_bz2) - list(APPEND CPACK_GENERATOR "TBZ2") - endif() -endif() - -set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install") -set(CMAKE_INSTALL_MFC_LIBRARIES 1) -set(CMAKE_INSTALL_DEBUG_LIBRARIES 1) -set(CMAKE_INSTALL_UCRT_LIBRARIES 1) -include(InstallRequiredSystemLibraries) - -if(CTEST_TEST_CPACK) - set(package_command COMMAND - ${CMAKE_COMMAND} --build . --target package ${SI_CONFIG} - ) - - # Avoid settings that require the .zip file command line tools... - # (just build an NSIS installer without component support) - # - set(CPACK_BINARY_ZIP OFF) - set(CPACK_MONOLITHIC_INSTALL ON) -else() - set(package_command) -endif() - -include(CPack) - -set(install_command COMMAND - ${CMAKE_COMMAND} --build . --target install ${SI_CONFIG} - ) - -add_custom_command( - TARGET ${install_target} - POST_BUILD - ${install_command} - ${package_command} - COMMENT "Install Project" - ) diff --git a/Tests/SimpleInstallS2/InstallScript1.cmake b/Tests/SimpleInstallS2/InstallScript1.cmake deleted file mode 100644 index ef9da57..0000000 --- a/Tests/SimpleInstallS2/InstallScript1.cmake +++ /dev/null @@ -1,5 +0,0 @@ -message("This is install script 1.") -set(INSTALL_SCRIPT_1_DID_RUN 1) -if(INSTALL_CODE_DID_RUN) - message(FATAL_ERROR "Install script 1 did not run before install code.") -endif() diff --git a/Tests/SimpleInstallS2/InstallScript2.cmake b/Tests/SimpleInstallS2/InstallScript2.cmake deleted file mode 100644 index c1d20a3..0000000 --- a/Tests/SimpleInstallS2/InstallScript2.cmake +++ /dev/null @@ -1,14 +0,0 @@ -message("This is install script 2.") -if(INSTALL_SCRIPT_1_DID_RUN) - message("Install script ordering works.") -else() - message(FATAL_ERROR "Install script 1 did not run before install script 2.") -endif() -if(INSTALL_CODE_DID_RUN) - message("Install code ordering works.") -else() - message(FATAL_ERROR "Install script 2 did not run after install code.") -endif() -file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake" - "set(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n" - ) diff --git a/Tests/SimpleInstallS2/InstallScript3.cmake b/Tests/SimpleInstallS2/InstallScript3.cmake deleted file mode 100644 index 6485156..0000000 --- a/Tests/SimpleInstallS2/InstallScript3.cmake +++ /dev/null @@ -1,12 +0,0 @@ -message("This is install script 3.") -set(INSTALL_SCRIPT_3_DID_RUN 1) -if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - message(FATAL_ERROR "Install script 3 did not run before install code with component.") -endif() - -if(CMAKE_INSTALL_COMPONENT) -if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - message(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.") -endif() -endif() diff --git a/Tests/SimpleInstallS2/InstallScript4.cmake b/Tests/SimpleInstallS2/InstallScript4.cmake deleted file mode 100644 index 34d0a73..0000000 --- a/Tests/SimpleInstallS2/InstallScript4.cmake +++ /dev/null @@ -1,22 +0,0 @@ -message("This is install script 4.") -if(INSTALL_SCRIPT_3_DID_RUN) - message("Install script ordering works.") -else() - message(FATAL_ERROR "Install script 3 did not run before install script 4.") -endif() -if(INSTALL_CODE_WITH_COMPONENT_DID_RUN) - message("Install code ordering works.") -else() - message(FATAL_ERROR "Install script 4 did not run after install with component code.") -endif() - -if(CMAKE_INSTALL_COMPONENT) -if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development") - message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"") - message(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.") -endif() -endif() - -file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake" - "set(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n" - ) diff --git a/Tests/SimpleInstallS2/PackageScript.cmake b/Tests/SimpleInstallS2/PackageScript.cmake deleted file mode 100644 index 53b7909..0000000 --- a/Tests/SimpleInstallS2/PackageScript.cmake +++ /dev/null @@ -1,10 +0,0 @@ -message("This is packaging script") -message("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt") - -file(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "") -get_cmake_property(res VARIABLES) -foreach(var ${res}) - file(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt - "${var} \"${${var}}\"\n") -endforeach() - diff --git a/Tests/SimpleInstallS2/PostInstall.cmake b/Tests/SimpleInstallS2/PostInstall.cmake deleted file mode 100644 index d616221..0000000 --- a/Tests/SimpleInstallS2/PostInstall.cmake +++ /dev/null @@ -1,6 +0,0 @@ -message("In post install") -if(PRE_INSTALL_DID_RUN) - message("Pre and post install work fine") -else() - message(FATAL_ERROR "Pre install did not run before post install") -endif() diff --git a/Tests/SimpleInstallS2/PreInstall.cmake b/Tests/SimpleInstallS2/PreInstall.cmake deleted file mode 100644 index 7a9851e..0000000 --- a/Tests/SimpleInstallS2/PreInstall.cmake +++ /dev/null @@ -1,2 +0,0 @@ -message("This is in pre install") -set(PRE_INSTALL_DID_RUN 1) diff --git a/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt b/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt deleted file mode 100644 index 860e104..0000000 --- a/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_executable(TSD TSD.cxx TSD_utils.cxx) -install_files(/MyTest/include FILES TSD.h) -install_targets(/MyTest/bin TSD) diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD.cxx b/Tests/SimpleInstallS2/TestSubDir/TSD.cxx deleted file mode 100644 index 8fc3878..0000000 --- a/Tests/SimpleInstallS2/TestSubDir/TSD.cxx +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdio.h> - -#include "TSD.h" - -int main() -{ - int res = TSD("TEST"); - printf("Hello from TSD\n"); - return res; -} diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD.h b/Tests/SimpleInstallS2/TestSubDir/TSD.h deleted file mode 100644 index 6a3c1af..0000000 --- a/Tests/SimpleInstallS2/TestSubDir/TSD.h +++ /dev/null @@ -1 +0,0 @@ -int TSD(const char*); diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx b/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx deleted file mode 100644 index 0f32894..0000000 --- a/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx +++ /dev/null @@ -1,9 +0,0 @@ -#include <string.h> - -int TSD(const char* foo) -{ - if (strcmp(foo, "TEST") == 0) { - return 0; - } - return 1; -} diff --git a/Tests/SimpleInstallS2/foo.c b/Tests/SimpleInstallS2/foo.c deleted file mode 100644 index 45d5b2b..0000000 --- a/Tests/SimpleInstallS2/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -char* foo = "Foo"; - -int SomeFunctionInFoo() -{ - return 5; -} diff --git a/Tests/SimpleInstallS2/foo.h b/Tests/SimpleInstallS2/foo.h deleted file mode 100644 index 216cdf6..0000000 --- a/Tests/SimpleInstallS2/foo.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -extern char* foo; -extern int SomeFunctionInFoo(); - -#ifdef __cplusplus -} -#endif diff --git a/Tests/SimpleInstallS2/inst.cxx b/Tests/SimpleInstallS2/inst.cxx deleted file mode 100644 index 7815f86..0000000 --- a/Tests/SimpleInstallS2/inst.cxx +++ /dev/null @@ -1,34 +0,0 @@ -#include "foo.h" - -#ifdef STAGE_2 -# include <foo/lib1.h> -# include <foo/lib2renamed.h> -# include <lib3.h> -# include <old/lib2.h> -# include <old/lib3.h> -#else -# include "lib1.h" -# include "lib2.h" -#endif - -#include "lib4.h" - -#include <stdio.h> - -int main() -{ - if (Lib1Func() != 2.0) { - printf("Problem with lib1\n"); - return 1; - } - if (Lib2Func() != 1.0) { - printf("Problem with lib2\n"); - return 1; - } - if (Lib4Func() != 4.0) { - printf("Problem with lib4\n"); - return 1; - } - printf("The value of Foo: %s\n", foo); - return SomeFunctionInFoo() - 5; -} diff --git a/Tests/SimpleInstallS2/inst2.cxx b/Tests/SimpleInstallS2/inst2.cxx deleted file mode 100644 index c70b93a..0000000 --- a/Tests/SimpleInstallS2/inst2.cxx +++ /dev/null @@ -1,2 +0,0 @@ -#define STAGE_2 -#include "inst.cxx" diff --git a/Tests/SimpleInstallS2/lib1.cxx b/Tests/SimpleInstallS2/lib1.cxx deleted file mode 100644 index 7aa9052..0000000 --- a/Tests/SimpleInstallS2/lib1.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib1.h" - -float Lib1Func() -{ - return 2.0; -} diff --git a/Tests/SimpleInstallS2/lib1.h b/Tests/SimpleInstallS2/lib1.h deleted file mode 100644 index 0d64e76..0000000 --- a/Tests/SimpleInstallS2/lib1.h +++ /dev/null @@ -1 +0,0 @@ -extern float Lib1Func(); diff --git a/Tests/SimpleInstallS2/lib2.cxx b/Tests/SimpleInstallS2/lib2.cxx deleted file mode 100644 index dccc48b..0000000 --- a/Tests/SimpleInstallS2/lib2.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib2.h" - -float Lib2Func() -{ - return 1.0; -} diff --git a/Tests/SimpleInstallS2/lib2.h b/Tests/SimpleInstallS2/lib2.h deleted file mode 100644 index 044e775..0000000 --- a/Tests/SimpleInstallS2/lib2.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test2_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib2Func(); diff --git a/Tests/SimpleInstallS2/lib3.cxx b/Tests/SimpleInstallS2/lib3.cxx deleted file mode 100644 index da8dbf9..0000000 --- a/Tests/SimpleInstallS2/lib3.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib3.h" - -float Lib3Func() -{ - return 2.0; -} diff --git a/Tests/SimpleInstallS2/lib3.h b/Tests/SimpleInstallS2/lib3.h deleted file mode 100644 index e02bbc4..0000000 --- a/Tests/SimpleInstallS2/lib3.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test3_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib3Func(); diff --git a/Tests/SimpleInstallS2/lib4.cxx b/Tests/SimpleInstallS2/lib4.cxx deleted file mode 100644 index fbede5c..0000000 --- a/Tests/SimpleInstallS2/lib4.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "lib4.h" - -float Lib4Func() -{ - return 4.0; -} diff --git a/Tests/SimpleInstallS2/lib4.h b/Tests/SimpleInstallS2/lib4.h deleted file mode 100644 index e1a221e..0000000 --- a/Tests/SimpleInstallS2/lib4.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef _WIN32 -# ifdef test4_EXPORTS -# define CM_TEST_LIB_EXPORT __declspec(dllexport) -# else -# define CM_TEST_LIB_EXPORT __declspec(dllimport) -# endif -#else -# define CM_TEST_LIB_EXPORT -#endif - -CM_TEST_LIB_EXPORT float Lib4Func(); diff --git a/Tests/SimpleInstallS2/scripts/.gitattributes b/Tests/SimpleInstallS2/scripts/.gitattributes deleted file mode 100644 index 5e3db2f..0000000 --- a/Tests/SimpleInstallS2/scripts/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -sample_script crlf=input diff --git a/Tests/SimpleInstallS2/scripts/CMakeLists.txt b/Tests/SimpleInstallS2/scripts/CMakeLists.txt deleted file mode 100644 index ec34e8c..0000000 --- a/Tests/SimpleInstallS2/scripts/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -install_programs(/MyTest/share/old3 "^sample_script(\\.bat)?$") diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt index cc29b77..4c3d901 100644 --- a/Tests/UseSWIG/CMakeLists.txt +++ b/Tests/UseSWIG/CMakeLists.txt @@ -88,3 +88,14 @@ add_test(NAME UseSWIG.ModuleVersion2 COMMAND --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + + +add_test(NAME UseSWIG.UseTargetINCLUDE_DIRECTORIES COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES" + "${CMake_BINARY_DIR}/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES" + ${build_generator_args} + --build-project TestModuleVersion2 + --build-options ${build_options} + ) diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt new file mode 100644 index 0000000..d0855bf --- /dev/null +++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestUseTargetINCLUDE_DIRECTORIES CXX) + +include(CTest) + +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +find_package(Python3 REQUIRED COMPONENTS Interpreter Development) + +set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD) +unset(CMAKE_SWIG_FLAGS) + +set_property(SOURCE "example.i" PROPERTY CPLUSPLUS ON) +set_property(SOURCE "example.i" PROPERTY COMPILE_OPTIONS -includeall) + +swig_add_library(example1 + LANGUAGE python + OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/example1" + SOURCES example.i ../example.cxx) +set_target_properties (example1 PROPERTIES + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.." + SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE + OUTPUT_NAME example1 + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1") +target_link_libraries(example1 PRIVATE Python3::Python) + + +# Check that source property override target property +set_property(SOURCE "example.i" PROPERTY USE_TARGET_INCLUDE_DIRECTORIES TRUE) + +swig_add_library(example2 + LANGUAGE python + OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/example2" + SOURCES example.i ../example.cxx) +set_target_properties (example2 PROPERTIES + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.." + SWIG_USE_TARGET_INCLUDE_DIRECTORIES FALSE + OUTPUT_NAME example2 + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2") +target_link_libraries(example2 PRIVATE Python3::Python) diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i new file mode 100644 index 0000000..fbdf724 --- /dev/null +++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i @@ -0,0 +1,9 @@ +/* File : example.i */ +%module example + +%{ +#include "example.h" +%} + +/* Let's just grab the original header file here */ +%include "example.h" diff --git a/Tests/VSNASM/CMakeLists.txt b/Tests/VSNASM/CMakeLists.txt index c2e29df..821d022 100644 --- a/Tests/VSNASM/CMakeLists.txt +++ b/Tests/VSNASM/CMakeLists.txt @@ -1,10 +1,20 @@ cmake_minimum_required(VERSION 2.8.12) project(VSNASM C ASM_NASM) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) add_definitions(-DTESTx64) string(APPEND CMAKE_ASM_NASM_FLAGS " -DTEST2x64") else() add_definitions(-DTESTi386) endif() + +# Test quoting for definitions with spaces. +add_definitions("-DEAX_COMMA_SPACE_ZERO=eax, 0") + +# Test quoting for file names with spaces. The file is generated because CMake +# itself cannot have files with spaces. +file(READ bar.asm BAR_ASM_CONTENTS) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm" "${BAR_ASM_CONTENTS}") + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) -add_executable(VSNASM main.c foo.asm) +add_executable(VSNASM main.c foo.asm "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm") diff --git a/Tests/VSNASM/bar.asm b/Tests/VSNASM/bar.asm new file mode 100644 index 0000000..b486d82 --- /dev/null +++ b/Tests/VSNASM/bar.asm @@ -0,0 +1,13 @@ +section .text +%ifdef TEST2x64 +global bar +%else +global _bar +%endif +%ifdef TESTx64 +bar: +%else +_bar: +%endif + mov EAX_COMMA_SPACE_ZERO + ret diff --git a/Tests/VSNASM/include/foo-proc.asm b/Tests/VSNASM/include/foo-proc.asm index 450a791..eb5bb2b 100644 --- a/Tests/VSNASM/include/foo-proc.asm +++ b/Tests/VSNASM/include/foo-proc.asm @@ -3,5 +3,5 @@ foo: %else _foo: %endif - mov eax, 0 + mov EAX_COMMA_SPACE_ZERO ret diff --git a/Tests/VSNASM/main.c b/Tests/VSNASM/main.c index 18ddb78..b1401b6 100644 --- a/Tests/VSNASM/main.c +++ b/Tests/VSNASM/main.c @@ -1,5 +1,6 @@ extern int foo(void); +extern int bar(void); int main(void) { - return foo(); + return foo() + bar(); } diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake index 04a74ac..f2ca2d5 100644 --- a/Utilities/Release/linux64_release.cmake +++ b/Utilities/Release/linux64_release.cmake @@ -34,6 +34,7 @@ OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.1.0h/include OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.1.0h/lib/libssl.a PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 CPACK_SYSTEM_NAME:STRING=Linux-x86_64 +BUILD_CursesDialog:BOOL=ON BUILD_QtDialog:BOOL=TRUE CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 diff --git a/Utilities/Release/osx_release.cmake b/Utilities/Release/osx_release.cmake index c69eb11..be11d47 100644 --- a/Utilities/Release/osx_release.cmake +++ b/Utilities/Release/osx_release.cmake @@ -19,6 +19,7 @@ CMAKE_OSX_ARCHITECTURES:STRING=x86_64 CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7 CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CPACK_SYSTEM_NAME:STRING=Darwin-x86_64 +BUILD_CursesDialog:BOOL=ON BUILD_QtDialog:BOOL=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 CMake_INSTALL_DEPENDENCIES:BOOL=ON diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index b0c8f71..ebf44da 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -144,6 +144,7 @@ class _cmake_index_entry: _cmake_index_objs = { 'command': _cmake_index_entry('command'), + 'cpack_gen': _cmake_index_entry('cpack generator'), 'envvar': _cmake_index_entry('envvar'), 'generator': _cmake_index_entry('generator'), 'manual': _cmake_index_entry('manual'), @@ -325,6 +326,7 @@ class CMakeDomain(Domain): label = 'CMake' object_types = { 'command': ObjType('command', 'command'), + 'cpack_gen': ObjType('cpack_gen', 'cpack_gen'), 'envvar': ObjType('envvar', 'envvar'), 'generator': ObjType('generator', 'generator'), 'variable': ObjType('variable', 'variable'), @@ -358,6 +360,7 @@ class CMakeDomain(Domain): } roles = { 'command': CMakeXRefRole(fix_parens = True, lowercase = True), + 'cpack_gen': CMakeXRefRole(), 'envvar': CMakeXRefRole(), 'generator': CMakeXRefRole(), 'variable': CMakeXRefRole(), diff --git a/Utilities/Sphinx/create_identifiers.py b/Utilities/Sphinx/create_identifiers.py index e638950..6716b48 100755 --- a/Utilities/Sphinx/create_identifiers.py +++ b/Utilities/Sphinx/create_identifiers.py @@ -21,6 +21,7 @@ newlines = [] for line in lines: mapping = (("command", "command"), + ("cpack generator", "cpack_gen"), ("envvar", "envvar"), ("variable", "variable"), ("generator", "generator"), |