diff options
106 files changed, 1157 insertions, 709 deletions
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 6010b64..3c589b4 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -44,9 +44,9 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "warning.*directory name.*CMake-Xcode.*/bin/.*does not exist.*" "stl_deque.h:1051" "(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)" - "(Lexer|Parser).*warning.*statement is unreachable" + "(Lexer|Parser).*warning.*(statement is unreachable|will never be executed)" "PGC-W-0095-Type cast required for this conversion.*ProcessUNIX.c" - "[Qq]t([Cc]ore|[Gg]ui).*warning.*conversion.*may alter its value" + "[Qq]t([Cc]ore|[Gg]ui|[Ww]idgets).*warning.*conversion.*may alter its value" "warning:.*is.*very unsafe.*consider using.*" "warning:.*is.*misused, please use.*" "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element" diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index d025d63..7f31970 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -664,213 +664,408 @@ For example, a ``Modules/Findxxx.cmake`` module may contain: <code> endmacro() +After the top documentation block, leave a *BLANK* line, and then add a +copyright and licence notice block like this one (change only the year +range and name) + +.. code-block:: cmake + + #============================================================================= + # Copyright 2009-2011 Your Name + # + # Distributed under the OSI-approved BSD License (the "License"); + # see accompanying file Copyright.txt for details. + # + # This software is distributed WITHOUT ANY WARRANTY; without even the + # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + # See the License for more information. + #============================================================================= + # (To distribute this file outside of CMake, substitute the full + # License text for the above reference.) + +Test the documentation formatting by running +``cmake --help-module <module-name>``, and also by enabling the +``SPHINX_HTML`` and ``SPHINX_MAN`` options to build the documentation. +Edit the comments until generated documentation looks satisfactory. To +have a .cmake file in this directory NOT show up in the modules +documentation, simply leave out the ``Help/module/<module-name>.rst`` +file and the ``Help/manual/cmake-modules.7.rst`` toctree entry. + + Find Modules ------------ A "find module" is a ``Modules/Find<package>.cmake`` file to be loaded by the :command:`find_package` command when invoked for ``<package>``. -We would like all ``FindXxx.cmake`` files to produce consistent variable -names. Please use the following consistent variable names for general use. +The primary task of a find module is to determine whether a package +exists on the system, set the ``<package>_FOUND`` variable to reflect +this and provide any variables, macros and imported targets required to +use the package. + +The traditional approach is to use variables for everything, including +libraries and executables: see the `Standard Variable Names`_ section +below. This is what most of the existing find modules provided by CMake +do. -Xxx_INCLUDE_DIRS - The final set of include directories listed in one variable for use by client - code. This should not be a cache entry. +The more modern approach is to behave as much like +``<package>Config.cmake`` files as possible, by providing imported +targets. As well as matching how ``*Config.cmake`` files work, the +libraries, include directories and compile definitions are all set just +by using the target in a :command:`target_link_libraries` call. The +disadvantage is that ``*Config.cmake`` files of projects that use +imported targets from find modules may require more work to make sure +those imported targets that are in the link interface are available. + +In either case (or even when providing both variables and imported +targets), find modules should provide backwards compatibility with old +versions that had the same name. + +A FindFoo.cmake module will typically be loaded by the command:: + + find_package(Foo [major[.minor[.patch[.tweak]]]] + [EXACT] [QUIET] [REQUIRED] + [[COMPONENTS] [components...]] + [OPTIONAL_COMPONENTS components...] + [NO_POLICY_SCOPE]) + +See the :command:`find_package` documentation for details on what +variables are set for the find module. Most of these are dealt with by +using :module:`FindPackageHandleStandardArgs`. + +Briefly, the module should only locate versions of the package +compatible with the requested version, as described by the +``Foo_FIND_VERSION`` family of variables. If ``Foo_FIND_QUIETLY`` is +set to true, it should avoid printing messages, including anything +complaining about the package not being found. If ``Foo_FIND_REQUIRED`` +is set to true, the module should issue a ``FATAL_ERROR`` if the package +cannot be found. If neither are set to true, it should print a +non-fatal message if it cannot find the package. + +Packages that find multiple semi-independent parts (like bundles of +libraries) should search for the components listed in +``Foo_FIND_COMPONENTS`` if it is set , and only set ``Foo_FOUND`` to +true if for each searched-for component ``<c>`` that was not found, +``Foo_FIND_REQUIRED_<c>`` is not set to true. The ``HANDLE_COMPONENTS`` +argument of ``find_package_handle_standard_args()`` can be used to +implement this. + +If ``Foo_FIND_COMPONENTS`` is not set, which modules are searched for +and required is up to the find module, but should be documented. + +For internal implementation, it is a generally accepted convention that +variables starting with underscore are for temporary use only. + +Like all modules, find modules should be properly documented. To add a +module to the CMake documentation, follow the steps in the `Module +Documentation`_ section above. + + + +Standard Variable Names +~~~~~~~~~~~~~~~~~~~~~~~ + +For a ``FindXxx.cmake`` module that takes the approach of setting +variables (either instead of or in addition to creating imported +targets), the following variable names should be used to keep things +consistent between find modules. Note that all variables start with +``Xxx_`` to make sure they do not interfere with other find modules; the +same consideration applies to macros, functions and imported targets. + +``Xxx_INCLUDE_DIRS`` + The final set of include directories listed in one variable for use by + client code. This should not be a cache entry. + +``Xxx_LIBRARIES`` + The libraries to link against to use Xxx. These should include full + paths. This should not be a cache entry. + +``Xxx_DEFINITIONS`` + Definitions to use when compiling code that uses Xxx. This really + shouldn't include options such as ``-DHAS_JPEG`` that a client + source-code file uses to decide whether to ``#include <jpeg.h>`` + +``Xxx_EXECUTABLE`` + Where to find the Xxx tool. + +``Xxx_Yyy_EXECUTABLE`` + Where to find the Yyy tool that comes with Xxx. + +``Xxx_LIBRARY_DIRS`` + Optionally, the final set of library directories listed in one + variable for use by client code. This should not be a cache entry. + +``Xxx_ROOT_DIR`` + Where to find the base directory of Xxx. + +``Xxx_VERSION_Yy`` + Expect Version Yy if true. Make sure at most one of these is ever true. + +``Xxx_WRAP_Yy`` + If False, do not try to use the relevant CMake wrapping command. + +``Xxx_Yy_FOUND`` + If False, optional Yy part of Xxx sytem is not available. -Xxx_LIBRARIES - The libraries to link against to use Xxx. These should include full paths. - This should not be a cache entry. +``Xxx_FOUND`` + Set to false, or undefined, if we haven't found, or don't want to use + Xxx. -Xxx_DEFINITIONS - Definitions to use when compiling code that uses Xxx. This really shouldn't - include options such as (-DHAS_JPEG)that a client source-code file uses to - decide whether to #include <jpeg.h> +``Xxx_NOT_FOUND_MESSAGE`` + Should be set by config-files in the case that it has set + ``Xxx_FOUND`` to FALSE. The contained message will be printed by the + :command:`find_package` command and by + ``find_package_handle_standard_args()`` to inform the user about the + problem. -Xxx_EXECUTABLE - Where to find the Xxx tool. +``Xxx_RUNTIME_LIBRARY_DIRS`` + Optionally, the runtime library search path for use when running an + executable linked to shared libraries. The list should be used by + user code to create the ``PATH`` on windows or ``LD_LIBRARY_PATH`` on + UNIX. This should not be a cache entry. -Xxx_Yyy_EXECUTABLE - Where to find the Yyy tool that comes with Xxx. +``Xxx_VERSION`` + The full version string of the package found, if any. Note that many + existing modules provide ``Xxx_VERSION_STRING`` instead. -Xxx_LIBRARY_DIRS - Optionally, the final set of library directories listed in one variable for - use by client code. This should not be a cache entry. +``Xxx_VERSION_MAJOR`` + The major version of the package found, if any. -Xxx_ROOT_DIR - Where to find the base directory of Xxx. +``Xxx_VERSION_MINOR`` + The minor version of the package found, if any. -Xxx_VERSION_Yy - Expect Version Yy if true. Make sure at most one of these is ever true. +``Xxx_VERSION_PATCH`` + The patch version of the package found, if any. -Xxx_WRAP_Yy - If False, do not try to use the relevant CMake wrapping command. +The following names should not usually be used in CMakeLists.txt files, but +are typically cache variables for users to edit and control the +behaviour of find modules (like entering the path to a library manually) -Xxx_Yy_FOUND - If False, optional Yy part of Xxx sytem is not available. +``Xxx_LIBRARY`` + The path of the Xxx library (as used with :command:`find_library`, for + example). -Xxx_FOUND - Set to false, or undefined, if we haven't found, or don't want to use Xxx. +``Xxx_Yy_LIBRARY`` + The path of the Yy library that is part of the Xxx system. It may or + may not be required to use Xxx. -Xxx_NOT_FOUND_MESSAGE - Should be set by config-files in the case that it has set Xxx_FOUND to FALSE. - The contained message will be printed by the find_package() command and by - find_package_handle_standard_args() to inform the user about the problem. +``Xxx_INCLUDE_DIR`` + Where to find headers for using the Xxx library. -Xxx_RUNTIME_LIBRARY_DIRS - Optionally, the runtime library search path for use when running an - executable linked to shared libraries. The list should be used by user code - to create the PATH on windows or LD_LIBRARY_PATH on unix. This should not be - a cache entry. +``Xxx_Yy_INCLUDE_DIR`` + Where to find headers for using the Yy library of the Xxx system. -Xxx_VERSION_STRING - A human-readable string containing the version of the package found, if any. +To prevent users being overwhelmed with settings to configure, try to +keep as many options as possible out of the cache, leaving at least one +option which can be used to disable use of the module, or locate a +not-found library (e.g. ``Xxx_ROOT_DIR``). For the same reason, mark +most cache options as advanced. -Xxx_VERSION_MAJOR - The major version of the package found, if any. +While these are the standard variable names, you should provide +backwards compatibility for any old names that were actually in use. +Make sure you comment them as deprecated, so that no-one starts using +them. -Xxx_VERSION_MINOR - The minor version of the package found, if any. -Xxx_VERSION_PATCH - The patch version of the package found, if any. -You do not have to provide all of the above variables. You should provide -Xxx_FOUND under most circumstances. If Xxx is a library, then Xxx_LIBRARIES, -should also be defined, and Xxx_INCLUDE_DIRS should usually be defined (I -guess libm.a might be an exception) +A Sample Find Module +~~~~~~~~~~~~~~~~~~~~ -The following names should not usually be used in CMakeLists.txt files, but -they may be usefully modified in users' CMake Caches to control stuff. +We will describe how to create a simple find module for a library +``Foo``. -Xxx_LIBRARY - Name of Xxx Library. A User may set this and Xxx_INCLUDE_DIR to ignore to - force non-use of Xxx. +The first thing that is needed is documentation. CMake's documentation +system requires you to start the file with a documentation marker and +the name of the module. You should follow this with a simple statement +of what the module does. -Xxx_Yy_LIBRARY - Name of Yy library that is part of the Xxx system. It may or may not be - required to use Xxx. +.. code-block:: cmake -Xxx_INCLUDE_DIR - Where to find xxx.h, etc. (Xxx_INCLUDE_PATH was considered bad because a path - includes an actual filename.) + #.rst: + # FindFoo + # ------- + # + # Finds the Foo library + # -Xxx_Yy_INCLUDE_DIR - Where to find xxx_yy.h, etc. +More description may be required for some packages. If there are +caveats or other details users of the module should be aware of, you can +add further paragraphs below this. Then you need to document what +variables and imported targets are set by the module, such as -For tidiness's sake, try to keep as many options as possible out of the cache, -leaving at least one option which can be used to disable use of the module, or -locate a not-found library (e.g. Xxx_ROOT_DIR). For the same reason, mark -most cache options as advanced. +.. code-block:: cmake -If you need other commands to do special things then it should still begin -with ``Xxx_``. This gives a sort of namespace effect and keeps things tidy for the -user. You should put comments describing all the exported settings, plus -descriptions of any the users can use to control stuff. + # This will define the following variables:: + # + # Foo_FOUND - True if the system has the Foo library + # Foo_VERSION - The version of the Foo library which was found + # + # and the following imported targets:: + # + # Foo::Foo - The Foo library -You really should also provide backwards compatibility any old settings that -were actually in use. Make sure you comment them as deprecated, so that -no-one starts using them. +If the package provides any macros, they should be listed here, but can +be documented where they are defined. See the `Module +Documentation`_ section above for more details. -To add a module to the CMake documentation, follow the steps in the -`Module Documentation`_ section above. Test the documentation formatting -by running ``cmake --help-module FindXxx``, and also by enabling the -``SPHINX_HTML`` and ``SPHINX_MAN`` options to build the documentation. -Edit the comments until generated documentation looks satisfactory. -To have a .cmake file in this directory NOT show up in the modules -documentation, simply leave out the ``Help/module/<module-name>.rst`` file -and the ``Help/manual/cmake-modules.7.rst`` toctree entry. +After the documentation, leave a blank line, and then add a copyright and +licence notice block -After the documentation, leave a *BLANK* line, and then add a -copyright and licence notice block like this one:: +.. code-block:: cmake - #============================================================================= - # Copyright 2009-2011 Your Name - # - # Distributed under the OSI-approved BSD License (the "License"); - # see accompanying file Copyright.txt for details. - # - # This software is distributed WITHOUT ANY WARRANTY; without even the - # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - # See the License for more information. - #============================================================================= - # (To distribute this file outside of CMake, substitute the full - # License text for the above reference.) - -The layout of the notice block is strictly enforced by the ``ModuleNotices`` -test. Only the year range and name may be changed freely. - -A FindXxx.cmake module will typically be loaded by the command:: - - FIND_PACKAGE(Xxx [major[.minor[.patch[.tweak]]]] [EXACT] - [QUIET] [[REQUIRED|COMPONENTS] [components...]]) - -If any version numbers are given to the command it will set the following -variables before loading the module: - -Xxx_FIND_VERSION - full requested version string - -Xxx_FIND_VERSION_MAJOR - major version if requested, else 0 - -Xxx_FIND_VERSION_MINOR - minor version if requested, else 0 - -Xxx_FIND_VERSION_PATCH - patch version if requested, else 0 - -Xxx_FIND_VERSION_TWEAK - tweak version if requested, else 0 - -Xxx_FIND_VERSION_COUNT - number of version components, 0 to 4 - -Xxx_FIND_VERSION_EXACT - true if EXACT option was given - -If the find module supports versioning it should locate a version of -the package that is compatible with the version requested. If a -compatible version of the package cannot be found the module should -not report success. The version of the package found should be stored -in "Xxx_VERSION..." version variables documented by the module. - -If the QUIET option is given to the command it will set the variable -Xxx_FIND_QUIETLY to true before loading the FindXxx.cmake module. If -this variable is set the module should not complain about not being -able to find the package. If the -REQUIRED option is given to the command it will set the variable -Xxx_FIND_REQUIRED to true before loading the FindXxx.cmake module. If -this variable is set the module should issue a FATAL_ERROR if the -package cannot be found. -If neither the QUIET nor REQUIRED options are given then the -FindXxx.cmake module should look for the package and complain without -error if the module is not found. - -FIND_PACKAGE() will set the variable CMAKE_FIND_PACKAGE_NAME to -contain the actual name of the package. - -A package can provide sub-components. -Those components can be listed after the COMPONENTS (or REQUIRED) or -OPTIONAL_COMPONENTS keywords. The set of all listed components will be -specified in a Xxx_FIND_COMPONENTS variable. -For each package-specific component, say Yyy, a variable Xxx_FIND_REQUIRED_Yyy -will be set to true if it listed after COMPONENTS and it will be set to false -if it was listed after OPTIONAL_COMPONENTS. -Using those variables a FindXxx.cmake module and also a XxxConfig.cmake -package configuration file can determine whether and which components have -been requested, and whether they were requested as required or as optional. -For each of the requested components a Xxx_Yyy_FOUND variable should be set -accordingly. -The per-package Xxx_FOUND variable should be only set to true if all requested -required components have been found. A missing optional component should not -keep the Xxx_FOUND variable from being set to true. -If the package provides Xxx_INCLUDE_DIRS and Xxx_LIBRARIES variables, the -include dirs and libraries for all components which were requested and which -have been found should be added to those two variables. - -To get this behavior you can use the FIND_PACKAGE_HANDLE_STANDARD_ARGS() -macro, as an example see FindJPEG.cmake. - -For internal implementation, it's a generally accepted convention that -variables starting with underscore are for temporary use only. (variable -starting with an underscore are not intended as a reserved prefix). + #============================================================================= + # Copyright 2009-2011 Your Name + # + # Distributed under the OSI-approved BSD License (the "License"); + # see accompanying file Copyright.txt for details. + # + # This software is distributed WITHOUT ANY WARRANTY; without even the + # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + # See the License for more information. + #============================================================================= + # (To distribute this file outside of CMake, substitute the full + # License text for the above reference.) + +If the module is new to CMake, you may want to provide a warning for +projects that do not require a high enough CMake version. + +.. code-block:: cmake + + if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.0.0) + message(AUTHOR_WARNING "Your project should require at least CMake 3.0.0 to use FindFoo.cmake") + endif() + +Now the actual libraries and so on have to be found. The code here will +obviously vary from module to module (dealing with that, after all, is the +point of find modules), but there tends to be a common pattern for libraries. + +First, we try to use ``pkg-config`` to find the library. Note that we +cannot rely on this, as it may not be available, but it provides a good +starting point. + +.. code-block:: cmake + + find_package(PkgConfig) + pkg_check_modules(PC_Foo QUIET Foo) + +This should define some variables starting ``PC_Foo_`` that contain the +information from the ``Foo.pc`` file. + +Now we need to find the libraries and include files; we use the +information from ``pkg-config`` to provide hints to CMake about where to +look. + +.. code-block:: cmake + + find_path(Foo_INCLUDE_DIR + NAMES foo.h + PATHS ${PC_Foo_INCLUDE_DIRS} + # if you need to put #include <Foo/foo.h> in your code, add: + PATH_SUFFIXES Foo + ) + find_library(Foo_LIBRARY + NAMES foo + PATHS ${PC_Foo_LIBRARY_DIRS} + ) + +If you have a good way of getting the version (from a header file, for +example), you can use that information to set ``Foo_VERSION`` (although +note that find modules have traditionally used ``Foo_VERSION_STRING``, +so you may want to set both). Otherwise, attempt to use the information +from ``pkg-config`` + +.. code-block:: cmake + + set(Foo_VERSION ${PC_Foo_VERSION}) + +Now we can use :module:`FindPackageHandleStandardArgs` to do most of the +rest of the work for us + +.. code-block:: cmake + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Foo + FOUND_VAR Foo_FOUND + REQUIRED_VARS + Foo_LIBRARY + Foo_INCLUDE_DIR + VERSION_VAR Foo_VERSION + ) + +This will check that the ``REQUIRED_VARS`` contain values (that do not +end in ``-NOTFOUND``) and set ``Foo_FOUND`` appropriately. It will also +cache those values. If ``Foo_VERSION`` is set, and a required version +was passed to :command:`find_package`, it will check the requested version +against the one in ``Foo_VERSION``. It will also print messages as +appropriate; note that if the package was found, it will print the +contents of the first required variable to indicate where it was found. + +At this point, we have to provide a way for users of the find module to +link to the library or libraries that were found. There are two +approaches, as discussed in the `Find Modules`_ section above. The +traditional variable approach looks like + +.. code-block:: cmake + + if(Foo_FOUND) + set(Foo_LIBRARIES ${Foo_LIBRARY}) + set(Foo_INCLUDE_DIRS ${Foo_INCLUDE_DIR}) + set(Foo_DEFINITIONS ${PC_Foo_CFLAGS_OTHER}) + endif() + +If more than one library was found, all of them should be included in +these variables (see the `Standard Variable Names`_ section for more +information). + +When providing imported targets, these should be namespaced (hence the +``Foo::`` prefix); CMake will recognize that values passed to +:command:`target_link_libraries` that contain ``::`` in their name are +supposed to be imported targets (rather than just library names), and +will produce appropriate diagnostic messages if that target does not +exist (see policy :policy:`CMP0028`). + +.. code-block:: cmake + + if(Foo_FOUND AND NOT TARGET Foo::Foo) + add_library(Foo::Foo UNKNOWN IMPORTED) + set_target_properties(Foo::Foo PROPERTIES + IMPORTED_LOCATION "${Foo_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Foo_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Foo_INCLUDE_DIR}" + ) + endif() + +One thing to note about this is that the ``INTERFACE_INCLUDE_DIRECTORIES`` and +similar properties should only contain information about the target itself, and +not any of its dependencies. Instead, those dependencies should also be +targets, and CMake should be told that they are dependencies of this target. +CMake will then combine all the necessary information automatically. + +We should also provide some information about the package, such as where to +download it. + +.. code-block:: cmake + + include(FeatureSummary) + set_package_properties(Foo PROPERTIES + URL "http://www.foo.example.com/" + DESCRIPTION "A library for doing useful things" + ) + +Most of the cache variables should be hidden in the ``ccmake`` interface unless +the user explicitly asks to edit them. + +.. code-block:: cmake + + mark_as_advanced( + Foo_INCLUDE_DIR + Foo_LIBRARY + ) + +If this module replaces an older version, you should set compatibility variables +to cause the least disruption possible. + +.. code-block:: cmake + + # compatibility variables + set(Foo_VERSION_STRING ${Foo_VERSION}) diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 17263d4..dfda8dc 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -190,4 +190,6 @@ property is non-empty:: Content of ``...`` converted to a C identifier. ``$<TARGET_OBJECTS:objLib>`` List of objects resulting from build of ``objLib``. ``objLib`` must be an - object of type ``OBJECT_LIBRARY``. + object of type ``OBJECT_LIBRARY``. This expression may only be used in + the sources of :command:`add_library` and :command:`add_executable` + commands. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 8b4ce26..4fac6a5 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -131,6 +131,7 @@ Variables that Change Behavior /variable/CMAKE_MODULE_PATH /variable/CMAKE_NOT_USING_CONFIG_FLAGS /variable/CMAKE_POLICY_DEFAULT_CMPNNNN + /variable/CMAKE_POLICY_WARNING_CMPNNNN /variable/CMAKE_PREFIX_PATH /variable/CMAKE_PROGRAM_PATH /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE diff --git a/Help/policy/CMP0025.rst b/Help/policy/CMP0025.rst index f3b39e3..8d19edf 100644 --- a/Help/policy/CMP0025.rst +++ b/Help/policy/CMP0025.rst @@ -1,21 +1,27 @@ CMP0025 ------- -Compiler id for Apple Clang is now AppleClang. +Compiler id for Apple Clang is now ``AppleClang``. -CMake >= 3.0 recognize that Apple Clang is a different compiler +CMake 3.0 and above recognize that Apple Clang is a different compiler than upstream Clang and that they have different version numbers. -CMake now prefers to present this to projects by setting -CMAKE_<LANG>_COMPILER_ID to "AppleClang" instead of "Clang". However, -existing projects may assume the compiler id for Apple Clang is just -"Clang" as it was in CMake < 3.0. Therefore this policy determines -for Apple Clang which compiler id to report in -CMAKE_<LANG>_COMPILER_ID after <LANG> is enabled by the project() or -enable_language() command. +CMake now prefers to present this to projects by setting the +:variable:`CMAKE_<LANG>_COMPILER_ID` variable to ``AppleClang`` instead +of ``Clang``. However, existing projects may assume the compiler id for +Apple Clang is just ``Clang`` as it was in CMake versions prior to 3.0. +Therefore this policy determines for Apple Clang which compiler id to +report in the :variable:`CMAKE_<LANG>_COMPILER_ID` variable after +language ``<LANG>`` is enabled by the :command:`project` or +:command:`enable_language` command. The policy must be set prior +to the invocation of either command. -The OLD behavior for this policy is to use compiler id "Clang". The -NEW behavior for this policy is to use compiler id "AppleClang". +The OLD behavior for this policy is to use compiler id ``Clang``. The +NEW behavior for this policy is to use compiler id ``AppleClang``. -This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +This policy was introduced in CMake version 3.0. Use the +:command:`cmake_policy` command to set this policy to OLD or NEW explicitly. +Unlike most policies, CMake version |release| does *not* warn +by default when this policy is not set and simply uses OLD behavior. +See documentation of the +:variable:`CMAKE_POLICY_WARNING_CMP0025 <CMAKE_POLICY_WARNING_CMP<NNNN>>` +variable to control the warning. diff --git a/Help/policy/CMP0047.rst b/Help/policy/CMP0047.rst index c2d951b..26ae439 100644 --- a/Help/policy/CMP0047.rst +++ b/Help/policy/CMP0047.rst @@ -1,16 +1,28 @@ CMP0047 ------- -Use QCC compiler id for the qcc drivers on QNX. +Use ``QCC`` compiler id for the qcc drivers on QNX. -CMake 2.8.12 and lower assigned the QNX qcc and QCC compiler drivers the "GNU" -compiler id. +CMake 3.0 and above recognize that the QNX qcc compiler driver is +different from the GNU compiler. +CMake now prefers to present this to projects by setting the +:variable:`CMAKE_<LANG>_COMPILER_ID` variable to ``QCC`` instead +of ``GNU``. However, existing projects may assume the compiler id for +QNX qcc is just ``GNU`` as it was in CMake versions prior to 3.0. +Therefore this policy determines for QNX qcc which compiler id to +report in the :variable:`CMAKE_<LANG>_COMPILER_ID` variable after +language ``<LANG>`` is enabled by the :command:`project` or +:command:`enable_language` command. The policy must be set prior +to the invocation of either command. -The OLD behavior for this policy is to use the "GNU" compiler id for the qcc -and QCC compiler drivers. The NEW behavior for this policy is to use the "QCC" -compiler id for those drivers. +The OLD behavior for this policy is to use the ``GNU`` compiler id +for the qcc and QCC compiler drivers. The NEW behavior for this policy +is to use the ``QCC`` compiler id for those drivers. -This policy was introduced in CMake version 3.0. -CMake version |release| warns when the policy is not set and uses -OLD behavior. Use the cmake_policy command to set it to OLD or -NEW explicitly. +This policy was introduced in CMake version 3.0. Use the +:command:`cmake_policy` command to set this policy to OLD or NEW explicitly. +Unlike most policies, CMake version |release| does *not* warn +by default when this policy is not set and simply uses OLD behavior. +See documentation of the +:variable:`CMAKE_POLICY_WARNING_CMP0047 <CMAKE_POLICY_WARNING_CMP<NNNN>>` +variable to control the warning. diff --git a/Help/release/dev/file-GENERATE-TARGET_OBJECTS.rst b/Help/release/dev/file-GENERATE-TARGET_OBJECTS.rst deleted file mode 100644 index 853a803..0000000 --- a/Help/release/dev/file-GENERATE-TARGET_OBJECTS.rst +++ /dev/null @@ -1,6 +0,0 @@ -file-GENERATE-TARGET_OBJECTS ----------------------------- - -* The :command:`file(GENERATE)` subcommand learned to evaluate the - ``TARGET_OBJECTS`` - :manual:`generator expression <cmake-generator-expressions(7)>`. diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst new file mode 100644 index 0000000..b563aea --- /dev/null +++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst @@ -0,0 +1,17 @@ +CMAKE_POLICY_WARNING_CMP<NNNN> +------------------------------ + +Explicitly enable or disable the warning when CMake Policy ``CMP<NNNN>`` +is not set. This is meaningful only for the few policies that do not +warn by default: + +* ``CMAKE_POLICY_WARNING_CMP0025`` controls the warning for + policy :policy:`CMP0025`. +* ``CMAKE_POLICY_WARNING_CMP0047`` controls the warning for + policy :policy:`CMP0047`. + +This variable should not be set by a project in CMake code. Project +developers running CMake may set this variable in their cache to +enable the warning (e.g. ``-DCMAKE_POLICY_WARNING_CMP<NNNN>=ON``). +Alternatively, running :manual:`cmake(1)` with the ``--debug-output`` +or ``--trace`` option will also enable the warning. diff --git a/Modules/CMakePushCheckState.cmake b/Modules/CMakePushCheckState.cmake index 39f0023..bf4ec0e 100644 --- a/Modules/CMakePushCheckState.cmake +++ b/Modules/CMakePushCheckState.cmake @@ -53,6 +53,7 @@ macro(CMAKE_RESET_CHECK_STATE) set(CMAKE_REQUIRED_DEFINITIONS) set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_QUIET) endmacro() @@ -68,6 +69,7 @@ macro(CMAKE_PUSH_CHECK_STATE) set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS}) + set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET}) if (ARGC GREATER 0 AND ARGV0 STREQUAL "RESET") cmake_reset_check_state() @@ -84,6 +86,7 @@ macro(CMAKE_POP_CHECK_STATE) set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1") endif() diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index c2f6915..8721d55 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2005-2009 Kitware, Inc. @@ -67,7 +68,9 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR) file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_compile(${VAR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c @@ -85,13 +88,17 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR) if(${VAR}) set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Success") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") else() - message(STATUS "Performing Test ${VAR} - Failed") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Failed") + endif() set(${VAR} "" CACHE INTERNAL "Test ${VAR}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index 2e68454..a4fa57e 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -56,7 +57,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR) file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_run(${VAR}_EXITCODE ${VAR}_COMPILED ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c @@ -73,7 +76,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR) # if the return value was 0 then it worked if("${${VAR}_EXITCODE}" EQUAL 0) set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Success") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" @@ -86,7 +91,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR) set(${VAR} "" CACHE INTERNAL "Test ${VAR}") endif() - message(STATUS "Performing Test ${VAR} - Failed") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Failed") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index c7ef5ec..6ce64a1 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2005-2009 Kitware, Inc. @@ -68,7 +69,9 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_compile(${VAR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx @@ -86,13 +89,17 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) if(${VAR}) set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Success") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") else() - message(STATUS "Performing Test ${VAR} - Failed") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Failed") + endif() set(${VAR} "" CACHE INTERNAL "Test ${VAR}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index 4e3ff6c..c655863 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -56,7 +57,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_run(${VAR}_EXITCODE ${VAR}_COMPILED ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx @@ -74,7 +77,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) # if the return value was 0 then it worked if("${${VAR}_EXITCODE}" EQUAL 0) set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Success") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" @@ -87,7 +92,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) set(${VAR} "" CACHE INTERNAL "Test ${VAR}") endif() - message(STATUS "Performing Test ${VAR} - Failed") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Failed") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake index aa62fbf..084fbb4 100644 --- a/Modules/CheckCXXSymbolExists.cmake +++ b/Modules/CheckCXXSymbolExists.cmake @@ -27,6 +27,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2003-2011 Kitware, Inc. diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index e232bd7..bfd1836 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -20,6 +20,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2011 Kitware, Inc. @@ -40,7 +41,9 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) if("${VARIABLE}" MATCHES "^${VARIABLE}$") set(MACRO_CHECK_FUNCTION_DEFINITIONS "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "Looking for ${FUNCTION}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION}") + endif() if(CMAKE_REQUIRED_LIBRARIES) set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) @@ -63,12 +66,16 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") - message(STATUS "Looking for ${FUNCTION} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} - found") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") else() - message(STATUS "Looking for ${FUNCTION} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists failed with the following output:\n" diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index 9dc1648..ea73267 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -24,6 +24,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -49,7 +50,9 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE) set(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c) - message(STATUS "Looking for ${INCLUDE}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${INCLUDE}") + endif() if(${ARGC} EQUAL 3) set(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}") @@ -69,14 +72,18 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE) endif() if(${VARIABLE}) - message(STATUS "Looking for ${INCLUDE} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${INCLUDE} - found") + endif() set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the include file ${INCLUDE} " "exists passed with the following output:\n" "${OUTPUT}\n\n") else() - message(STATUS "Looking for ${INCLUDE} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${INCLUDE} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the include file ${INCLUDE} " diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index fa36a3f..39abeff 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -28,6 +28,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -53,7 +54,9 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) set(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx) - message(STATUS "Looking for C++ include ${INCLUDE}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for C++ include ${INCLUDE}") + endif() if(${ARGC} EQUAL 3) set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}") @@ -73,14 +76,18 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) endif() if(${VARIABLE}) - message(STATUS "Looking for C++ include ${INCLUDE} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for C++ include ${INCLUDE} - found") + endif() set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the include file ${INCLUDE} " "exists passed with the following output:\n" "${OUTPUT}\n\n") else() - message(STATUS "Looking for C++ include ${INCLUDE} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for C++ include ${INCLUDE} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the include file ${INCLUDE} " diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index 182067f..6aa0f2b 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -23,6 +23,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2003-2012 Kitware, Inc. @@ -66,7 +67,9 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) set(_description "include file ${_INCLUDE}") endif() - message(STATUS "Looking for ${_description}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${_description}") + endif() try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c @@ -76,14 +79,18 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) "${CHECK_INCLUDE_FILES_INCLUDE_DIRS}" OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) - message(STATUS "Looking for ${_description} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${_description} - found") + endif() set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if files ${INCLUDE} " "exist passed with the following output:\n" "${OUTPUT}\n\n") else() - message(STATUS "Looking for ${_description} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${_description} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if files ${INCLUDE} " diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index f5c563c..2b41379 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -23,6 +23,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -43,7 +44,9 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) if("${VARIABLE}" MATCHES "^${VARIABLE}$") set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") + endif() set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY}) if(CMAKE_REQUIRED_LIBRARIES) set(CHECK_LIBRARY_EXISTS_LIBRARIES @@ -60,14 +63,18 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) - message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found") + endif() set(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "passed with the following output:\n" "${OUTPUT}\n\n") else() - message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index 25ea7f4..fe00074 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -33,6 +33,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2005-2009 Kitware, Inc. @@ -97,12 +98,16 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB if (${_VARIABLE}) set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}") - message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n" "${OUTPUT}\n\n") else () - message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False") + endif() set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n" diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index a864e82..880a688 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -28,6 +28,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages # # # diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index e1ca412..bf2e797 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -28,6 +28,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2003-2011 Kitware, Inc. @@ -74,7 +75,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" "${SOURCEFILE}" @ONLY) - message(STATUS "Looking for ${SYMBOL}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${SYMBOL}") + endif() try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} "${SOURCEFILE}" @@ -85,7 +88,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) "${CMAKE_SYMBOL_EXISTS_INCLUDES}" OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) - message(STATUS "Looking for ${SYMBOL} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${SYMBOL} - found") + endif() set(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the ${SYMBOL} " @@ -93,7 +98,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) "${OUTPUT}\nFile ${SOURCEFILE}:\n" "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") else() - message(STATUS "Looking for ${SYMBOL} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${SYMBOL} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the ${SYMBOL} " diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 333b325..d4651b9 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -59,6 +59,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages # CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include #============================================================================= @@ -85,7 +86,9 @@ get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) #----------------------------------------------------------------------------- # Helper function. DO NOT CALL DIRECTLY. function(__check_type_size_impl type var map builtin language) - message(STATUS "Check size of ${type}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Check size of ${type}") + endif() # Include header files. set(headers) @@ -169,13 +172,17 @@ function(__check_type_size_impl type var map builtin language) message(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !") endif() - message(STATUS "Check size of ${type} - done") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Check size of ${type} - done") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining size of ${type} passed with the following output:\n${output}\n\n") set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})") else() # The check failed to compile. - message(STATUS "Check size of ${type} - failed") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Check size of ${type} - failed") + endif() file(READ ${src} content) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n") diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index 4861ff0..3a7ef13 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -27,6 +27,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -47,7 +48,9 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE) if("${VARIABLE}" MATCHES "^${VARIABLE}$") set(MACRO_CHECK_VARIABLE_DEFINITIONS "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "Looking for ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${VAR}") + endif() if(CMAKE_REQUIRED_LIBRARIES) set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) @@ -63,13 +66,17 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE) OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) set(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}") - message(STATUS "Looking for ${VAR} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${VAR} - found") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the variable ${VAR} exists passed with the following output:\n" "${OUTPUT}\n\n") else() set(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}") - message(STATUS "Looking for ${VAR} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${VAR} - not found") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the variable ${VAR} exists failed with the following output:\n" "${OUTPUT}\n\n") diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 8235dda..0f651e9 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -16,6 +16,7 @@ # [LIST_SEPARATOR sep] # Sep to be replaced by ; in cmd lines # [TMP_DIR dir] # Directory to store temporary files # [STAMP_DIR dir] # Directory to store step timestamps +# [EXCLUDE_FROM_ALL 1] # The "all" target does not depend on this # #--Download step-------------- # [DOWNLOAD_NAME fname] # File name to store (if not end of URL) # [DOWNLOAD_DIR dir] # Directory to store downloaded files @@ -119,6 +120,7 @@ # [DEPENDERS steps...] # Steps that depend on this step # [DEPENDS files...] # Files on which this step depends # [ALWAYS 1] # No stamp file, step always runs +# [EXCLUDE_FROM_MAIN 1] # Main target does not depend on this step # [WORKING_DIRECTORY dir] # Working directory for command # [LOG 1] # Wrap step in script to log output # ) @@ -454,6 +456,7 @@ execute_process( WORKING_DIRECTORY \"${work_dir}\" RESULT_VARIABLE error_code OUTPUT_VARIABLE head_sha + OUTPUT_STRIP_TRAILING_WHITESPACE ) if(error_code) message(FATAL_ERROR \"Failed to get the hash for HEAD\") @@ -472,6 +475,17 @@ else() set(is_remote_ref 0) endif() +# Tag is in the form <remote>/<tag> (i.e. origin/master) we must strip +# the remote from the tag. +if(\"\${show_ref_output}\" MATCHES \"refs/remotes/${git_tag}\") + string(REGEX MATCH \"^([^/]+)/(.+)$\" _unused \"${git_tag}\") + set(git_remote \"\${CMAKE_MATCH_1}\") + set(git_tag \"\${CMAKE_MATCH_2}\") +else() + set(git_remote \"origin\") + set(git_tag \"${git_tag}\") +endif() + # This will fail if the tag does not exist (it probably has not been fetched # yet). execute_process( @@ -479,6 +493,7 @@ execute_process( WORKING_DIRECTORY \"${work_dir}\" RESULT_VARIABLE error_code OUTPUT_VARIABLE tag_sha + OUTPUT_STRIP_TRAILING_WHITESPACE ) # Is the hash checkout out that we want? @@ -492,13 +507,94 @@ if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\" message(FATAL_ERROR \"Failed to fetch repository '${git_repository}'\") endif() - execute_process( - COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag} - WORKING_DIRECTORY \"${work_dir}\" - RESULT_VARIABLE error_code - ) - if(error_code) - message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\") + if(is_remote_ref) + # Check if stash is needed + execute_process( + COMMAND \"${git_EXECUTABLE}\" status --porcelain + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + OUTPUT_VARIABLE repo_status + ) + if(error_code) + message(FATAL_ERROR \"Failed to get the status\") + endif() + string(LENGTH \"\${repo_status}\" need_stash) + + # If not in clean state, stash changes in order to be able to be able to + # perform git pull --rebase + if(need_stash) + execute_process( + COMMAND \"${git_EXECUTABLE}\" stash save --all --quiet + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR \"Failed to stash changes\") + endif() + endif() + + # Pull changes from the remote branch + execute_process( + COMMAND \"${git_EXECUTABLE}\" rebase \${git_remote}/\${git_tag} + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + # Rebase failed: Restore previous state. + execute_process( + COMMAND \"${git_EXECUTABLE}\" rebase --abort + WORKING_DIRECTORY \"${work_dir}\" + ) + if(need_stash) + execute_process( + COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet + WORKING_DIRECTORY \"${work_dir}\" + ) + endif() + message(FATAL_ERROR \"\\nFailed to rebase in: '${work_dir}/${src_name}'.\\nYou will have to resolve the conflicts manually\") + endif() + + if(need_stash) + execute_process( + COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + # Stash pop --index failed: Try again dropping the index + execute_process( + COMMAND \"${git_EXECUTABLE}\" reset --hard --quiet + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + execute_process( + COMMAND \"${git_EXECUTABLE}\" stash pop --quiet + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + # Stash pop failed: Restore previous state. + execute_process( + COMMAND \"${git_EXECUTABLE}\" reset --hard --quiet \${head_sha} + WORKING_DIRECTORY \"${work_dir}\" + ) + execute_process( + COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet + WORKING_DIRECTORY \"${work_dir}\" + ) + message(FATAL_ERROR \"\\nFailed to unstash changes in: '${work_dir}/${src_name}'.\\nYou will have to resolve the conflicts manually\") + endif() + endif() + endif() + else() + execute_process( + COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag} + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\") + endif() endif() execute_process( @@ -1098,14 +1194,17 @@ function(ExternalProject_Add_Step name step) set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete") _ep_get_step_stampfile(${name} ${step} stamp_file) - add_custom_command(APPEND - OUTPUT ${complete_stamp_file} - DEPENDS ${stamp_file} - ) - _ep_parse_arguments(ExternalProject_Add_Step ${name} _EP_${step}_ "${ARGN}") + get_property(exclude_from_main TARGET ${name} PROPERTY _EP_${step}_EXCLUDE_FROM_MAIN) + if(NOT exclude_from_main) + add_custom_command(APPEND + OUTPUT ${complete_stamp_file} + DEPENDS ${stamp_file} + ) + endif() + # Steps depending on this step. get_property(dependers TARGET ${name} PROPERTY _EP_${step}_DEPENDERS) foreach(depender IN LISTS dependers) @@ -1815,6 +1914,9 @@ function(ExternalProject_Add name) set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles) set(complete_stamp_file "${cmf_dir}${cfgdir}/${name}-complete") + # The "ALL" option to add_custom_target just tells it to not set the + # EXCLUDE_FROM_ALL target property. Later, if the EXCLUDE_FROM_ALL + # argument was passed, we explicitly set it for the target. add_custom_target(${name} ALL DEPENDS ${complete_stamp_file}) set_property(TARGET ${name} PROPERTY _EP_IS_EXTERNAL_PROJECT 1) _ep_parse_arguments(ExternalProject_Add ${name} _EP_ "${ARGN}") @@ -1822,6 +1924,12 @@ function(ExternalProject_Add name) _ep_get_step_stampfile(${name} "done" done_stamp_file) _ep_get_step_stampfile(${name} "install" install_stamp_file) + # Set the EXCLUDE_FROM_ALL target property if required. + get_property(exclude_from_all TARGET ${name} PROPERTY _EP_EXCLUDE_FROM_ALL) + if(exclude_from_all) + set_property(TARGET ${name} PROPERTY EXCLUDE_FROM_ALL TRUE) + endif() + # The 'complete' step depends on all other steps and creates a # 'done' mark. A dependent external project's 'configure' step # depends on the 'done' mark so that it rebuilds when this project diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 3b658ef..1cf9124 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -52,6 +52,9 @@ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) +cmake_push_check_state() +set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) @@ -687,4 +690,5 @@ else() endif() endif() +cmake_pop_check_state() set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index 3883877..b479332 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -57,7 +57,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 if (BZIP2_FOUND) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY}) CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX) + cmake_pop_check_state() endif () mark_as_advanced(BZIP2_INCLUDE_DIR) diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake index 83789cc..5620661 100644 --- a/Modules/FindBacktrace.cmake +++ b/Modules/FindBacktrace.cmake @@ -62,6 +62,7 @@ if (NOT DEFINED Backtrace_LIBRARY) # First, check if we already have backtrace(), e.g., in libc cmake_push_check_state(RESET) set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_QUIET ${Backtrace_FIND_QUIETLY}) check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND) cmake_pop_check_state() endif() diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 4b55d6a..61353ca 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -36,9 +36,13 @@ find_library(CUPS_LIBRARIES NAMES cups ) if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${Cups_FIND_QUIETLY}) # ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint) CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE) + cmake_pop_check_state() endif () if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h") diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 971edb7..fa420c1 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -67,6 +67,9 @@ endif() # default search paths. if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY}) CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}" wsyncup "" CURSES_CURSES_HAS_WSYNCUP) @@ -77,6 +80,7 @@ if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) set(CURSES_USE_NCURSES TRUE) endif() endif() + cmake_pop_check_state() endif() diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 117ded7..7bbb8cf 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -66,6 +66,7 @@ if(GIF_INCLUDE_DIR) include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake) CMAKE_PUSH_CHECK_STATE() + set(CMAKE_REQUIRED_QUIET ${GIF_FIND_QUIETLY}) set(GIF_VERSION 3) set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}") CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData ) diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index aa3c235..c4f911d 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -115,11 +115,19 @@ function(GTEST_ADD_TESTS executable extra_args) # obtain sources used for building that executable get_property(ARGN TARGET ${executable} PROPERTY SOURCES) endif() + set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*") foreach(source ${ARGN}) file(READ "${source}" contents) - string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) + string(REGEX MATCHALL "TEST_?[FP]?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) foreach(hit ${found_tests}) - string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) + string(REGEX MATCH "TEST_?[FP]?" test_type ${hit}) + + # Parameterized tests have a different signature for the filter + if(${test_type} STREQUAL "TEST_P") + string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit}) + else() + string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit}) + endif() add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) endforeach() endforeach() diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 69da4cd..33f4f0c 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -54,6 +54,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) else () include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) endif () +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + +cmake_push_check_state() +set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) set(LAPACK_FOUND FALSE) set(LAPACK95_FOUND FALSE) @@ -347,4 +351,5 @@ else() endif() endif() +cmake_pop_check_state() set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index be01594..742b851 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -55,9 +55,12 @@ endif() # Avoid using old codebase if (LIBLZMA_LIBRARY) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) + set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY}) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) + set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index eee06bf..b5eed9a 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -35,6 +35,7 @@ function(_FIND_OPENCL_VERSION) include(CheckSymbolExists) include(CMakePushCheckState) + set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY}) CMAKE_PUSH_CHECK_STATE() foreach(VERSION "2_0" "1_2" "1_1" "1_0") diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index fead4a6..30972ae 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -39,6 +39,8 @@ # License text for the above reference.) set(_OPENMP_REQUIRED_VARS) +set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) +set(CMAKE_REQUIRED_QUIET ${OpenMP_FIND_QUIETLY}) function(_OPENMP_FLAG_CANDIDATES LANG) set(OpenMP_FLAG_CANDIDATES @@ -116,7 +118,9 @@ if(CMAKE_C_COMPILER_LOADED) set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${FLAG}") unset(OpenMP_FLAG_DETECTED CACHE) - message(STATUS "Try OpenMP C flag = [${FLAG}]") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Try OpenMP C flag = [${FLAG}]") + endif() check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED) set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") if(OpenMP_FLAG_DETECTED) @@ -150,7 +154,9 @@ if(CMAKE_CXX_COMPILER_LOADED) set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${FLAG}") unset(OpenMP_FLAG_DETECTED CACHE) - message(STATUS "Try OpenMP CXX flag = [${FLAG}]") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Try OpenMP CXX flag = [${FLAG}]") + endif() check_cxx_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED) set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") if(OpenMP_FLAG_DETECTED) @@ -167,6 +173,8 @@ if(CMAKE_CXX_COMPILER_LOADED) unset(OpenMP_CXX_TEST_SOURCE) endif() +set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) + if(_OPENMP_REQUIRED_VARS) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index d0515c6..e44d1d9 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -335,6 +335,7 @@ endif() include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSymbolExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/MacroAddFileDependencies.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) set(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake) @@ -613,9 +614,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE) set(QT_QTCORE_FOUND 1) else() - message(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" " - "but QtCore could not be found there. " - "Qt is NOT installed correctly for the target build environment.") + if(NOT Qt4_FIND_QUIETLY) + message(WARNING + "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as " + "\"${QT_LIBRARY_DIR_TMP}\" " + "but QtCore could not be found there. " + "Qt is NOT installed correctly for the target build environment.") + endif() set(Qt4_FOUND FALSE) if(Qt4_FIND_REQUIRED) message( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") @@ -747,11 +752,10 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) # Find out what window system we're using # ############################################# - # Save required variable - set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) - set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) + cmake_push_check_state() # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}") + set(CMAKE_REQUIRED_QUIET ${Qt4_FIND_QUIETLY}) # Check for Window system symbols (note: only one should end up being set) CHECK_CXX_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11) CHECK_CXX_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN) @@ -771,9 +775,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) endif () endif () - # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) + cmake_pop_check_state() # ############################################# diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 7f84522..6d1c65d 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -37,6 +37,8 @@ include (CheckIncludeFiles) include (CheckLibraryExists) include (CheckSymbolExists) set(Threads_FOUND FALSE) +set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) +set(CMAKE_REQUIRED_QUIET ${Threads_FIND_QUIETLY}) # Do we have sproc? if(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) @@ -173,5 +175,6 @@ if(CMAKE_USE_PTHREADS_INIT) endif() endif() +set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND) diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 67cecc2..3a31cf0 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -73,6 +73,8 @@ if (UNIX) # found in tcl on the mac set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK}) set(CMAKE_FIND_FRAMEWORK NEVER) + set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) + set(CMAKE_REQUIRED_QUIET ${X11_FIND_QUIETLY}) set(X11_INC_SEARCH_PATH /usr/pkg/xorg/include /usr/X11R6/include @@ -507,6 +509,7 @@ if (UNIX) X11_XSync_INCLUDE_PATH ) set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE}) + set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) endif () # X11_FIND_REQUIRED_<component> could be checked too diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index 6b1cfd1..72a5929 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -12,13 +12,15 @@ else() set(CMAKE_LIB_QUIET "-q") endif() +set(CMAKE_EXE_LINKER_FLAGS_INIT) set(CMAKE_CREATE_WIN32_EXE "system nt_win" ) set(CMAKE_CREATE_CONSOLE_EXE "system nt" ) - -set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "debug all" ) -set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "debug all" ) -set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) -set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) +set(CMAKE_SHARED_LINKER_FLAGS_INIT "system nt_dll") +set(CMAKE_MODULE_LINKER_FLAGS_INIT "system nt_dll") +foreach(type SHARED MODULE EXE) + set(CMAKE_${type}_LINKER_FLAGS_DEBUG_INIT "debug all opt map, symfile") + set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all opt map, symfile") +endforeach() set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated string. @@ -26,47 +28,52 @@ set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated st set(CMAKE_RC_COMPILER "rc" ) set(CMAKE_BUILD_TYPE_INIT Debug) -set (CMAKE_CXX_FLAGS_INIT "-w=3 -xs") -set (CMAKE_CXX_FLAGS_DEBUG_INIT "-br -bm -d2") -set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") -set (CMAKE_CXX_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") -set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") -set (CMAKE_C_FLAGS_INIT "-w=3 ") -set (CMAKE_C_FLAGS_DEBUG_INIT "-br -bm -d2 -od") -set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") -set (CMAKE_C_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") -set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") -set (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib") -set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# single/multi-threaded /-bm +# static/DLL run-time libraries /-br +# default is setup for multi-threaded + DLL run-time libraries +set (CMAKE_C_FLAGS_INIT "-bt=nt -w3 -dWIN32 -br -bm") +set (CMAKE_CXX_FLAGS_INIT "-bt=nt -xs -w3 -dWIN32 -br -bm") +foreach(lang C CXX) + set (CMAKE_${lang}_FLAGS_DEBUG_INIT "-d2") + set (CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-s -os -d0 -dNDEBUG") + set (CMAKE_${lang}_FLAGS_RELEASE_INIT "-s -ot -d0 -dNDEBUG") + set (CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-s -ot -d1 -dNDEBUG") +endforeach() + +foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) + set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1) + set(CMAKE_CXX_${type}_USE_WATCOM_QUOTE 1) +endforeach() set(CMAKE_C_CREATE_IMPORT_LIBRARY "wlib -c -q -n -b <TARGET_IMPLIB> +<TARGET_QUOTED>") set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) set(CMAKE_C_LINK_EXECUTABLE - "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) # compile a C++ file into an object file set(CMAKE_CXX_COMPILE_OBJECT - "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") + "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") # compile a C file into an object file set(CMAKE_C_COMPILE_OBJECT - "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}") + "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}") # preprocess a C source file set(CMAKE_C_CREATE_PREPROCESSED_SOURCE - "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>${CMAKE_END_TEMP_FILE}") + "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>${CMAKE_END_TEMP_FILE}") # preprocess a C++ source file set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") + "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") set(CMAKE_CXX_CREATE_SHARED_LIBRARY - "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option implib=<TARGET_IMPLIB> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option implib=<TARGET_IMPLIB> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") string(REPLACE " option implib=<TARGET_IMPLIB>" "" CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") @@ -86,8 +93,10 @@ if(NOT _CMAKE_WATCOM_VERSION) set(_CMAKE_WATCOM_VERSION 1) if(CMAKE_C_COMPILER_VERSION) set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) + set(_compiler_id ${CMAKE_C_COMPILER_ID}) else() set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) + set(_compiler_id ${CMAKE_CXX_COMPILER_ID}) endif() set(WATCOM16) set(WATCOM17) diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index 0fe0b32..e034a28 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -104,6 +104,18 @@ function(ProcessorCount var) string(REGEX MATCHALL "Number of CPUs = ([0-9]+)" procs "${machinfo_output}") set(count "${CMAKE_MATCH_1}") #message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'") + else() + find_program(ProcessorCount_cmd_mpsched mpsched) + mark_as_advanced(ProcessorCount_cmd_mpsched) + if(ProcessorCount_cmd_mpsched) + execute_process(COMMAND ${ProcessorCount_cmd_mpsched} -s + OUTPUT_QUIET + ERROR_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE mpsched_output) + string(REGEX MATCHALL "Processor Count *: *([0-9]+)" procs "${mpsched_output}") + set(count "${CMAKE_MATCH_1}") + #message("ProcessorCount: trying mpsched -s '${ProcessorCount_cmd_mpsched}'") + endif() endif() endif() diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 11ca205..23bf933 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -200,6 +200,7 @@ macro(SWIG_ADD_MODULE name language) MODULE ${swig_generated_sources} ${swig_other_sources}) + set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES NO_SONAME ON) string(TOLOWER "${language}" swig_lowercase_language) if ("${swig_lowercase_language}" STREQUAL "octave") set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4b27c72..7b9db16 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 0) -set(CMake_VERSION_PATCH 20140331) +set(CMake_VERSION_PATCH 20140403) #set(CMake_VERSION_RC 1) diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index d76ba2a..2f4b59e 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -59,7 +59,6 @@ bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w) { return false; } - return false; } void cmCursesOptionsWidget::AddOption(std::string const & option ) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index f62afd6..1a98cea 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -578,7 +578,8 @@ void CMakeSetupDialog::doInterrupt() void CMakeSetupDialog::doSourceBrowse() { QString dir = QFileDialog::getExistingDirectory(this, - tr("Enter Path to Source"), this->SourceDirectory->text()); + tr("Enter Path to Source"), this->SourceDirectory->text(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if(!dir.isEmpty()) { this->setSourceDirectory(dir); @@ -608,7 +609,8 @@ void CMakeSetupDialog::updateBinaryDirectory(const QString& dir) void CMakeSetupDialog::doBinaryBrowse() { QString dir = QFileDialog::getExistingDirectory(this, - tr("Enter Path to Build"), this->BinaryDirectory->currentText()); + tr("Enter Path to Build"), this->BinaryDirectory->currentText(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if(!dir.isEmpty() && dir != this->BinaryDirectory->currentText()) { this->setBinaryDirectory(dir); diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx index a0c5e17..41f98b5 100644 --- a/Source/QtDialog/QCMakeWidgets.cxx +++ b/Source/QtDialog/QCMakeWidgets.cxx @@ -67,7 +67,8 @@ void QCMakeFilePathEditor::chooseFile() title = title.arg(this->Variable); } this->fileDialogExists(true); - path = QFileDialog::getOpenFileName(this, title, info.absolutePath()); + path = QFileDialog::getOpenFileName(this, title, info.absolutePath(), + QString(), NULL, QFileDialog::DontResolveSymlinks); this->fileDialogExists(false); if(!path.isEmpty()) @@ -91,7 +92,8 @@ void QCMakePathEditor::chooseFile() title = title.arg(this->Variable); } this->fileDialogExists(true); - path = QFileDialog::getExistingDirectory(this, title, this->text()); + path = QFileDialog::getExistingDirectory(this, title, this->text(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); this->fileDialogExists(false); if(!path.isEmpty()) { diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index da02f00..2fb0eb3 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -165,10 +165,13 @@ bool cmAddCustomTargetCommand if (!nameOk) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; + cmOStringStream e; bool issueMessage = false; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; issueMessage = true; case cmPolicies::OLD: break; @@ -180,9 +183,6 @@ bool cmAddCustomTargetCommand } if (issueMessage) { - cmOStringStream e; - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; e << "The target name \"" << targetName << "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index 6e48e90..c30e764 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -79,10 +79,13 @@ bool cmAddExecutableCommand if (!nameOk) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; + cmOStringStream e; bool issueMessage = false; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; issueMessage = true; case cmPolicies::OLD: break; @@ -94,9 +97,6 @@ bool cmAddExecutableCommand } if (issueMessage) { - cmOStringStream e; - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; e << "The target name \"" << exename << "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 6159f86..cdc9f2a 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -214,11 +214,17 @@ bool cmAddLibraryCommand if (!nameOk) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; + cmOStringStream e; bool issueMessage = false; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: - issueMessage = type != cmTarget::INTERFACE_LIBRARY; + if(type != cmTarget::INTERFACE_LIBRARY) + { + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; + issueMessage = true; + } case cmPolicies::OLD: break; case cmPolicies::NEW: @@ -229,9 +235,6 @@ bool cmAddLibraryCommand } if (issueMessage) { - cmOStringStream e; - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; e << "The target name \"" << libName << "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 8655cb7..eb62455 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -364,9 +364,12 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, cmMakefile *makefile = depender->GetMakefile(); cmake::MessageType messageType = cmake::AUTHOR_WARNING; bool issueMessage = false; + cmOStringStream e; switch(depender->GetPolicyStatusCMP0046()) { case cmPolicies::WARN: + e << (makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0046)) << "\n"; issueMessage = true; case cmPolicies::OLD: break; @@ -379,9 +382,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, if(issueMessage) { cmake* cm = this->GlobalGenerator->GetCMakeInstance(); - cmOStringStream e; - e << (makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0046)) << "\n"; + e << "The dependency target \"" << dependee_name << "\" of target \"" << depender->GetName() << "\" does not exist."; diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index dcb77ba..2536ada 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -223,18 +223,15 @@ bool cmExportCommand // Compute the set of configurations exported. std::vector<std::string> configurationTypes; this->Makefile->GetConfigurations(configurationTypes); - if(!configurationTypes.empty()) + if(configurationTypes.empty()) { - for(std::vector<std::string>::const_iterator - ci = configurationTypes.begin(); - ci != configurationTypes.end(); ++ci) - { - ebfg->AddConfiguration(*ci); - } + configurationTypes.push_back(""); } - else + for(std::vector<std::string>::const_iterator + ci = configurationTypes.begin(); + ci != configurationTypes.end(); ++ci) { - ebfg->AddConfiguration(""); + ebfg->AddConfiguration(*ci); } if (this->ExportSet) { diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index e127f3a..d09e950 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -90,6 +90,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( context.HadError = false; context.HadContextSensitiveCondition = false; context.HeadTarget = headTarget; + context.EvaluateForBuildsystem = this->EvaluateForBuildsystem; context.CurrentTarget = currentTarget ? currentTarget : headTarget; context.Backtrace = this->Backtrace; @@ -124,7 +125,8 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( cmListFileBacktrace const& backtrace, const std::string& input) : Backtrace(backtrace), Input(input), - HadContextSensitiveCondition(false) + HadContextSensitiveCondition(false), + EvaluateForBuildsystem(false) { cmGeneratorExpressionLexer l; std::vector<cmGeneratorExpressionToken> tokens = diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index d0a6aef..da64515 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -112,6 +112,11 @@ public: return this->HadContextSensitiveCondition; } + void SetEvaluateForBuildsystem(bool eval) + { + this->EvaluateForBuildsystem = eval; + } + private: cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, const std::string& input); @@ -131,6 +136,7 @@ private: mutable std::set<std::string> SeenTargetProperties; mutable std::string Output; mutable bool HadContextSensitiveCondition; + bool EvaluateForBuildsystem; }; #endif diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index d41285d..95a946a 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -135,18 +135,15 @@ void cmGeneratorExpressionEvaluationFile::Generate() if (allConfigs.empty()) { - this->Generate("", inputExpression.get(), outputFiles); + allConfigs.push_back(""); } - else + for(std::vector<std::string>::const_iterator li = allConfigs.begin(); + li != allConfigs.end(); ++li) { - for(std::vector<std::string>::const_iterator li = allConfigs.begin(); - li != allConfigs.end(); ++li) + this->Generate(*li, inputExpression.get(), outputFiles); + if(cmSystemTools::GetFatalErrorOccured()) { - this->Generate(*li, inputExpression.get(), outputFiles); - if(cmSystemTools::GetFatalErrorOccured()) - { - return; - } + return; } } } diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 59e3aec..a513921 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1252,6 +1252,16 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode const GeneratorExpressionContent *content, cmGeneratorExpressionDAGChecker *) const { + if (!context->EvaluateForBuildsystem) + { + cmOStringStream e; + e << "The evaluation of the TARGET_OBJECTS generator expression " + "is only suitable for consumption by CMake. It is not suitable " + "for writing out elsewhere."; + reportError(context, content->GetOriginalExpression(), e.str()); + return std::string(); + } + std::string tgtName = parameters.front(); cmGeneratorTarget* gt = context->Makefile->FindGeneratorTargetToUse(tgtName.c_str()); diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index a7099cb..54a2548 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -34,6 +34,7 @@ struct cmGeneratorExpressionContext bool Quiet; bool HadError; bool HadContextSensitiveCondition; + bool EvaluateForBuildsystem; }; struct cmGeneratorExpressionDAGChecker; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 0f7dfe8..f09f7b3 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -770,7 +770,8 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, switch(mf->GetPolicyStatus(cmPolicies::CMP0025)) { case cmPolicies::WARN: - if(!this->CMakeInstance->GetIsInTryCompile()) + if(!this->CMakeInstance->GetIsInTryCompile() && + mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025")) { cmOStringStream w; w << policies->GetPolicyWarning(cmPolicies::CMP0025) << "\n" @@ -801,7 +802,8 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, switch(mf->GetPolicyStatus(cmPolicies::CMP0047)) { case cmPolicies::WARN: - if(!this->CMakeInstance->GetIsInTryCompile()) + if(!this->CMakeInstance->GetIsInTryCompile() && + mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0047")) { cmOStringStream w; w << policies->GetPolicyWarning(cmPolicies::CMP0047) << "\n" diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 0ae1b34..e44ed79 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -35,7 +35,6 @@ void cmGlobalWatcomWMakeGenerator mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1"); mf->AddDefinition("CMAKE_MAKE_LINE_CONTINUE", "&"); mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC"); - mf->AddDefinition("CMAKE_NO_QUOTED_OBJECTS", "1"); mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386"); this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); diff --git a/Source/cmIDEFlagTable.h b/Source/cmIDEFlagTable.h index e372c0a..d9a045d 100644 --- a/Source/cmIDEFlagTable.h +++ b/Source/cmIDEFlagTable.h @@ -31,6 +31,7 @@ struct cmIDEFlagTable // old value with semicolons (e.g. // /NODEFAULTLIB: => // IgnoreDefaultLibraryNames) + UserFollowing = (1<<5), // expect value in following argument UserValueIgnored = UserValue | UserIgnored, UserValueRequired = UserValue | UserRequired diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index e03223f..1f3c066 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -19,6 +19,7 @@ cmIDEOptions::cmIDEOptions() this->DoingDefine = false; this->AllowDefine = true; this->AllowSlash = false; + this->DoingFollowing = 0; for(int i=0; i < FlagTableCount; ++i) { this->FlagTable[i] = 0; @@ -41,6 +42,14 @@ void cmIDEOptions::HandleFlag(const char* flag) return; } + // If the last option expected a following value, this is it. + if(this->DoingFollowing) + { + this->FlagMapUpdate(this->DoingFollowing, flag); + this->DoingFollowing = 0; + return; + } + // Look for known arguments. if(flag[0] == '-' || (this->AllowSlash && flag[0] == '/')) { @@ -99,40 +108,22 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table, (!(entry->special & cmIDEFlagTable::UserRequired) || static_cast<int>(strlen(flag+1)) > n)) { - if(entry->special & cmIDEFlagTable::UserIgnored) - { - // Ignore the user-specified value. - this->FlagMap[entry->IDEName] = entry->value; - } - else if(entry->special & cmIDEFlagTable::SemicolonAppendable) - { - const char *new_value = flag+1+n; - - std::map<std::string,std::string>::iterator itr; - itr = this->FlagMap.find(entry->IDEName); - if(itr != this->FlagMap.end()) - { - // Append to old value (if present) with semicolons; - itr->second += ";"; - itr->second += new_value; - } - else - { - this->FlagMap[entry->IDEName] = new_value; - } - } - else - { - // Use the user-specified value. - this->FlagMap[entry->IDEName] = flag+1+n; - } + this->FlagMapUpdate(entry, flag+n+1); entry_found = true; } } else if(strcmp(flag+1, entry->commandFlag) == 0) { - // This flag table entry provides a fixed value. - this->FlagMap[entry->IDEName] = entry->value; + if(entry->special & cmIDEFlagTable::UserFollowing) + { + // This flag expects a value in the following argument. + this->DoingFollowing = entry; + } + else + { + // This flag table entry provides a fixed value. + this->FlagMap[entry->IDEName] = entry->value; + } entry_found = true; } @@ -151,6 +142,37 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table, } //---------------------------------------------------------------------------- +void cmIDEOptions::FlagMapUpdate(cmIDEFlagTable const* entry, + const char* new_value) +{ + if(entry->special & cmIDEFlagTable::UserIgnored) + { + // Ignore the user-specified value. + this->FlagMap[entry->IDEName] = entry->value; + } + else if(entry->special & cmIDEFlagTable::SemicolonAppendable) + { + std::map<std::string,std::string>::iterator itr; + itr = this->FlagMap.find(entry->IDEName); + if(itr != this->FlagMap.end()) + { + // Append to old value (if present) with semicolons; + itr->second += ";"; + itr->second += new_value; + } + else + { + this->FlagMap[entry->IDEName] = new_value; + } + } + else + { + // Use the user-specified value. + this->FlagMap[entry->IDEName] = new_value; + } +} + +//---------------------------------------------------------------------------- void cmIDEOptions::AddDefine(const std::string& def) { this->Defines.push_back(def); diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h index 691893f..e7749ec 100644 --- a/Source/cmIDEOptions.h +++ b/Source/cmIDEOptions.h @@ -51,11 +51,13 @@ protected: bool DoingDefine; bool AllowDefine; bool AllowSlash; + cmIDEFlagTable const* DoingFollowing; enum { FlagTableCount = 16 }; cmIDEFlagTable const* FlagTable[FlagTableCount]; void HandleFlag(const char* flag); bool CheckFlagTable(cmIDEFlagTable const* table, const char* flag, bool& flag_handled); + void FlagMapUpdate(cmIDEFlagTable const* entry, const char* new_value); virtual void StoreUnknownFlag(const char* flag) = 0; }; diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 4d9935c..0a4f5c9 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -98,11 +98,14 @@ bool cmIncludeCommand if (gg->IsExportedTargetsFile(fname_abs)) { const char *modal = 0; + cmOStringStream e; cmake::MessageType messageType = cmake::AUTHOR_WARNING; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0024)) { case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0024)) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -114,9 +117,6 @@ bool cmIncludeCommand } if (modal) { - cmOStringStream e; - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0024)) << "\n"; e << "The file\n " << fname_abs << "\nwas generated by the export() " "command. It " << modal << " not be used as the argument to the " "include() command. Use ALIAS targets instead to refer to targets " diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e2f8375..dcf9f97 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -542,6 +542,10 @@ void cmLocalGenerator::GenerateTargetManifest() // Collect the set of configuration types. std::vector<std::string> configNames; this->Makefile->GetConfigurations(configNames); + if(configNames.empty()) + { + configNames.push_back(""); + } // Add our targets to the manifest for each configuration. cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets(); @@ -557,18 +561,11 @@ void cmLocalGenerator::GenerateTargetManifest() { continue; } - if(configNames.empty()) + for(std::vector<std::string>::iterator ci = configNames.begin(); + ci != configNames.end(); ++ci) { - target.GenerateTargetManifest(""); - } - else - { - for(std::vector<std::string>::iterator ci = configNames.begin(); - ci != configNames.end(); ++ci) - { - const char* config = ci->c_str(); - target.GenerateTargetManifest(config); - } + const char* config = ci->c_str(); + target.GenerateTargetManifest(config); } } } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index bbd350d..7ffe84d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2183,59 +2183,82 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- std::string -cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p) +cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, + bool useWatcomQuote) { - // Split the path into its components. std::vector<std::string> components; cmSystemTools::SplitPath(p, components); - // Return an empty path if there are no components. - if(components.empty()) + // Open the quoted result. + std::string result; + if(useWatcomQuote) + { +#if defined(_WIN32) && !defined(__CYGWIN__) + result = "'"; +#else + result = "\"'"; +#endif + } + else { - return "\"\""; + result = "\""; } - // Choose a slash direction and fix root component. - const char* slash = "/"; + // Return an empty path if there are no components. + if(!components.empty()) + { + // Choose a slash direction and fix root component. + const char* slash = "/"; #if defined(_WIN32) && !defined(__CYGWIN__) - if(!cmSystemTools::GetForceUnixPaths()) - { - slash = "\\"; - for(std::string::iterator i = components[0].begin(); - i != components[0].end(); ++i) - { - if(*i == '/') - { - *i = '\\'; - } - } - } + if(!cmSystemTools::GetForceUnixPaths()) + { + slash = "\\"; + for(std::string::iterator i = components[0].begin(); + i != components[0].end(); ++i) + { + if(*i == '/') + { + *i = '\\'; + } + } + } #endif - // Begin the quoted result with the root component. - std::string result = "\""; - result += components[0]; + // Begin the quoted result with the root component. + result += components[0]; - // Now add the rest of the components separated by the proper slash - // direction for this platform. - bool first = true; - for(unsigned int i=1; i < components.size(); ++i) - { - // Only the last component can be empty to avoid double slashes. - if(components[i].length() > 0 || (i == (components.size()-1))) + // Now add the rest of the components separated by the proper slash + // direction for this platform. + bool first = true; + for(unsigned int i=1; i < components.size(); ++i) { - if(!first) + // Only the last component can be empty to avoid double slashes. + if(components[i].length() > 0 || (i == (components.size()-1))) { - result += slash; + if(!first) + { + result += slash; + } + result += components[i]; + first = false; } - result += components[i]; - first = false; } } // Close the quoted result. - result += "\""; + if(useWatcomQuote) + { +#if defined(_WIN32) && !defined(__CYGWIN__) + result += "'"; +#else + result += "'\""; +#endif + } + else + { + result += "\""; + } return result; } diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 14543fb..99974ee 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -186,7 +186,8 @@ public: const char *targetDir, cmLocalGenerator::RelativeRoot returnDir); - static std::string ConvertToQuotedOutputPath(const char* p); + static std::string ConvertToQuotedOutputPath(const char* p, + bool useWatcomQuote); std::string CreateMakeVariable(const std::string& sin, const std::string& s2in); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 06dc0c5..b1d6fe2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -893,9 +893,12 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, { cmake::MessageType messageType = cmake::AUTHOR_WARNING; bool issueMessage = false; + cmOStringStream e; switch(this->GetPolicyStatus(cmPolicies::CMP0040)) { case cmPolicies::WARN: + e << (this->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0040)) << "\n"; issueMessage = true; case cmPolicies::OLD: break; @@ -908,9 +911,6 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, if(issueMessage) { - cmOStringStream e; - e << (this->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0040)) << "\n"; e << "The target name \"" << target << "\" is unknown in this context."; IssueMessage(messageType, e.str()); } @@ -4330,6 +4330,22 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const return this->GetPolicies()->GetPolicyStatus(id); } +//---------------------------------------------------------------------------- +bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var) +{ + // Check for an explicit CMAKE_POLICY_WARNING_CMP<NNNN> setting. + if(!var.empty()) + { + if(const char* val = this->GetDefinition(var)) + { + return cmSystemTools::IsOn(val); + } + } + // Enable optional policy warnings with --debug-output or --trace. + cmake* cm = this->GetCMakeInstance(); + return cm->GetDebugOutput() || cm->GetTrace(); +} + bool cmMakefile::SetPolicy(const char *id, cmPolicies::PolicyStatus status) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 460a85c..8ff6daa 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -880,6 +880,8 @@ public: std::set<std::string> const & GetSystemIncludeDirectories() const { return this->SystemIncludeDirectories; } + bool PolicyOptionalWarningEnabled(std::string const& var); + protected: // add link libraries and directories to the target void AddGlobalLinkInformation(const std::string& name, cmTarget& target); diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index a61005b..701d5a0 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -290,6 +290,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) linkRuleVar += linkLanguage; linkRuleVar += "_LINK_EXECUTABLE"; std::string linkRule = this->GetLinkRule(linkRuleVar); + bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE"); std::vector<std::string> commands1; cmSystemTools::ExpandListArgument(linkRule, real_link_commands); if(this->Target->IsExecutableWithExports()) @@ -343,7 +344,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // rule. std::string buildObjs; this->CreateObjectLists(useLinkScript, false, - useResponseFileForObjects, buildObjs, depends); + useResponseFileForObjects, buildObjs, depends, + useWatcomQuote); cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_LINK"; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 02469d1..754f62f 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -458,6 +458,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->Target); } + bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE"); + // Determine whether a link script will be used. bool useLinkScript = this->GlobalGenerator->GetUseLinkScript(); @@ -553,7 +555,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // rule. std::string buildObjs; this->CreateObjectLists(useLinkScript, useArchiveRules, - useResponseFileForObjects, buildObjs, depends); + useResponseFileForObjects, buildObjs, depends, + useWatcomQuote); cmLocalGenerator::RuleVariables vars; vars.TargetPDB = targetOutPathPDB.c_str(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 2d55621..f940ac4 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1349,7 +1349,8 @@ cmMakefileTargetGenerator::AppendProgress(std::vector<std::string>& commands) void cmMakefileTargetGenerator ::WriteObjectsVariable(std::string& variableName, - std::string& variableNameExternal) + std::string& variableNameExternal, + bool useWatcomQuote) { // Write a make variable assignment that lists all objects for the // target. @@ -1360,8 +1361,6 @@ cmMakefileTargetGenerator << "# Object files for target " << this->Target->GetName() << "\n" << variableName << " ="; std::string object; - const char* objName = - this->Makefile->GetDefinition("CMAKE_NO_QUOTED_OBJECTS"); const char* lineContinue = this->Makefile->GetDefinition("CMAKE_MAKE_LINE_CONTINUE"); if(!lineContinue) @@ -1372,17 +1371,9 @@ cmMakefileTargetGenerator i != this->Objects.end(); ++i) { *this->BuildFileStream << " " << lineContinue << "\n"; - if(objName) - { - *this->BuildFileStream << - this->Convert(*i, cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::MAKEFILE); - } - else - { - *this->BuildFileStream << - this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str()); - } + *this->BuildFileStream << + this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str(), + useWatcomQuote); } *this->BuildFileStream << "\n"; @@ -1404,17 +1395,9 @@ cmMakefileTargetGenerator *this->BuildFileStream << " " << lineContinue << "\n" << this->Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME"); - if(objName) - { - *this->BuildFileStream << - this->Convert(*i, cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::MAKEFILE); - } - else - { - *this->BuildFileStream << - this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str()); - } + *this->BuildFileStream << + this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str(), + useWatcomQuote); } *this->BuildFileStream << "\n" << "\n"; } @@ -1883,11 +1866,13 @@ void cmMakefileTargetGenerator ::CreateObjectLists(bool useLinkScript, bool useArchiveRules, bool useResponseFile, std::string& buildObjs, - std::vector<std::string>& makefile_depends) + std::vector<std::string>& makefile_depends, + bool useWatcomQuote) { std::string variableName; std::string variableNameExternal; - this->WriteObjectsVariable(variableName, variableNameExternal); + this->WriteObjectsVariable(variableName, variableNameExternal, + useWatcomQuote); if(useResponseFile) { // MSVC response files cannot exceed 128K. diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 7ff6da9..ff94660 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -113,7 +113,8 @@ protected: // write out the variable that lists the objects for this target void WriteObjectsVariable(std::string& variableName, - std::string& variableNameExternal); + std::string& variableNameExternal, + bool useWatcomQuote); void WriteObjectsString(std::string& buildObjs); void WriteObjectsStrings(std::vector<std::string>& objStrings, std::string::size_type limit = std::string::npos); @@ -172,7 +173,8 @@ protected: /** Create lists of object files for linking and cleaning. */ void CreateObjectLists(bool useLinkScript, bool useArchiveRules, bool useResponseFile, std::string& buildObjs, - std::vector<std::string>& makefile_depends); + std::vector<std::string>& makefile_depends, + bool useWatcomQuote); void AddIncludeFlags(std::string& flags, const std::string& lang); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 853319e..1d0336a 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -314,72 +314,49 @@ cmNinjaNormalTargetGenerator ::ComputeLinkCmd() { std::vector<std::string> linkCmds; - cmTarget::TargetType targetType = this->GetTarget()->GetType(); - switch (targetType) { + cmMakefile* mf = this->GetMakefile(); + { + std::string linkCmdVar = "CMAKE_"; + linkCmdVar += this->TargetLinkLanguage; + linkCmdVar += this->GetGeneratorTarget()->GetCreateRuleVariable(); + const char *linkCmd = mf->GetDefinition(linkCmdVar); + if (linkCmd) + { + cmSystemTools::ExpandListArgument(linkCmd, linkCmds); + return linkCmds; + } + } + switch (this->GetTarget()->GetType()) { case cmTarget::STATIC_LIBRARY: { - // Check if you have a non archive way to create the static library. - { - std::string linkCmdVar = "CMAKE_"; - linkCmdVar += this->TargetLinkLanguage; - linkCmdVar += "_CREATE_STATIC_LIBRARY"; - if (const char *linkCmd = - this->GetMakefile()->GetDefinition(linkCmdVar)) - { - cmSystemTools::ExpandListArgument(linkCmd, linkCmds); - return linkCmds; - } - } - // We have archive link commands set. First, delete the existing archive. + { std::string cmakeCommand = this->GetLocalGenerator()->ConvertToOutputFormat( - this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND"), + mf->GetRequiredDefinition("CMAKE_COMMAND"), cmLocalGenerator::SHELL); linkCmds.push_back(cmakeCommand + " -E remove $out"); - + } // TODO: Use ARCHIVE_APPEND for archives over a certain size. { std::string linkCmdVar = "CMAKE_"; linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_ARCHIVE_CREATE"; - const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar); + const char *linkCmd = mf->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); } { std::string linkCmdVar = "CMAKE_"; linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_ARCHIVE_FINISH"; - const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar); + const char *linkCmd = mf->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); } return linkCmds; } case cmTarget::SHARED_LIBRARY: case cmTarget::MODULE_LIBRARY: - case cmTarget::EXECUTABLE: { - std::string linkCmdVar = "CMAKE_"; - linkCmdVar += this->TargetLinkLanguage; - switch (targetType) { - case cmTarget::SHARED_LIBRARY: - linkCmdVar += "_CREATE_SHARED_LIBRARY"; - break; - case cmTarget::MODULE_LIBRARY: - linkCmdVar += "_CREATE_SHARED_MODULE"; - break; - case cmTarget::EXECUTABLE: - linkCmdVar += "_LINK_EXECUTABLE"; - break; - default: - assert(0 && "Unexpected target type"); - } - - const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar); - cmSystemTools::ExpandListArgument(linkCmd, linkCmds); - return linkCmds; - } + case cmTarget::EXECUTABLE: + break; default: assert(0 && "Unexpected target type"); } @@ -457,14 +434,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmNinjaDeps explicitDeps = this->GetObjects(); cmNinjaDeps implicitDeps = this->ComputeLinkDeps(); + cmMakefile* mf = this->GetMakefile(); + std::string frameworkPath; std::string linkPath; + cmGeneratorTarget* gtarget = this->GetGeneratorTarget(); this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, linkPath, - this->GetGeneratorTarget()); + gtarget); this->addPoolNinjaVariable("JOB_POOL_LINK", this->GetTarget(), vars); @@ -481,7 +461,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() ? vars["FLAGS"] : vars["ARCH_FLAGS"]); this->GetLocalGenerator()->AddArchitectureFlags(flags, - this->GetGeneratorTarget(), + gtarget, this->TargetLinkLanguage, this->GetConfigName()); if (targetType == cmTarget::EXECUTABLE) { @@ -491,7 +471,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } if (this->GetTarget()->HasSOName(this->GetConfigName())) { vars["SONAME_FLAG"] = - this->GetMakefile()->GetSONameFlag(this->TargetLinkLanguage); + mf->GetSONameFlag(this->TargetLinkLanguage); vars["SONAME"] = this->TargetNameSO; if (targetType == cmTarget::SHARED_LIBRARY) { std::string install_name_dir = this->GetTarget() @@ -514,7 +494,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() EnsureParentDirectoryExists(impLibPath); } - cmMakefile* mf = this->GetMakefile(); if (!this->SetMsvcTargetPdbVariable(vars)) { // It is common to place debug symbols at a specific place, @@ -557,8 +536,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() for (std::vector<cmCustomCommand>::const_iterator ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) { - cmCustomCommandGenerator ccg(*ci, this->GetConfigName(), - this->GetMakefile()); + cmCustomCommandGenerator ccg(*ci, this->GetConfigName(), mf); this->GetLocalGenerator()->AppendCustomCommandLines(ccg, *cmdLineLists[i]); } @@ -568,7 +546,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // the link commands. if (!preLinkCmdLines.empty()) { const std::string homeOutDir = this->GetLocalGenerator() - ->ConvertToOutputFormat(this->GetMakefile()->GetHomeOutputDirectory(), + ->ConvertToOutputFormat(mf->GetHomeOutputDirectory(), cmLocalGenerator::SHELL); preLinkCmdLines.push_back("cd " + homeOutDir); } @@ -591,7 +569,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() int commandLineLengthLimit = 1; const char* forceRspFile = "CMAKE_NINJA_FORCE_RESPONSE_FILE"; - if (!this->GetMakefile()->IsDefinitionSet(forceRspFile) && + if (!mf->IsDefinitionSet(forceRspFile) && cmSystemTools::GetEnv(forceRspFile) == 0) { #ifdef _WIN32 commandLineLengthLimit = 8000 - linkRuleLength; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ef1e37b..c1c33f2 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1616,7 +1616,9 @@ long copy_data(struct archive *ar, struct archive *aw) return (r); } } - return r; +#if !defined(__clang__) + return r; /* this should not happen but it silences a warning */ +#endif } bool extract_tar(const char* outFileName, bool verbose, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 475bcdb..a87ec31 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -943,6 +943,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); + cge->SetEvaluateForBuildsystem(true); this->Internal->SourceEntries.push_back( new cmTargetInternals::TargetPropertyEntry(cge)); } @@ -2916,11 +2917,14 @@ bool cmTarget::HandleLocationPropertyPolicy() const { return true; } + cmOStringStream e; const char *modal = 0; cmake::MessageType messageType = cmake::AUTHOR_WARNING; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0026)) { case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -2933,9 +2937,6 @@ bool cmTarget::HandleLocationPropertyPolicy() const if (modal) { - cmOStringStream e; - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n"; e << "The LOCATION property " << modal << " not be read from target \"" << this->GetName() << "\". Use the target name directly with " "add_custom_command, or use the generator expression $<TARGET_FILE>, " diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 115a988..1c2e625 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -103,11 +103,14 @@ bool cmTargetLinkLibrariesCommand if (this->Target->GetType() == cmTarget::UTILITY) { + cmOStringStream e; const char *modal = 0; cmake::MessageType messageType = cmake::AUTHOR_WARNING; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0039)) { case cmPolicies::WARN: + e << this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0039) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -119,9 +122,7 @@ bool cmTargetLinkLibrariesCommand } if (modal) { - cmOStringStream e; - e << this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0039) << "\n" + e << "Utility target \"" << this->Target->GetName() << "\" " << modal << " not be used as the target of a target_link_libraries call."; this->Makefile->IssueMessage(messageType, e.str()); @@ -373,11 +374,14 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, ? cmTarget::KeywordTLLSignature : cmTarget::PlainTLLSignature; if (!this->Target->PushTLLCommandTrace(sig)) { + cmOStringStream e; const char *modal = 0; cmake::MessageType messageType = cmake::AUTHOR_WARNING; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0023)) { case cmPolicies::WARN: + e << this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0023) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -390,14 +394,12 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, if(modal) { - cmOStringStream e; // If the sig is a keyword form and there is a conflict, the existing // form must be the plain form. const char *existingSig = (sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword"); - e << this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0023) << "\n" + e << "The " << existingSig << " signature for target_link_libraries " "has already been used with the target \"" << this->Target->GetName() << "\". All uses of " diff --git a/Source/cmVS11CLFlagTable.h b/Source/cmVS11CLFlagTable.h index 5ab8ebb..a61ab16 100644 --- a/Source/cmVS11CLFlagTable.h +++ b/Source/cmVS11CLFlagTable.h @@ -248,9 +248,9 @@ static cmVS7FlagTable cmVS11CLFlagTable[] = {"ForcedUsingFiles", "FU", "Forced #using File", "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, - {"PREfastAdditionalOptions", "analyze:", - "Additional Code Analysis Native options", - "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PREfastLog", "analyze:log", + "Code Analysis Log", + "", cmVS7FlagTable::UserFollowing}, {"PREfastAdditionalPlugins", "analyze:plugin", "Additional Code Analysis Native plugins", "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, @@ -283,9 +283,6 @@ static cmVS7FlagTable cmVS11CLFlagTable[] = "", cmVS7FlagTable::UserValue}, // Skip [XMLDocumentationFileName] - no command line Switch. // Skip [BrowseInformationFile] - no command line Switch. - {"PREfastLog", "analyze:log ", - "Code Analysis Log", - "", cmVS7FlagTable::UserValue}, // Skip [AdditionalOptions] - no command line Switch. {0,0,0,0,0} }; diff --git a/Source/cmVS12CLFlagTable.h b/Source/cmVS12CLFlagTable.h index 8f51319..0a7916f 100644 --- a/Source/cmVS12CLFlagTable.h +++ b/Source/cmVS12CLFlagTable.h @@ -254,9 +254,9 @@ static cmVS7FlagTable cmVS12CLFlagTable[] = {"ForcedUsingFiles", "FU", "Forced #using File", "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, - {"PREfastAdditionalOptions", "analyze:", - "Additional Code Analysis Native options", - "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PREfastLog", "analyze:log", + "Code Analysis Log", + "", cmVS7FlagTable::UserFollowing}, {"PREfastAdditionalPlugins", "analyze:plugin", "Additional Code Analysis Native plugins", "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, @@ -289,9 +289,6 @@ static cmVS7FlagTable cmVS12CLFlagTable[] = "", cmVS7FlagTable::UserValue}, // Skip [XMLDocumentationFileName] - no command line Switch. // Skip [BrowseInformationFile] - no command line Switch. - {"PREfastLog", "analyze:log ", - "Code Analysis Log", - "", cmVS7FlagTable::UserValue}, // Skip [AdditionalOptions] - no command line Switch. {0,0,0,0,0} }; diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in index 82537ef..0e0a872 100644 --- a/Templates/TestDriver.cxx.in +++ b/Templates/TestDriver.cxx.in @@ -58,7 +58,7 @@ static char* lowercase(const char *string) int main(int ac, char *av[]) { - int i, NumTests, testNum, partial_match; + int i, NumTests, testNum = 0, partial_match; char *arg, *test_name; int count; int testToRun = -1; @@ -81,7 +81,6 @@ int main(int ac, char *av[]) } printf("To run a test, enter the test number: "); fflush(stdout); - testNum = 0; if( scanf("%d", &testNum) != 1 ) { printf("Couldn't parse that input as a number\n"); diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index b506853..758165c 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -258,17 +258,3 @@ set(CMP0044_TYPE NEW) add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-NEW) set(CMP0044_TYPE OLD) add_subdirectory(CMP0044 ${CMAKE_BINARY_DIR}/CMP0044-OLD) - -add_library(objlib OBJECT objlib1.c objlib2.c) -file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/objlib_files" - CONTENT "$<JOIN:$<TARGET_OBJECTS:objlib>,\n>\n" -) -add_custom_target(check_object_files ALL - COMMAND ${CMAKE_COMMAND} - "-DOBJLIB_LISTFILE=${CMAKE_CURRENT_BINARY_DIR}/objlib_files" - -DTEST_CONFIGURATION=${CMAKE_BUILD_TYPE} - -DEXPECTED_NUM_OBJECTFILES=2 - -P "${CMAKE_CURRENT_SOURCE_DIR}/check_object_files.cmake" - DEPENDS objlib -) diff --git a/Tests/GeneratorExpression/check_object_files.cmake b/Tests/GeneratorExpression/check_object_files.cmake deleted file mode 100644 index 889fe80..0000000 --- a/Tests/GeneratorExpression/check_object_files.cmake +++ /dev/null @@ -1,48 +0,0 @@ - -if (NOT EXISTS ${OBJLIB_LISTFILE}) - message(SEND_ERROR "Object listing file \"${OBJLIB_LISTFILE}\" not found!") -endif() - -file(STRINGS ${OBJLIB_LISTFILE} objlib_files) - -list(LENGTH objlib_files num_objectfiles) -if (NOT EXPECTED_NUM_OBJECTFILES EQUAL num_objectfiles) - message(SEND_ERROR "Unexpected number of entries in object list file (${num_objectfiles} instead of ${EXPECTED_NUM_OBJECTFILES})") -endif() - -foreach(objlib_file ${objlib_files}) - set(file_exists False) - if (EXISTS ${objlib_file}) - set(file_exists True) - endif() - - if (NOT file_exists) - if (objlib_file MATCHES ".(CURRENT_ARCH)") - string(REPLACE "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" "*" config_file "${objlib_file}") - string(REPLACE "$(PROJECT_NAME)" "GeneratorExpression" config_file "${config_file}") - string(REPLACE "$(CURRENT_ARCH)" "*" config_file "${config_file}") - file(GLOB_RECURSE files "${config_file}") - list(LENGTH files num_files) - if (NOT files) - message(SEND_ERROR "Got no files for expression ${config_file}") - endif() - set(file_exists True) - else() - foreach(config_macro "$(Configuration)" "$(OutDir)" "$(IntDir)") - string(REPLACE "${config_macro}" "${TEST_CONFIGURATION}" config_file "${objlib_file}") - list(APPEND attempts ${config_file}) - if (EXISTS ${config_file}) - set(file_exists True) - endif() - endforeach() - endif() - endif() - - if (NOT file_exists) - if(attempts) - list(REMOVE_DUPLICATES attempts) - set(tried " Tried ${attempts}") - endif() - message(SEND_ERROR "File \"${objlib_file}\" does not exist!${tried}") - endif() -endforeach() diff --git a/Tests/GeneratorExpression/objlib1.c b/Tests/GeneratorExpression/objlib1.c deleted file mode 100644 index aa8de0a..0000000 --- a/Tests/GeneratorExpression/objlib1.c +++ /dev/null @@ -1,5 +0,0 @@ - -void objlib1() -{ - -} diff --git a/Tests/GeneratorExpression/objlib2.c b/Tests/GeneratorExpression/objlib2.c deleted file mode 100644 index 3c7307a..0000000 --- a/Tests/GeneratorExpression/objlib2.c +++ /dev/null @@ -1,5 +0,0 @@ - -void objlib2() -{ - -} diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt index 07982bd..05b0217 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt @@ -1,8 +1,4 @@ CMake Error at CMP0026-CONFIG-LOCATION-NEW.cmake:7 \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - The LOCATION property may not be read from target "somelib". Use the target name directly with add_custom_command, or use the generator expression \$<TARGET_FILE>, as appropriate. diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt index 0e90f96..fec9dfb 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt @@ -1,8 +1,4 @@ CMake Error at CMP0026-LOCATION-CONFIG-NEW.cmake:7 \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - The LOCATION property may not be read from target "somelib". Use the target name directly with add_custom_command, or use the generator expression \$<TARGET_FILE>, as appropriate. diff --git a/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt index 2a05a4d..fa02512 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt @@ -1,8 +1,4 @@ CMake Error at CMP0026-NEW.cmake:7 \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - The LOCATION property may not be read from target "somelib". Use the target name directly with add_custom_command, or use the generator expression \$<TARGET_FILE>, as appropriate. diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt index 9d2c35b..ec2315f 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt @@ -1,9 +1,4 @@ CMake Error at CMP0037-NEW-colon.cmake:4 \(add_library\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "lib:colon" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. @@ -11,11 +6,6 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-colon.cmake:5 \(add_executable\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "exe:colon" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. @@ -23,11 +13,6 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-colon.cmake:6 \(add_custom_target\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "custom:colon" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt index 13835af..5789e38 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt @@ -1,20 +1,10 @@ CMake Error at CMP0037-NEW-reserved.cmake:4 \(add_library\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "all" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-reserved.cmake:5 \(add_executable\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "clean" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. @@ -22,11 +12,6 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-reserved.cmake:6 \(add_custom_target\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "help" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt index 2525bcd..e14cec0 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt @@ -1,9 +1,4 @@ CMake Error at CMP0037-NEW-space.cmake:4 \(add_library\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "lib with spaces" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. @@ -11,11 +6,6 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-space.cmake:5 \(add_executable\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "exe with spaces" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. @@ -23,11 +13,6 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-space.cmake:6 \(add_custom_target\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "custom with spaces" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt index 821c4f8..3d9d225 100644 --- a/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt @@ -1,8 +1,4 @@ CMake Error at CMP0039-NEW.cmake:7 \(target_link_libraries\): - Policy CMP0039 is not set: Utility targets may not have link dependencies. - Run "cmake --help-policy CMP0039" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - Utility target "utility" must not be used as the target of a target_link_libraries call. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt index 03a0217..3f82d8c 100644 --- a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt @@ -1,9 +1,4 @@ CMake Error at CMP0040-NEW-missing-target.cmake:3 \(add_custom_command\): - Policy CMP0040 is not set: The target in the TARGET signature of - add_custom_command\(\) must exist. Run "cmake --help-policy CMP0040" for - policy details. Use the cmake_policy command to set the policy and - suppress this warning. -+ The target name "foobar" is unknown in this context. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt index 0c23c43..381647f 100644 --- a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt +++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt @@ -1,8 +1,4 @@ CMake Error at CMP0046-NEW-missing-dependency.cmake:4 \(add_dependencies\): - Policy CMP0046 is not set: Error on non-existent dependency in - add_dependencies. Run "cmake --help-policy CMP0046" for policy details. - Use the cmake_policy command to set the policy and suppress this warning. -+ The dependency target "bar" of target "foo" does not exist. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget-result.txt b/Tests/RunCMake/TargetObjects/BadContext-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetObjects/NotObjlibTarget-result.txt +++ b/Tests/RunCMake/TargetObjects/BadContext-result.txt diff --git a/Tests/RunCMake/TargetObjects/BadContext-stderr.txt b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt new file mode 100644 index 0000000..92f2c91 --- /dev/null +++ b/Tests/RunCMake/TargetObjects/BadContext-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at BadContext.cmake:2 \(file\): + Error evaluating generator expression: + + \$<TARGET_OBJECTS:NoTarget> + + The evaluation of the TARGET_OBJECTS generator expression is only suitable + for consumption by CMake. It is not suitable for writing out elsewhere. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error: + Error evaluating generator expression: + + \$<TARGET_OBJECTS:NoTarget> + + The evaluation of the TARGET_OBJECTS generator expression is only suitable + for consumption by CMake. It is not suitable for writing out elsewhere. diff --git a/Tests/RunCMake/TargetObjects/NoTarget.cmake b/Tests/RunCMake/TargetObjects/BadContext.cmake index f203c23..67962a4 100644 --- a/Tests/RunCMake/TargetObjects/NoTarget.cmake +++ b/Tests/RunCMake/TargetObjects/BadContext.cmake @@ -1,2 +1,4 @@ file(GENERATE OUTPUT test_output CONTENT $<TARGET_OBJECTS:NoTarget>) + +install(FILES $<TARGET_OBJECTS:NoTarget> DESTINATION objects) diff --git a/Tests/RunCMake/TargetObjects/NoTarget-result.txt b/Tests/RunCMake/TargetObjects/NoTarget-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/TargetObjects/NoTarget-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/TargetObjects/NoTarget-stderr.txt b/Tests/RunCMake/TargetObjects/NoTarget-stderr.txt deleted file mode 100644 index 2c4f877..0000000 --- a/Tests/RunCMake/TargetObjects/NoTarget-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at NoTarget.cmake:2 \(file\): - Error evaluating generator expression: - - \$<TARGET_OBJECTS:NoTarget> - - Objects of target "NoTarget" referenced but no such target exists. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt b/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt deleted file mode 100644 index bb83934..0000000 --- a/Tests/RunCMake/TargetObjects/NotObjlibTarget-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at NotObjlibTarget.cmake:4 \(file\): - Error evaluating generator expression: - - \$<TARGET_OBJECTS:StaticLib> - - Objects of target "StaticLib" referenced but is not an OBJECT library. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake b/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake deleted file mode 100644 index c7f8a71..0000000 --- a/Tests/RunCMake/TargetObjects/NotObjlibTarget.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -add_library(StaticLib empty.cpp) - -file(GENERATE OUTPUT test_output CONTENT $<TARGET_OBJECTS:StaticLib>) diff --git a/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake b/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake index 30b9fee..85c76e2 100644 --- a/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetObjects/RunCMakeTest.cmake @@ -1,4 +1,3 @@ include(RunCMake) -run_cmake(NoTarget) -run_cmake(NotObjlibTarget) +run_cmake(BadContext) diff --git a/Tests/RunCMake/TargetObjects/empty.cpp b/Tests/RunCMake/TargetObjects/empty.cpp deleted file mode 100644 index bfbbdde..0000000 --- a/Tests/RunCMake/TargetObjects/empty.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int empty() -{ - return 0; -} diff --git a/Tests/RunCMake/include/CMP0024-NEW-stderr.txt b/Tests/RunCMake/include/CMP0024-NEW-stderr.txt index 059d7e4..0fdb3ca 100644 --- a/Tests/RunCMake/include/CMP0024-NEW-stderr.txt +++ b/Tests/RunCMake/include/CMP0024-NEW-stderr.txt @@ -1,8 +1,4 @@ CMake Error at subdir2/CMakeLists.txt:2 \(include\): - Policy CMP0024 is not set: Disallow include export result. Run "cmake - --help-policy CMP0024" for policy details. Use the cmake_policy command to - set the policy and suppress this warning. - The file .*/Tests/RunCMake/include/CMP0024-NEW-build/subdir1/theTargets.cmake diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt index d27686d..8e3f315 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt @@ -1,9 +1,4 @@ CMake Error at CMP0023-NEW-2.cmake:11 \(target_link_libraries\): - Policy CMP0023 is not set: Plain and keyword target_link_libraries - signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The plain signature for target_link_libraries has already been used with the target "foo". All uses of target_link_libraries with a target must be either all-keyword or all-plain. diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt index d7be0ff..2ef2290 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt @@ -1,9 +1,4 @@ CMake Error at CMP0023-NEW.cmake:11 \(target_link_libraries\): - Policy CMP0023 is not set: Plain and keyword target_link_libraries - signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The plain signature for target_link_libraries has already been used with the target "foo". All uses of target_link_libraries with a target must be either all-keyword or all-plain. diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index 23dc6ae..4ae4bec 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -24,6 +24,7 @@ project(CMakeHelp NONE) option(SPHINX_MAN "Build man pages with Sphinx" OFF) option(SPHINX_HTML "Build html help with Sphinx" OFF) +option(SPHINX_QTHELP "Build Qt help with Sphinx" OFF) option(SPHINX_TEXT "Build text help with Sphinx (not installed)" OFF) find_program(SPHINX_EXECUTABLE NAMES sphinx-build @@ -32,7 +33,7 @@ find_program(SPHINX_EXECUTABLE mark_as_advanced(SPHINX_TEXT) -if(NOT SPHINX_MAN AND NOT SPHINX_HTML AND NOT SPHINX_TEXT) +if(NOT SPHINX_MAN AND NOT SPHINX_HTML AND NOT SPHINX_QTHELP AND NOT SPHINX_TEXT) return() elseif(NOT SPHINX_EXECUTABLE) message(FATAL_ERROR "SPHINX_EXECUTABLE (sphinx-build) is not found!") @@ -63,6 +64,25 @@ endif() if(SPHINX_TEXT) list(APPEND doc_formats text) endif() +if(SPHINX_QTHELP) + find_program(QCOLLECTIONGENERATOR_EXECUTABLE + NAMES qcollectiongenerator + DOC "qcollectiongenerator tool" + ) + if (NOT QCOLLECTIONGENERATOR_EXECUTABLE) + message(FATAL_ERROR "QCOLLECTIONGENERATOR_EXECUTABLE (qcollectiongenerator) not found!") + endif() + list(APPEND doc_formats qthelp) + + set(qthelp_extra_commands + # Workaround for assistant prior to + # https://codereview.qt-project.org/#change,82250 in Qt 4. + COMMAND ${CMAKE_COMMAND} "-DCSS_DIR=${CMAKE_CURRENT_BINARY_DIR}/qthelp/_static" + -P "${CMAKE_CURRENT_SOURCE_DIR}/apply_qthelp_css_workaround.cmake" + COMMAND qcollectiongenerator ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp + ) +endif() + set(doc_format_outputs "") set(doc_format_last "") @@ -78,6 +98,7 @@ foreach(format ${doc_formats}) ${CMake_SOURCE_DIR}/Help ${CMAKE_CURRENT_BINARY_DIR}/${format} > ${doc_format_log} # log stdout, pass stderr + ${${format}_extra_commands} DEPENDS ${doc_format_last} COMMENT "sphinx-build ${format}: see Utilities/Sphinx/${doc_format_log}" VERBATIM @@ -122,3 +143,8 @@ if(SPHINX_HTML) PATTERN objects.inv EXCLUDE ) endif() +if(SPHINX_QTHELP) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qch + DESTINATION ${CMAKE_DOC_DIR} + ) +endif() diff --git a/Utilities/Sphinx/apply_qthelp_css_workaround.cmake b/Utilities/Sphinx/apply_qthelp_css_workaround.cmake new file mode 100644 index 0000000..8b74d12 --- /dev/null +++ b/Utilities/Sphinx/apply_qthelp_css_workaround.cmake @@ -0,0 +1,15 @@ + +file(READ "${CSS_DIR}/basic.css" BasicCssContent) + +file(READ "${CSS_DIR}/default.css" DefaultCssContent) +string(REPLACE + "@import url(\"basic.css\")" "${BasicCssContent}" + DefaultCssContent "${DefaultCssContent}" +) + +file(READ "${CSS_DIR}/cmake.css" CMakeCssContent) +string(REPLACE + "@import url(\"default.css\")" "${DefaultCssContent}" + CMakeCssContent "${CMakeCssContent}" +) +file(WRITE "${CSS_DIR}/cmake.css" "${CMakeCssContent}") diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index 336c74a..2d83376 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -21,6 +21,24 @@ from pygments.lexer import bygroups CMakeLexer.tokens["args"].append(('(\\$<)(.+?)(>)', bygroups(Operator, Name.Variable, Operator))) +# Monkey patch for sphinx generating invalid content for qcollectiongenerator +# https://bitbucket.org/birkenfeld/sphinx/issue/1435/qthelp-builder-should-htmlescape-keywords +from sphinx.util.pycompat import htmlescape +from sphinx.builders.qthelp import QtHelpBuilder +old_build_keywords = QtHelpBuilder.build_keywords +def new_build_keywords(self, title, refs, subitems): + old_items = old_build_keywords(self, title, refs, subitems) + new_items = [] + for item in old_items: + before, rest = item.split("ref=\"", 1) + ref, after = rest.split("\"") + if ("<" in ref and ">" in ref): + new_items.append(before + "ref=\"" + htmlescape(ref) + "\"" + after) + else: + new_items.append(item) + return new_items +QtHelpBuilder.build_keywords = new_build_keywords + from docutils.parsers.rst import Directive, directives from docutils.transforms import Transform |