Merge branch 'master' into cmake_role-vs-fix

This commit is contained in:
Kyle Edwards
2019-02-26 17:28:04 -05:00
309 changed files with 4261 additions and 3057 deletions

View File

@@ -13,7 +13,7 @@ fi
# $2: language (e.g. C/CXX/Fortran)
# $3: The compiler ID, defaults to GNU.
# Possible values are: GNU, Intel, Clang, SunPro, HP, XL, VisualAge, PGI,
# PathScale, Cray, SCO, MIPSpro, MSVC
# PathScale, Cray, SCO, MSVC
# $4: optional extra arguments to cmake, e.g. "-DCMAKE_SIZEOF_VOID_P=8"
# $5: optional path to cmake binary
AC_DEFUN([CMAKE_FIND_PACKAGE], [

View File

@@ -102,9 +102,6 @@ if(CMake_INSTALL_COMPONENTS)
if(WIN32 AND NOT CYGWIN)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmcldeps)
endif()
if(APPLE)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmakexbuild)
endif()
if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME
${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})

View File

@@ -109,16 +109,6 @@ if(CPACK_GENERATOR MATCHES "IFW")
set(CPACK_IFW_COMPONENT_CMCLDEPS_VERSION
"@CMake_IFW_ROOT_COMPONENT_VERSION@")
set(CPACK_COMPONENT_CMAKEXBUILD_DISPLAY_NAME "cmakexbuild")
set(CPACK_COMPONENT_CMAKEXBUILD_DESCRIPTION
"The \"cmakexbuild\" executable is a wrapper program for \"xcodebuild\"")
set(CPACK_COMPONENT_CMAKEXBUILD_REQUIRED TRUE)
set(CPACK_COMPONENT_CMAKEXBUILD_GROUP Tools)
set(CPACK_IFW_COMPONENT_CMAKEXBUILD_NAME "CMakeXBuild")
set(CPACK_IFW_COMPONENT_CMAKEXBUILD_PRIORITY 85)
set(CPACK_IFW_COMPONENT_CMAKEXBUILD_VERSION
"@CMake_IFW_ROOT_COMPONENT_VERSION@")
# Dialogs
set(CPACK_COMPONENT_GROUP_DIALOGS_DISPLAY_NAME "Interactive Dialogs")
set(CPACK_COMPONENT_GROUP_DIALOGS_DESCRIPTION

View File

@@ -59,6 +59,11 @@ All remaining arguments are collected in a variable
where recognized. This can be checked afterwards to see
whether your macro was called with unrecognized parameters.
``<one_value_keywords>`` and ``<multi_value_keywords>`` that where given no
values at all are collected in a variable ``<prefix>_KEYWORDS_MISSING_VALUES``
that will be undefined if all keywords received values. This can be checked
to see if there where keywords without any values given.
As an example here a ``my_install()`` macro, which takes similar arguments
as the real :command:`install` command:
@@ -77,7 +82,7 @@ Assume ``my_install()`` has been called like this:
.. code-block:: cmake
my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub CONFIGURATIONS)
After the ``cmake_parse_arguments`` call the macro will have set or undefined
the following variables::
@@ -89,6 +94,8 @@ the following variables::
MY_INSTALL_TARGETS = "foo;bar"
MY_INSTALL_CONFIGURATIONS <UNDEFINED> # was not used
MY_INSTALL_UNPARSED_ARGUMENTS = "blub" # nothing expected after "OPTIONAL"
MY_INSTALL_KEYWORDS_MISSING_VALUES = "CONFIGURATIONS"
# No value for "CONFIGURATIONS" given
You can then continue and process these variables.
@@ -97,5 +104,6 @@ one_value_keyword another recognized keyword follows, this is
interpreted as the beginning of the new option. E.g.
``my_install(TARGETS foo DESTINATION OPTIONAL)`` would result in
``MY_INSTALL_DESTINATION`` set to ``"OPTIONAL"``, but as ``OPTIONAL``
is a keyword itself ``MY_INSTALL_DESTINATION`` will be empty and
``MY_INSTALL_OPTIONAL`` will therefore be set to ``TRUE``.
is a keyword itself ``MY_INSTALL_DESTINATION`` will be empty (but added
to ``MY_INSTALL_KEYWORDS_MISSING_VALUES``) and ``MY_INSTALL_OPTIONAL`` will
therefore be set to ``TRUE``.

View File

@@ -21,6 +21,9 @@ Synopsis
list(`APPEND`_ <list> [<element>...])
list(`FILTER`_ <list> {INCLUDE | EXCLUDE} REGEX <regex>)
list(`INSERT`_ <list> <index> [<element>...])
list(`POP_BACK`_ <list> [<out-var>...])
list(`POP_FRONT`_ <list> [<out-var>...])
list(`PREPEND`_ <list> [<element>...])
list(`REMOVE_ITEM`_ <list> <value>...)
list(`REMOVE_AT`_ <list> <index>...)
list(`REMOVE_DUPLICATES`_ <list>)
@@ -33,8 +36,9 @@ Synopsis
Introduction
^^^^^^^^^^^^
The list subcommands ``APPEND``, ``INSERT``, ``FILTER``, ``REMOVE_AT``,
``REMOVE_ITEM``, ``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create
The list subcommands ``APPEND``, ``INSERT``, ``FILTER``, ``PREPEND``,
``POP_BACK``, ``POP_FRONT``, ``REMOVE_AT``, ``REMOVE_ITEM``,
``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create
new values for the list within the current CMake variable scope. Similar to
the :command:`set` command, the LIST command creates new variable values in
the current scope, even if the list itself is actually defined in a parent
@@ -142,6 +146,34 @@ For more information on regular expressions see also the
Inserts elements to the list to the specified location.
.. _POP_BACK:
.. code-block:: cmake
list(POP_BACK <list> [<out-var>...])
If no variable name is given, removes exactly one element. Otherwise,
assign the last element's value to the given variable and removes it,
up to the last variable name given.
.. _POP_FRONT:
.. code-block:: cmake
list(POP_FRONT <list> [<out-var>...])
If no variable name is given, removes exactly one element. Otherwise,
assign the first element's value to the given variable and removes it,
up to the last variable name given.
.. _PREPEND:
.. code-block:: cmake
list(PREPEND <list> [<element> ...])
Insert elements to the 0th position in the list.
.. _REMOVE_ITEM:
.. code-block:: cmake

View File

@@ -3,9 +3,7 @@ Xcode
Generate Xcode project files.
This supports Xcode 3.0 and above. Support for Xcode versions prior
to Xcode 5 is deprecated and will be dropped in a future version of
CMake.
This supports Xcode 5.0 and above.
Toolset Selection
^^^^^^^^^^^^^^^^^

View File

@@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
to determine whether to report an error on use of deprecated macros or
functions.
Policies Introduced by CMake 3.15
=================================
.. toctree::
:maxdepth: 1
CMP0089: Compiler id for IBM Clang-based XL compilers is now XLClang. </policy/CMP0089>
Policies Introduced by CMake 3.14
=================================

View File

@@ -334,6 +334,7 @@ Properties on Targets
/prop_tgt/VS_IOT_STARTUP_TASK
/prop_tgt/VS_KEYWORD
/prop_tgt/VS_MOBILE_EXTENSIONS_VERSION
/prop_tgt/VS_NO_SOLUTION_DEPLOY
/prop_tgt/VS_SCC_AUXPATH
/prop_tgt/VS_SCC_LOCALPATH
/prop_tgt/VS_SCC_PROJECTNAME

30
Help/policy/CMP0089.rst Normal file
View File

@@ -0,0 +1,30 @@
CMP0089
-------
Compiler id for IBM Clang-based XL compilers is now ``XLClang``.
CMake 3.15 and above recognize that IBM's Clang-based XL compilers
that define ``__ibmxl__`` are a new front-end distinct from ``xlc``
with a different command line and set of capabilities.
CMake now prefers to present this to projects by setting the
:variable:`CMAKE_<LANG>_COMPILER_ID` variable to ``XLClang`` instead
of ``XL``. However, existing projects may assume the compiler id for
Clang-based XL is just ``XL`` as it was in CMake versions prior to 3.15.
Therefore this policy determines for Clang-based XL compilers 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 ``XL``. The
NEW behavior for this policy is to use compiler id ``XLClang``.
This policy was introduced in CMake version 3.15. 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_CMP0089 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
variable to control the warning.
.. include:: DEPRECATED.txt

View File

@@ -0,0 +1,46 @@
VS_NO_SOLUTION_DEPLOY
---------------------
Specify that the target should not be marked for deployment to a Windows CE
or Windows Phone device in the generated Visual Studio solution.
Be default, all EXE and shared library (DLL) targets are marked to deploy to
the target device in the generated Visual Studio solution.
Generator expressions are supported.
There are reasons one might want to exclude a target / generated project from
deployment:
- The library or executable may not be necessary in the primary deploy/debug
scenario, and excluding from deployment saves time in the
develop/download/debug cycle.
- There may be insufficient space on the target device to accommodate all of
the build products.
- Visual Studio 2013 requires a target device IP address be entered for each
target marked for deployment. For large numbers of targets, this can be
tedious.
NOTE: Visual Studio *will* deploy all project dependencies of a project
tagged for deployment to the IP address configured for that project even
if those dependencies are not tagged for deployment.
Example 1
^^^^^^^^^
This shows setting the variable for the target foo.
.. code-block:: cmake
add_library(foo SHARED foo.cpp)
set_property(TARGET foo PROPERTY VS_NO_SOLUTION_DEPLOY ON)
Example 2
^^^^^^^^^
This shows setting the variable for the Release configuration only.
.. code-block:: cmake
add_library(foo SHARED foo.cpp)
set_property(TARGET foo PROPERTY VS_NO_SOLUTION_DEPLOY "$<CONFIG:Release>")

View File

@@ -0,0 +1,7 @@
0-sample-topic
--------------
* This is a sample release note for the change in a topic.
Developers should add similar notes for each topic branch
making a noteworthy change. Each document should be named
and titled to match the topic name to avoid merge conflicts.

View File

@@ -0,0 +1,4 @@
FindCups-imported-target
------------------------
* The :module:`FindCups` module now provides imported targets.

View File

@@ -0,0 +1,5 @@
add-xlclang
-----------
* IBM Clang-based XL compilers that define ``__ibmxl__`` now use the
compiler id ``XLClang`` instead of ``XL``. See policy :policy:`CMP0089`.

View File

@@ -0,0 +1,6 @@
cmake_parse_arguments-keywords_missing_values
---------------------------------------------
* The :command:`cmake_parse_arguments` command gained an additional
``<prefix>_KEYWORDS_MISSING_VALUES`` output variable to report
keyword arguments that were given by the caller with no values.

View File

@@ -0,0 +1,8 @@
deprecate-policy-old
--------------------
* An explicit deprecation diagnostic was added for policy ``CMP0066``
(``CMP0065`` and below were already deprecated).
The :manual:`cmake-policies(7)` manual explains that the OLD behaviors
of all policies are deprecated and that projects should port to the
NEW behaviors.

View File

@@ -0,0 +1,4 @@
list-prepend-and-pop-subcommands
--------------------------------
* :command:`list` learned new sub-commands ``PREPEND``, ``POP_FRONT`` and ``POP_BACK``.

View File

@@ -0,0 +1,4 @@
require-xcode-5
---------------
* The :generator:`Xcode` generator now requires at least Xcode 5.

View File

@@ -0,0 +1,6 @@
vs_wince_no_deploy
------------------
* A :prop_tgt:`VS_NO_SOLUTION_DEPLOY` target property was added to
tell :ref:`Visual Studio Generators` whether to deploy an artifact
to the WinCE or Windows Phone target device.

View File

@@ -7,6 +7,8 @@ CMake Release Notes
This file should include the adjacent "dev.txt" file
in development versions but not in release versions.
.. include:: dev.txt
Releases
========

View File

@@ -24,7 +24,6 @@ include:
HP = Hewlett-Packard Compiler (hp.com)
IAR = IAR Systems (iar.com)
Intel = Intel Compiler (intel.com)
MIPSpro = SGI MIPSpro (sgi.com)
MSVC = Microsoft Visual Studio (microsoft.com)
NVIDIA = NVIDIA CUDA Compiler (nvidia.com)
OpenWatcom = Open Watcom (openwatcom.org)

View File

@@ -19,15 +19,11 @@ to configure the project:
This generator stores ``CMAKE_MAKE_PROGRAM`` in the CMake cache
so that it may be edited by the user.
* The :generator:`Xcode` generator sets this to ``xcodebuild`` (or possibly an
otherwise undocumented ``cmakexbuild`` wrapper implementing some
workarounds).
* The :generator:`Xcode` generator sets this to ``xcodebuild``.
This generator prefers to lookup the build tool at build time
rather than to store ``CMAKE_MAKE_PROGRAM`` in the CMake cache
ahead of time. This is because ``xcodebuild`` is easy to find,
the ``cmakexbuild`` wrapper is needed only for older Xcode versions,
and the path to ``cmakexbuild`` may be outdated if CMake itself moves.
ahead of time. This is because ``xcodebuild`` is easy to find.
For compatibility with versions of CMake prior to 3.2, if
a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to

View File

@@ -21,6 +21,8 @@ warn by default:
policy :policy:`CMP0067`.
* ``CMAKE_POLICY_WARNING_CMP0082`` controls the warning for
policy :policy:`CMP0082`.
* ``CMAKE_POLICY_WARNING_CMP0089`` controls the warning for
policy :policy:`CMP0089`.
This variable should not be set by a project in CMake code. Project
developers running CMake may set this variable in their cache to

View File

@@ -57,6 +57,7 @@ function(compiler_id_detection outvar lang)
HP
Compaq
zOS
XLClang
XL
VisualAge
PGI
@@ -86,8 +87,6 @@ function(compiler_id_detection outvar lang)
SDCC
)
endif()
list(APPEND ordered_compilers
MIPSpro)
#Currently the only CUDA compilers are NVIDIA
if(lang STREQUAL CUDA)

View File

@@ -139,8 +139,9 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC")
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_5})
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(CMAKE_C_COMPILER_TARGET)
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-)

View File

@@ -136,8 +136,9 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC")
get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_5})
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if(CMAKE_CXX_COMPILER_TARGET)
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-)

View File

@@ -96,13 +96,6 @@
# if defined(__FLANG_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__FLANG_PATCHLEVEL__)
# endif
#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
PRINT *, 'INFO:compiler[MIPSpro]'
# if 0
! This compiler is either not known or is too old to define an
! identification macro. Try to identify the platform and guess that
! it is the native compiler.
# endif
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
PRINT *, 'INFO:compiler[VisualAge]'
#elif defined(__hpux) || defined(__hpux__)

View File

@@ -92,13 +92,15 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var)
endif()
# XL compiler
if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL" AND "${line}" MATCHES "^/"
if(("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL"
OR "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XLClang")
AND "${line}" MATCHES "^/"
AND ( ("${lang}" STREQUAL "Fortran" AND
"${line}" MATCHES "/xl[fF]entry " AND
"${line}" MATCHES "OSVAR\\([^ ]+\\)")
OR
( ("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "CXX") AND
"${line}" MATCHES "/xl[cC]entry " AND
"${line}" MATCHES "/xl[cC]2?entry " AND
"${line}" MATCHES " -qosvar=")
) )
# -qnostdinc cancels other stdinc flags, even if present

View File

@@ -1,8 +1,93 @@
# Guard against multiple inclusions
if(__craylinux_crayprgenv)
if(__cmake_craype_crayprgenv)
return()
endif()
set(__craylinux_crayprgenv 1)
set(__cmake_craype_crayprgenv 1)
# CrayPrgEnv: loaded when compiling through the Cray compiler wrapper.
# The compiler wrapper can run on a front-end node or a compute node.
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
# One-time setup of the craype environment. First, check the wrapper config.
# The wrapper's selection of a compiler (gcc, clang, intel, etc.) and
# default include/library paths is selected using the "module" command.
# The CRAYPE_LINK_TYPE environment variable partly controls if static
# or dynamic binaries are generated (see __cmake_craype_linktype below).
# Running cmake and then changing module and/or linktype configuration
# may cause build problems (since the data in the cmake cache may no
# longer be correct after the change). We can look for this and warn
# the user about it. Second, use the "module" provided PKG_CONFIG_PATH-like
# environment variable to add additional prefixes to the system prefix
# path.
function(__cmake_craype_setupenv)
if(NOT DEFINED __cmake_craype_setupenv_done) # only done once per run
set(__cmake_craype_setupenv_done 1 PARENT_SCOPE)
unset(__cmake_check)
set(CMAKE_CRAYPE_LINKTYPE "$ENV{CRAYPE_LINK_TYPE}" CACHE STRING
"saved value of CRAYPE_LINK_TYPE environment variable")
set(CMAKE_CRAYPE_LOADEDMODULES "$ENV{LOADEDMODULES}" CACHE STRING
"saved value of LOADEDMODULES environment variable")
mark_as_advanced(CMAKE_CRAYPE_LINKTYPE CMAKE_CRAYPE_LOADEDMODULES)
if (NOT "${CMAKE_CRAYPE_LINKTYPE}" STREQUAL "$ENV{CRAYPE_LINK_TYPE}")
string(APPEND __cmake_check "CRAYPE_LINK_TYPE ")
endif()
if (NOT "${CMAKE_CRAYPE_LOADEDMODULES}" STREQUAL "$ENV{LOADEDMODULES}")
string(APPEND __cmake_check "LOADEDMODULES ")
endif()
if(DEFINED __cmake_check)
message(STATUS "NOTE: ${__cmake_check}changed since initial config!")
message(STATUS "NOTE: this may cause unexpected build errors.")
endif()
# loop over variables of interest
foreach(pkgcfgvar PKG_CONFIG_PATH PKG_CONFIG_PATH_DEFAULT
PE_PKG_CONFIG_PATH)
file(TO_CMAKE_PATH "$ENV{${pkgcfgvar}}" pkgcfg)
foreach(path ${pkgcfg})
string(REGEX REPLACE "(.*)/lib[^/]*/pkgconfig$" "\\1" path "${path}")
if(NOT "${path}" STREQUAL "" AND
NOT "${path}" IN_LIST CMAKE_SYSTEM_PREFIX_PATH)
list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${path}")
endif()
endforeach()
endforeach()
# push it up out of this function into the parent scope
set(CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_SYSTEM_PREFIX_PATH}" PARENT_SCOPE)
endif()
endfunction()
# The wrapper disables dynamic linking by default. Dynamic linking is
# enabled either by setting $ENV{CRAYPE_LINK_TYPE} to "dynamic" or by
# specifying "-dynamic" to the wrapper when linking. Specifying "-static"
# to the wrapper when linking takes priority over $ENV{CRAYPE_LINK_TYPE}.
# Furthermore, if you specify multiple "-dynamic" and "-static" flags to
# the wrapper when linking, the last one will win. In this case, the
# wrapper will also print a warning like:
# Warning: -dynamic was already seen on command line, overriding with -static.
#
# note that cmake applies both CMAKE_${lang}_FLAGS and CMAKE_EXE_LINKER_FLAGS
# (in that order) to the linking command, so -dynamic can appear in either
# variable.
function(__cmake_craype_linktype lang rv)
# start with ENV, but allow flags to override
if("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic")
set(linktype dynamic)
else()
set(linktype static)
endif()
# combine flags and convert to a list so we can apply the flags in order
set(linkflags "${CMAKE_${lang}_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
string(REPLACE " " ";" linkflags "${linkflags}")
foreach(flag IN LISTS linkflags)
if("${flag}" STREQUAL "-dynamic")
set(linktype dynamic)
elseif("${flag}" STREQUAL "-static")
set(linktype static)
endif()
endforeach()
set(${rv} ${linktype} PARENT_SCOPE)
endfunction()
macro(__CrayPrgEnv_setup lang)
if(DEFINED ENV{CRAYPE_VERSION})
@@ -13,25 +98,25 @@ macro(__CrayPrgEnv_setup lang)
message(STATUS "Cray Programming Environment (unknown version) ${lang}")
endif()
# setup the craype environment
__cmake_craype_setupenv()
# Flags for the Cray wrappers
set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic")
# If the link type is not explicitly specified in the environment then
# the Cray wrappers assume that the code will be built statically so
# we check the following condition(s) are NOT met
# Compiler flags are explicitly dynamic
# Env var is dynamic and compiler flags are not explicitly static
if(NOT (((CMAKE_${lang}_FLAGS MATCHES "(^| )-dynamic($| )") OR
(CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )"))
OR
(("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND
NOT ((CMAKE_${lang}_FLAGS MATCHES "(^| )-static($| )") OR
(CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )")))))
# determine linktype from environment and compiler flags
__cmake_craype_linktype(${lang} __cmake_craype_${lang}_linktype)
# switch off shared libs if we get a static linktype
if("${__cmake_craype_${lang}_linktype}" STREQUAL "static")
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
set(BUILD_SHARED_LIBS FALSE CACHE BOOL "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_LINK_SEARCH_START_STATIC TRUE)
endif()
endmacro()
cmake_policy(POP)

View File

@@ -18,7 +18,7 @@ get_filename_component(__gcc_hints "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPIL
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x_y}"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x}"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_COMPILER_SUFFIX}"
HINTS ${__gcc_hints}
DOC "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler"
)
@@ -28,7 +28,7 @@ mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR)
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x_y}"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x}"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${_CMAKE_COMPILER_SUFFIX}"
HINTS ${__gcc_hints}
DOC "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler"
)

View File

@@ -1,14 +1,6 @@
set(_compiler_id_version_compute "
# if defined(__ibmxl__)
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__)
# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__)
# else
/* __IBMC__ = VRP */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMC__/100)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMC__/10 % 10)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMC__ % 10)
# endif
")
/* __IBMC__ = VRP */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMC__/100)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMC__/10 % 10)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMC__ % 10)")

View File

@@ -1,14 +1,6 @@
set(_compiler_id_version_compute "
# if defined(__ibmxl__)
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__)
# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__)
# else
/* __IBMCPP__ = VRP */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMCPP__/100)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMCPP__/10 % 10)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMCPP__ % 10)
# endif
")
/* __IBMCPP__ = VRP */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMCPP__/100)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMCPP__/10 % 10)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMCPP__ % 10)")

View File

@@ -1 +0,0 @@
set(CMAKE_C_VERBOSE_FLAG "-v")

View File

@@ -1 +0,0 @@
set(CMAKE_CXX_VERBOSE_FLAG "-v")

View File

@@ -1,15 +0,0 @@
set(_compiler_id_pp_test "defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)")
set(_compiler_id_version_compute "
# if defined(_SGI_COMPILER_VERSION)
/* _SGI_COMPILER_VERSION = VRP */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_SGI_COMPILER_VERSION/100)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_SGI_COMPILER_VERSION/10 % 10)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_SGI_COMPILER_VERSION % 10)
# else
/* _COMPILER_VERSION = VRP */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_COMPILER_VERSION/100)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_COMPILER_VERSION/10 % 10)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_COMPILER_VERSION % 10)
# endif")

View File

@@ -1,3 +0,0 @@
set(CMAKE_Fortran_VERBOSE_FLAG "-v")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixedform")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-freeform")

View File

@@ -1,4 +1,4 @@
set(_compiler_id_pp_test "defined(__ibmxl__) || (defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800)")
set(_compiler_id_pp_test "defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800")
include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake")

View File

@@ -6,36 +6,15 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
# -qthreaded = Ensures that all optimizations will be thread-safe
string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded")
# XL v13.1.1 for Linux ppc64 little-endian switched to using a clang based
# front end and accepts the -std= option while only reserving -qlanglevel= for
# compatibility. All other versions (previous versions on Linux ppc64
# little-endian, all versions on Linux ppc64 big-endian, all versions on AIX
# and BGQ, etc) are derived from the UNIX compiler and only accept the
# -qlanglvl option.
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1)
if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
else ()
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
endif ()
else ()
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-qlanglvl=extc99")
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.1)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
endif ()
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-qlanglvl=extc99")
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.1)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
endif ()
endif()
__compiler_check_default_language_standard(C 10.1 90)
__compiler_check_default_language_standard(C 10.1 90 11.1 99)

View File

@@ -1,4 +1,4 @@
set(_compiler_id_pp_test "defined(__ibmxl__) || (defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800)")
set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800")
include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake")

View File

@@ -6,41 +6,16 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
# -qthreaded = Ensures that all optimizations will be thread-safe
string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded")
# XL v13.1.1 for Linux ppc64 little-endian switched to using a clang based
# front end and accepts the -std= option while only reserving -qlanglevel= for
# compatibility. All other versions (previous versions on Linux ppc64
# little-endian, all versions on Linux ppc64 big-endian, all versions on AIX
# and BGQ, etc) are derived from the UNIX compiler and only accept the
# -qlanglvl option.
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1)
if (CMAKE_SYSTEM MATCHES "Linux.*ppc64")
if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-qlanglvl=extended1y")
else ()
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
endif ()
else ()
# The non-clang based Linux ppc64 compiler, both big-endian and
# little-endian lacks, the non-extension language level flags
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=extended")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended")
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
endif ()
else ()
if(CMAKE_SYSTEM MATCHES "Linux")
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
else()
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=strict98")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended")
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
endif ()
endif()
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
endif ()
__compiler_check_default_language_standard(CXX 10.1 98)

View File

@@ -10,12 +10,6 @@ set(__COMPILER_XL 1)
include(Compiler/CMakeCommonCompilerMacros)
# Find the CreateExportList program that comes with this toolchain.
find_program(CMAKE_XL_CreateExportList
NAMES CreateExportList
DOC "IBM XL CreateExportList tool"
)
macro(__compiler_xl lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-V")
@@ -35,20 +29,4 @@ macro(__compiler_xl lang)
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
set(CMAKE_DEPFILE_FLAGS_${lang} "-MF <DEPFILE> -qmakedep=gcc")
# CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones.
# If we found the tool, we'll use it to create exports, otherwise stick with the regular
# create shared library compile line.
if (CMAKE_XL_CreateExportList)
# The compiler front-end passes all object files, archive files, and shared
# library files named on the command line to CreateExportList to create a
# list of all symbols to be exported from the shared library. This causes
# all archive members to be copied into the shared library whether they are
# needed or not. Instead we run the tool ourselves to pass only the object
# files so that we export only the symbols actually provided by the sources.
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
"${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>"
"<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
)
endif()
endmacro()

View File

@@ -0,0 +1,8 @@
set(_compiler_id_pp_test "defined(__ibmxl__) && defined(__clang__)")
set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__)
# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__)
")

View File

@@ -0,0 +1,17 @@
include(Compiler/XLClang)
__compiler_xlclang(C)
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
endif ()
endif()
__compiler_check_default_language_standard(C 13.1.1 99)

View File

@@ -0,0 +1,8 @@
set(_compiler_id_pp_test "defined(__ibmxl__) && defined(__clang__)")
set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__)
# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__)
")

View File

@@ -0,0 +1,20 @@
include(Compiler/XLClang)
__compiler_xlclang(CXX)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
endif ()
endif()
__compiler_check_default_language_standard(CXX 13.1.1 98)
set(CMAKE_CXX_COMPILE_OBJECT
"<CMAKE_CXX_COMPILER> -x c++ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")

View File

@@ -0,0 +1,22 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__COMPILER_XLCLANG)
return()
endif()
set(__COMPILER_XLCLANG 1)
include(Compiler/XL)
macro(__compiler_xlclang lang)
__compiler_xl(${lang})
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-V")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIC")
set(CMAKE_${lang}_RESPONSE_FILE_FLAG "@")
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
endmacro()

View File

@@ -5,18 +5,38 @@
FindCups
--------
Try to find the Cups printing system
Find the CUPS printing system.
Once done this will define
Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which
features this function (i.e. at least 1.1.19)
::
Imported targets
^^^^^^^^^^^^^^^^
CUPS_FOUND - system has Cups
CUPS_INCLUDE_DIR - the Cups include directory
CUPS_LIBRARIES - Libraries needed to use Cups
CUPS_VERSION_STRING - version of Cups found (since CMake 2.8.8)
Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which
features this function (i.e. at least 1.1.19)
This module defines :prop_tgt:`IMPORTED` target ``Cups::Cups``, if Cups has
been found.
Result variables
^^^^^^^^^^^^^^^^
This module will set the following variables in your project:
``CUPS_FOUND``
true if CUPS headers and libraries were found
``CUPS_INCLUDE_DIRS``
the directory containing the Cups headers
``CUPS_LIBRARIES``
the libraries to link against to use CUPS.
``CUPS_VERSION_STRING``
the version of CUPS found (since CMake 2.8.8)
Cache variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``CUPS_INCLUDE_DIR``
the directory containing the Cups headers
#]=======================================================================]
find_path(CUPS_INCLUDE_DIR cups/cups.h )
@@ -66,3 +86,13 @@ else ()
endif ()
mark_as_advanced(CUPS_INCLUDE_DIR CUPS_LIBRARIES)
if (CUPS_FOUND)
set(CUPS_INCLUDE_DIRS "${CUPS_INCLUDE_DIR}")
if (NOT TARGET Cups::Cups)
add_library(Cups::Cups INTERFACE IMPORTED)
set_target_properties(Cups::Cups PROPERTIES
INTERFACE_LINK_LIBRARIES "${CUPS_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${CUPS_INCLUDE_DIR}")
endif ()
endif ()

View File

@@ -96,7 +96,6 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
else()
set(OMP_FLAG_Intel "-qopenmp")
endif()
set(OMP_FLAG_MIPSpro "-mp")
set(OMP_FLAG_MSVC "-openmp")
set(OMP_FLAG_PathScale "-openmp")
set(OMP_FLAG_NAG "-openmp")

View File

@@ -15,11 +15,11 @@ int main() { return 0; }
# List manglings of global symbol names to try.
set(global_symbols
my_sub # VisualAge
my_sub_ # GNU, Intel, HP, SunPro, MIPSpro, PGI
my_sub_ # GNU, Intel, HP, SunPro, PGI
my_sub__ # GNU g77
MY_SUB # Intel on Windows
mysub # VisualAge
mysub_ # GNU, Intel, HP, SunPro, MIPSpro, PGI
mysub_ # GNU, Intel, HP, SunPro, PGI
MYSUB # Intel on Windows
${FortranCInterface_GLOBAL_SYMBOLS}
)
@@ -48,7 +48,6 @@ set(module_symbols
list(REMOVE_DUPLICATES module_symbols)
# Note that some compiler manglings cannot be invoked from C:
# MIPSpro uses "MY_SUB.in.MY_MODULE"
# SunPro uses "my_module.my_sub_"
# PathScale uses "MY_SUB.in.MY_MODULE"

View File

@@ -63,6 +63,11 @@ function(get_unix_permissions_octal_notation PERMISSIONS_VAR RETURN_VAR)
set(${RETURN_VAR} "${OWNER_PERMISSIONS}${GROUP_PERMISSIONS}${WORLD_PERMISSIONS}" PARENT_SCOPE)
endfunction()
function(cpack_rpm_exact_regex regex_var string)
string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" regex "${string}")
set("${regex_var}" "${regex}" PARENT_SCOPE)
endfunction()
function(cpack_rpm_prepare_relocation_paths)
# set appropriate prefix, remove possible trailing slash and convert backslashes to slashes
if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX)
@@ -482,7 +487,9 @@ function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXE
# recalculate path length after conversion to canonical form
string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_)
if(SYMLINK_POINT_ MATCHES "${WDIR}/.*")
cpack_rpm_exact_regex(IN_SYMLINK_POINT_REGEX "${WDIR}")
string(APPEND IN_SYMLINK_POINT_REGEX "/.*")
if(SYMLINK_POINT_ MATCHES "${IN_SYMLINK_POINT_REGEX}")
# only symlinks that are pointing inside the packaging structure should be checked for relocation
string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_)
cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS")

View File

@@ -25,4 +25,26 @@ macro(__aix_compiler_xl lang)
set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ")
set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
# Find the CreateExportList program that comes with this toolchain.
find_program(CMAKE_XL_CreateExportList
NAMES CreateExportList
DOC "IBM XL CreateExportList tool"
)
# CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones.
# If we found the tool, we'll use it to create exports, otherwise stick with the regular
# create shared library compile line.
if (CMAKE_XL_CreateExportList)
# The compiler front-end passes all object files, archive files, and shared
# library files named on the command line to CreateExportList to create a
# list of all symbols to be exported from the shared library. This causes
# all archive members to be copied into the shared library whether they are
# needed or not. Instead we run the tool ourselves to pass only the object
# files so that we export only the symbols actually provided by the sources.
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
"${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>"
"<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
)
endif()
endmacro()

View File

@@ -0,0 +1,2 @@
include(Platform/AIX-XLClang)
__aix_compiler_xlclang(C)

View File

@@ -0,0 +1,2 @@
include(Platform/AIX-XLClang)
__aix_compiler_xlclang(CXX)

View File

@@ -0,0 +1,15 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__AIX_COMPILER_XLCLANG)
return()
endif()
set(__AIX_COMPILER_XLCLANG 1)
include(Platform/AIX-XL)
macro(__aix_compiler_xlclang lang)
__aix_compiler_xl(${lang})
endmacro()

View File

@@ -1,6 +1,5 @@
# Compute Node Linux doesn't quite work the same as native Linux so all of this
# needs to be custom. We use the variables defined through Cray's environment
# modules to set up the right paths for things.
# CrayLinuxEnvironment: loaded by users cross-compiling on a Cray front-end
# node by specifying "-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment" to cmake
set(UNIX 1)
@@ -30,13 +29,6 @@ endif()
# Note: this may need to change in the future with 64-bit ARM
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
# Don't override shared lib support if it's already been set and possibly
# overridden elsewhere by the CrayPrgEnv module
if(NOT CMAKE_FIND_LIBRARY_SUFFIXES)
@@ -44,12 +36,9 @@ if(NOT CMAKE_FIND_LIBRARY_SUFFIXES)
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
endif()
set(CMAKE_DL_LIBS dl)
# The rest of this file is based on UnixPaths.cmake, adjusted for Cray
# Note: Much of this is pulled from UnixPaths.cmake but adjusted to the Cray
# environment accordingly
# Get the install directory of the running cmake to the search directories
# add the install directory of the running cmake to the search directories
# CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up
get_filename_component(__cmake_install_dir "${CMAKE_ROOT}" PATH)
get_filename_component(__cmake_install_dir "${__cmake_install_dir}" PATH)
@@ -81,7 +70,6 @@ if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
endif()
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
$ENV{SYSROOT_DIR}/usr/include
$ENV{SYSROOT_DIR}/usr/include/X11
)
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
@@ -95,57 +83,5 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
$ENV{SYSROOT_DIR}/lib64
)
# Compute the intersection of several lists
function(__cray_list_intersect OUTPUT INPUT0)
if(ARGC EQUAL 2)
list(APPEND ${OUTPUT} ${${INPUT0}})
else()
foreach(I IN LISTS ${INPUT0})
set(__is_common 1)
foreach(L IN LISTS ARGN)
list(FIND ${L} "${I}" __idx)
if(__idx EQUAL -1)
set(__is_common 0)
break()
endif()
endforeach()
if(__is_common)
list(APPEND ${OUTPUT} "${I}")
endif()
endforeach()
endif()
set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE)
endfunction()
macro(__list_clean_dupes var)
if(${var})
list(REMOVE_DUPLICATES ${var})
endif()
endmacro()
get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES)
set(__cray_inc_path_vars)
set(__cray_lib_path_vars)
foreach(__lang IN LISTS __langs)
list(APPEND __cray_inc_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES)
list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES)
endforeach()
if(__cray_inc_path_vars)
__cray_list_intersect(__cray_implicit_include_dirs ${__cray_inc_path_vars})
if(__cray_implicit_include_dirs)
list(INSERT CMAKE_SYSTEM_INCLUDE_PATH 0 ${__cray_implicit_include_dirs})
endif()
endif()
if(__cray_lib_path_vars)
__cray_list_intersect(__cray_implicit_library_dirs ${__cray_lib_path_vars})
if(__cray_implicit_library_dirs)
list(INSERT CMAKE_SYSTEM_LIBRARY_PATH 0 ${__cray_implicit_library_dirs})
endif()
endif()
__list_clean_dupes(CMAKE_SYSTEM_PREFIX_PATH)
__list_clean_dupes(CMAKE_SYSTEM_INCLUDE_PATH)
__list_clean_dupes(CMAKE_SYSTEM_LIBRARY_PATH)
__list_clean_dupes(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES)
# Enable use of lib64 search path variants by default.
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)

View File

@@ -57,21 +57,39 @@ You need to have a C++ compiler (supporting C++11) and a ``make`` installed.
Run the ``bootstrap`` script you find in the source directory of CMake.
You can use the ``--help`` option to see the supported options.
You may use the ``--prefix=<install_prefix>`` option to specify a custom
installation directory for CMake. You can run the ``bootstrap`` script from
within the CMake source directory or any other build directory of your
choice. Once this has finished successfully, run ``make`` and
``make install``. In summary::
installation directory for CMake. Once this has finished successfully,
run ``make`` and ``make install``.
$ ./bootstrap && make && sudo make install
For example, if you simply want to build and install CMake from source,
you can build directly in the source tree::
$ ./bootstrap && make && sudo make install
Or, if you plan to develop CMake or otherwise run the test suite, create
a separate build tree::
$ mkdir cmake-build && cd cmake-build
$ ../cmake-source/bootstrap && make
Windows
^^^^^^^
You need to download and install a binary release of CMake in order to build
CMake. You can get these releases from the `CMake Download Page`_. Then
proceed with the instructions below.
There are two ways for building CMake under Windows:
1. Compile with MSVC from VS 2015 or later.
You need to download and install a binary release of CMake. You can get
these releases from the `CMake Download Page`_. Then proceed with the
instructions below for `Building CMake with CMake`_.
2. Bootstrap with MinGW under MSYS2.
Download and install `MSYS2`_. Then install the required build tools::
$ pacman -S --needed git base-devel mingw-w64-x86_64-gcc
and bootstrap as above.
.. _`CMake Download Page`: https://cmake.org/cmake/resources/software.html
.. _`MSYS2`: https://www.msys2.org/
Building CMake with CMake
-------------------------

View File

@@ -1060,9 +1060,6 @@ if(CPACK_ENABLE_FREEBSD_PKG AND FREEBSD_PKG_INCLUDE_DIRS AND FREEBSD_PKG_LIBRARI
endif()
if(APPLE)
add_executable(cmakexbuild cmakexbuild.cxx)
list(APPEND _tools cmakexbuild)
target_link_libraries(cmakexbuild CMakeLib)
add_executable(OSXScriptLauncher
CPack/OSXScriptLauncher.cxx)
target_link_libraries(OSXScriptLauncher cmsys)

View File

@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 14)
set(CMake_VERSION_PATCH 0)
set(CMake_VERSION_RC 2)
set(CMake_VERSION_PATCH 20190226)
#set(CMake_VERSION_RC 1)

View File

@@ -85,8 +85,8 @@ int cmCPackIFWGenerator::PackageFiles()
int retVal = 1;
cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl);
bool res = cmSystemTools::RunSingleCommand(
ifwCmd.c_str(), &output, &output, &retVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
ifwCmd, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero());
if (!res || retVal) {
cmGeneratedFileStream ofs(ifwTmpFile);
ofs << "# Run command: " << ifwCmd << std::endl
@@ -198,8 +198,8 @@ int cmCPackIFWGenerator::PackageFiles()
int retVal = 1;
cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl);
bool res = cmSystemTools::RunSingleCommand(
ifwCmd.c_str(), &output, &output, &retVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
ifwCmd, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero());
if (!res || retVal) {
cmGeneratedFileStream ofs(ifwTmpFile);
ofs << "# Run command: " << ifwCmd << std::endl

View File

@@ -73,7 +73,7 @@ int main(int argc, char* argv[])
args.push_back(nullptr);
cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetCommand(cp, &*args.begin());
cmsysProcess_SetCommand(cp, args.data());
cmsysProcess_SetWorkingDirectory(cp, scriptDirectory.c_str());
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
cmsysProcess_SetTimeout(cp, 0);

View File

@@ -61,9 +61,8 @@ bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command)
std::string output;
int returnValue = 0;
bool status = cmSystemTools::RunSingleCommand(command.c_str(), &output,
&output, &returnValue, 0,
cmSystemTools::OUTPUT_NONE);
bool status = cmSystemTools::RunSingleCommand(
command, &output, &output, &returnValue, 0, cmSystemTools::OUTPUT_NONE);
cmsys::ofstream logFile(logFileName.c_str(), std::ios::app);
logFile << command << std::endl;
@@ -619,7 +618,7 @@ bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
std::string mainSourceFilePath = this->CPackTopLevel + "/main.wxs";
if (!ConfigureFile(wixTemplate.c_str(), mainSourceFilePath.c_str())) {
if (!ConfigureFile(wixTemplate, mainSourceFilePath)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Failed creating '" << mainSourceFilePath
<< "'' from template." << std::endl);

View File

@@ -44,10 +44,9 @@ int cmCPackCygwinBinaryGenerator::PackageFiles()
// to create the file before the super class is called
{
cmGeneratedFileStream ofs(manifestFile.c_str());
for (std::vector<std::string>::const_iterator i = files.begin();
i != files.end(); ++i) {
for (std::string const& file : files) {
// remove the temp dir and replace with /usr
ofs << (*i).substr(tempdir.size()) << "\n";
ofs << file.substr(tempdir.size()) << "\n";
}
ofs << manifest << "\n";
}

View File

@@ -244,8 +244,8 @@ bool cmCPackDragNDropGenerator::RunCommand(std::ostringstream& command,
int exit_code = 1;
bool result = cmSystemTools::RunSingleCommand(
command.str().c_str(), output, output, &exit_code, nullptr,
this->GeneratorVerbose, cmDuration::zero());
command.str(), output, output, &exit_code, nullptr, this->GeneratorVerbose,
cmDuration::zero());
if (!result || exit_code) {
cmCPackLogger(cmCPackLog::LOG_ERROR,

View File

@@ -43,7 +43,8 @@ cmCPackGenerator::~cmCPackGenerator()
this->MakefileMap = nullptr;
}
void cmCPackGenerator::DisplayVerboseOutput(const char* msg, float progress)
void cmCPackGenerator::DisplayVerboseOutput(const std::string& msg,
float progress)
{
(void)progress;
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "" << msg << std::endl);
@@ -278,7 +279,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
std::string output;
int retVal = 1;
bool resB = cmSystemTools::RunSingleCommand(
ic.c_str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose,
ic, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero());
if (!resB || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
@@ -387,8 +388,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
/* If it is not a symlink then do a plain copy */
else if (!(cmSystemTools::CopyFileIfDifferent(inFile, filePath) &&
cmSystemTools::CopyFileTime(inFile.c_str(),
filePath.c_str()))) {
cmSystemTools::CopyFileTime(inFile, filePath))) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem copying file: " << inFile << " -> "
<< filePath << std::endl);
@@ -647,8 +647,8 @@ int cmCPackGenerator::RunPreinstallTarget(
std::string output;
int retVal = 1;
bool resB = cmSystemTools::RunSingleCommand(
buildCommand.c_str(), &output, &output, &retVal,
installDirectory.c_str(), this->GeneratorVerbose, cmDuration::zero());
buildCommand, &output, &output, &retVal, installDirectory.c_str(),
this->GeneratorVerbose, cmDuration::zero());
if (!resB || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/PreinstallOutput.log";
@@ -689,7 +689,7 @@ int cmCPackGenerator::InstallCMakeProject(
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cm.AddCMakePaths();
cm.SetProgressCallback([this](const char* msg, float prog) {
cm.SetProgressCallback([this](const std::string& msg, float prog) {
this->DisplayVerboseOutput(msg, prog);
});
cm.SetTrace(this->Trace);
@@ -1245,7 +1245,8 @@ bool cmCPackGenerator::ConfigureString(const std::string& inString,
return true;
}
bool cmCPackGenerator::ConfigureFile(const char* inName, const char* outName,
bool cmCPackGenerator::ConfigureFile(const std::string& inName,
const std::string& outName,
bool copyOnly /* = false */)
{
return this->MakefileMap->ConfigureFile(inName, outName, copyOnly, true,
@@ -1254,9 +1255,8 @@ bool cmCPackGenerator::ConfigureFile(const char* inName, const char* outName,
int cmCPackGenerator::CleanTemporaryDirectory()
{
std::string tempInstallDirectoryWithPostfix =
std::string tempInstallDirectory =
this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
if (cmsys::SystemTools::FileExists(tempInstallDirectory)) {
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Clean temporary : " << tempInstallDirectory << std::endl);

View File

@@ -96,7 +96,7 @@ public:
void SetLogger(cmCPackLog* log) { this->Logger = log; }
//! Display verbose information via logger
void DisplayVerboseOutput(const char* msg, float progress);
void DisplayVerboseOutput(const std::string& msg, float progress);
bool ReadListFile(const char* moduleName);
@@ -169,7 +169,8 @@ protected:
virtual const char* GetPackagingInstallPrefix();
virtual std::string FindTemplate(const char* name);
virtual bool ConfigureFile(const char* inName, const char* outName,
virtual bool ConfigureFile(const std::string& inName,
const std::string& outName,
bool copyOnly = false);
virtual bool ConfigureString(const std::string& input, std::string& output);
virtual int InitializeInternal();

View File

@@ -22,6 +22,9 @@ public:
cmCPackGeneratorFactory();
~cmCPackGeneratorFactory();
cmCPackGeneratorFactory(const cmCPackGeneratorFactory&) = delete;
cmCPackGeneratorFactory& operator=(const cmCPackGeneratorFactory&) = delete;
//! Get the generator
cmCPackGenerator* NewGenerator(const std::string& name);
void DeleteGenerator(cmCPackGenerator* gen);

View File

@@ -26,6 +26,9 @@ public:
cmCPackLog();
~cmCPackLog();
cmCPackLog(const cmCPackLog&) = delete;
cmCPackLog& operator=(const cmCPackLog&) = delete;
enum __log_tags
{
NOTAG = 0,

View File

@@ -292,9 +292,8 @@ int cmCPackNSISGenerator::PackageFiles()
this->SetOption("CPACK_NSIS_DEFINES", defines.c_str());
}
this->ConfigureFile(nsisInInstallOptions.c_str(),
nsisInstallOptions.c_str());
this->ConfigureFile(nsisInFileName.c_str(), nsisFileName.c_str());
this->ConfigureFile(nsisInInstallOptions, nsisInstallOptions);
this->ConfigureFile(nsisInFileName, nsisFileName);
std::string nsisCmd = "\"";
nsisCmd += this->GetOption("CPACK_INSTALLER_PROGRAM");
nsisCmd += "\" \"" + nsisFileName + "\"";
@@ -302,8 +301,8 @@ int cmCPackNSISGenerator::PackageFiles()
std::string output;
int retVal = 1;
bool res = cmSystemTools::RunSingleCommand(
nsisCmd.c_str(), &output, &output, &retVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
nsisCmd, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero());
if (!res || retVal) {
cmGeneratedFileStream ofs(tmpFile);
ofs << "# Run command: " << nsisCmd << std::endl
@@ -407,8 +406,8 @@ int cmCPackNSISGenerator::InitializeInternal()
std::string output;
int retVal = 1;
bool resS = cmSystemTools::RunSingleCommand(
nsisCmd.c_str(), &output, &output, &retVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
nsisCmd, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero());
cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)");
cmsys::RegularExpression versionRexCVS("v(.*)\\.cvs");
if (!resS || retVal ||
@@ -749,7 +748,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
std::string output;
int retVal = -1;
int res = cmSystemTools::RunSingleCommand(
cmd.c_str(), &output, &output, &retVal, dirName.c_str(),
cmd, &output, &output, &retVal, dirName.c_str(),
cmSystemTools::OUTPUT_NONE, cmDuration::zero());
if (!res || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");

View File

@@ -83,7 +83,7 @@ int cmCPackOSXX11Generator::PackageFiles()
return 0;
}
std::string destFileName = resourcesDirectory + "/" + iconFileName;
this->ConfigureFile(iconFile, destFileName.c_str(), true);
this->ConfigureFile(iconFile, destFileName, true);
this->SetOptionIfNotSet("CPACK_APPLE_GUI_ICON", iconFileName.c_str());
}
@@ -155,8 +155,8 @@ int cmCPackOSXX11Generator::PackageFiles()
bool res = false;
while (numTries > 0) {
res = cmSystemTools::RunSingleCommand(
dmgCmd.str().c_str(), &output, &output, &retVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
dmgCmd.str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero());
if (res && !retVal) {
numTries = -1;
break;
@@ -236,7 +236,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name)
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
<< (inFileName ? inFileName : "(NULL)")
<< " to " << destFileName << std::endl);
this->ConfigureFile(inFileName, destFileName.c_str());
this->ConfigureFile(inFileName, destFileName);
return true;
}
*/
@@ -266,7 +266,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Configure file: " << inFileName << " to " << destFileName
<< std::endl);
this->ConfigureFile(inFileName.c_str(), destFileName.c_str(), copyOnly);
this->ConfigureFile(inFileName, destFileName, copyOnly);
return true;
}

View File

@@ -66,21 +66,17 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile)
xout.StartElement("choices-outline");
// Emit the outline for the groups
std::map<std::string, cmCPackComponentGroup>::iterator groupIt;
for (groupIt = this->ComponentGroups.begin();
groupIt != this->ComponentGroups.end(); ++groupIt) {
if (groupIt->second.ParentGroup == nullptr) {
CreateChoiceOutline(groupIt->second, xout);
for (auto const& group : this->ComponentGroups) {
if (group.second.ParentGroup == nullptr) {
CreateChoiceOutline(group.second, xout);
}
}
// Emit the outline for the non-grouped components
std::map<std::string, cmCPackComponent>::iterator compIt;
for (compIt = this->Components.begin(); compIt != this->Components.end();
++compIt) {
if (!compIt->second.Group) {
for (auto const& comp : this->Components) {
if (!comp.second.Group) {
xout.StartElement("line");
xout.Attribute("choice", compIt->first + "Choice");
xout.Attribute("choice", comp.first + "Choice");
xout.Content(""); // Avoid self-closing tag.
xout.EndElement();
}
@@ -94,13 +90,11 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile)
xout.EndElement(); // choices-outline>
// Create the actual choices
for (groupIt = this->ComponentGroups.begin();
groupIt != this->ComponentGroups.end(); ++groupIt) {
CreateChoice(groupIt->second, xout);
for (auto const& group : this->ComponentGroups) {
CreateChoice(group.second, xout);
}
for (compIt = this->Components.begin(); compIt != this->Components.end();
++compIt) {
CreateChoice(compIt->second, xout);
for (auto const& comp : this->Components) {
CreateChoice(comp.second, xout);
}
if (!this->PostFlightComponent.Name.empty()) {
@@ -111,7 +105,7 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile)
// Create the distribution.dist file in the metapackage to turn it
// into a distribution package.
this->ConfigureFile(distributionTemplate.c_str(), distributionFile.c_str());
this->ConfigureFile(distributionTemplate, distributionFile);
}
void cmCPackPKGGenerator::CreateChoiceOutline(
@@ -119,17 +113,13 @@ void cmCPackPKGGenerator::CreateChoiceOutline(
{
xout.StartElement("line");
xout.Attribute("choice", group.Name + "Choice");
std::vector<cmCPackComponentGroup*>::const_iterator groupIt;
for (groupIt = group.Subgroups.begin(); groupIt != group.Subgroups.end();
++groupIt) {
CreateChoiceOutline(**groupIt, xout);
for (cmCPackComponentGroup* subgroup : group.Subgroups) {
CreateChoiceOutline(*subgroup, xout);
}
std::vector<cmCPackComponent*>::const_iterator compIt;
for (compIt = group.Components.begin(); compIt != group.Components.end();
++compIt) {
for (cmCPackComponent* comp : group.Components) {
xout.StartElement("line");
xout.Attribute("choice", (*compIt)->Name + "Choice");
xout.Attribute("choice", comp->Name + "Choice");
xout.Content(""); // Avoid self-closing tag.
xout.EndElement();
}
@@ -238,11 +228,9 @@ void cmCPackPKGGenerator::AddDependencyAttributes(
}
visited.insert(&component);
std::vector<cmCPackComponent*>::const_iterator dependIt;
for (dependIt = component.Dependencies.begin();
dependIt != component.Dependencies.end(); ++dependIt) {
out << " && choices['" << (*dependIt)->Name << "Choice'].selected";
AddDependencyAttributes(**dependIt, visited, out);
for (cmCPackComponent* depend : component.Dependencies) {
out << " && choices['" << depend->Name << "Choice'].selected";
AddDependencyAttributes(*depend, visited, out);
}
}
@@ -255,11 +243,9 @@ void cmCPackPKGGenerator::AddReverseDependencyAttributes(
}
visited.insert(&component);
std::vector<cmCPackComponent*>::const_iterator dependIt;
for (dependIt = component.ReverseDependencies.begin();
dependIt != component.ReverseDependencies.end(); ++dependIt) {
out << " || choices['" << (*dependIt)->Name << "Choice'].selected";
AddReverseDependencyAttributes(**dependIt, visited, out);
for (cmCPackComponent* depend : component.ReverseDependencies) {
out << " || choices['" << depend->Name << "Choice'].selected";
AddReverseDependencyAttributes(*depend, visited, out);
}
}
@@ -308,7 +294,7 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name,
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Configure file: " << (inFileName ? inFileName : "(NULL)")
<< " to " << destFileName << std::endl);
this->ConfigureFile(inFileName, destFileName.c_str());
this->ConfigureFile(inFileName, destFileName);
return true;
}
@@ -336,7 +322,7 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name,
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Configure file: " << inFileName << " to " << destFileName
<< std::endl);
this->ConfigureFile(inFileName.c_str(), destFileName.c_str());
this->ConfigureFile(inFileName, destFileName);
return true;
}

View File

@@ -295,8 +295,8 @@ int cmCPackPackageMakerGenerator::PackageFiles()
bool res = false;
while (numTries > 0) {
res = cmSystemTools::RunSingleCommand(
dmgCmd.str().c_str(), &output, &output, &retVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
dmgCmd.str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero());
if (res && !retVal) {
numTries = -1;
break;

View File

@@ -145,8 +145,8 @@ bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command)
std::string output;
int retVal = 1;
bool res = cmSystemTools::RunSingleCommand(
command.c_str(), &output, &output, &retVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
command, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero());
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running command" << std::endl);
if (!res || retVal) {
cmGeneratedFileStream ofs(tmpFile);

View File

@@ -90,7 +90,7 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
return 1;
}
static void cpackProgressCallback(const char* message, float /*unused*/)
static void cpackProgressCallback(const std::string& message, float /*unused*/)
{
std::cout << "-- " << message << std::endl;
}

View File

@@ -365,7 +365,7 @@ bool cmCTestBZR::UpdateImpl()
if (opts.empty()) {
opts = this->CTest->GetCTestConfiguration("BZRUpdateOptions");
}
std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
// TODO: if(this->CTest->GetTestModel() == cmCTest::NIGHTLY)

View File

@@ -118,7 +118,7 @@ public:
: CM(cm)
{
cmSystemTools::SetMessageCallback(
[&s](const char* msg, const char* /*unused*/) {
[&s](const std::string& msg, const char* /*unused*/) {
s += msg;
s += "\n";
});
@@ -126,10 +126,11 @@ public:
cmSystemTools::SetStdoutCallback([&s](std::string const& m) { s += m; });
cmSystemTools::SetStderrCallback([&s](std::string const& m) { s += m; });
this->CM.SetProgressCallback([&s](const char* msg, float /*unused*/) {
s += msg;
s += "\n";
});
this->CM.SetProgressCallback(
[&s](const std::string& msg, float /*unused*/) {
s += msg;
s += "\n";
});
}
~cmCTestBuildAndTestCaptureRAII()
@@ -139,6 +140,11 @@ public:
cmSystemTools::SetStdoutCallback(nullptr);
cmSystemTools::SetMessageCallback(nullptr);
}
cmCTestBuildAndTestCaptureRAII(const cmCTestBuildAndTestCaptureRAII&) =
delete;
cmCTestBuildAndTestCaptureRAII& operator=(
const cmCTestBuildAndTestCaptureRAII&) = delete;
};
int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)

View File

@@ -418,8 +418,8 @@ int cmCTestBuildHandler::ProcessHandler()
int retVal = 0;
int res = cmsysProcess_State_Exited;
if (!this->CTest->GetShowOnly()) {
res = this->RunMakeCommand(makeCommand.c_str(), &retVal,
buildDirectory.c_str(), 0, ofs);
res = this->RunMakeCommand(makeCommand, &retVal, buildDirectory.c_str(), 0,
ofs);
} else {
cmCTestOptionalLog(this->CTest, DEBUG,
"Build with command: " << makeCommand << std::endl,
@@ -680,6 +680,8 @@ class cmCTestBuildHandler::LaunchHelper
public:
LaunchHelper(cmCTestBuildHandler* handler);
~LaunchHelper();
LaunchHelper(const LaunchHelper&) = delete;
LaunchHelper& operator=(const LaunchHelper&) = delete;
private:
cmCTestBuildHandler* Handler;
@@ -764,9 +766,10 @@ void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers(
}
}
int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
const char* dir, int timeout,
std::ostream& ofs, Encoding encoding)
int cmCTestBuildHandler::RunMakeCommand(const std::string& command,
int* retVal, const char* dir,
int timeout, std::ostream& ofs,
Encoding encoding)
{
// First generate the command and arguments
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
@@ -800,7 +803,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
// Now create process object
cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetCommand(cp, &*argv.begin());
cmsysProcess_SetCommand(cp, argv.data());
cmsysProcess_SetWorkingDirectory(cp, dir);
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
cmsysProcess_SetTimeout(cp, timeout);
@@ -978,7 +981,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
this->CurrentProcessingLine.insert(this->CurrentProcessingLine.end(),
queue->begin(), it);
this->CurrentProcessingLine.push_back(0);
const char* line = &*this->CurrentProcessingLine.begin();
const char* line = this->CurrentProcessingLine.data();
// Process the line
int lineType = this->ProcessSingleLine(line);

View File

@@ -52,7 +52,7 @@ private:
//! Run command specialized for make and configure. Returns process status
// and retVal is return value or exception.
int RunMakeCommand(const char* command, int* retVal, const char* dir,
int RunMakeCommand(const std::string& command, int* retVal, const char* dir,
int timeout, std::ostream& ofs,
Encoding encoding = cmProcessOutput::Auto);

View File

@@ -78,7 +78,7 @@ bool cmCTestCVS::UpdateImpl()
opts = "-dP";
}
}
std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
// Specify the start time for nightly testing.
if (this->CTest->GetTestModel() == cmCTest::NIGHTLY) {

View File

@@ -61,7 +61,7 @@ int cmCTestConfigureHandler::ProcessHandler()
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Configure with command: " << cCommand << std::endl,
this->Quiet);
res = this->CTest->RunMakeCommand(cCommand.c_str(), output, &retVal,
res = this->CTest->RunMakeCommand(cCommand, output, &retVal,
buildDirectory.c_str(),
cmDuration::zero(), ofs);

View File

@@ -52,6 +52,8 @@ public:
}
cmsysProcess_Delete(this->Process);
}
cmCTestRunProcess(const cmCTestRunProcess&) = delete;
cmCTestRunProcess& operator=(const cmCTestRunProcess&) = delete;
void SetCommand(const char* command)
{
this->CommandLineStrings.clear();
@@ -72,7 +74,7 @@ public:
args.push_back(cl.c_str());
}
args.push_back(nullptr); // null terminate
cmsysProcess_SetCommand(this->Process, &*args.begin());
cmsysProcess_SetCommand(this->Process, args.data());
if (!this->WorkingDirectory.empty()) {
cmsysProcess_SetWorkingDirectory(this->Process,
this->WorkingDirectory.c_str());
@@ -223,7 +225,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(std::string const& file,
checkDir = fBinDir;
}
std::string ndc = cmSystemTools::FileExistsInParentDirectories(
".NoDartCoverage", fFile.c_str(), checkDir.c_str());
".NoDartCoverage", fFile, checkDir);
if (!ndc.empty()) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found: " << ndc << " so skip coverage of " << file
@@ -254,8 +256,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(std::string const& file,
return true;
}
ndc = cmSystemTools::FileExistsInParentDirectories(
".NoDartCoverage", fFile.c_str(), checkDir.c_str());
ndc = cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage", fFile,
checkDir);
if (!ndc.empty()) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Found: " << ndc << " so skip coverage of: " << file
@@ -786,6 +788,9 @@ struct cmCTestCoverageHandlerLocale
cmSystemTools::UnsetEnv("LC_ALL");
}
}
cmCTestCoverageHandlerLocale(const cmCTestCoverageHandlerLocale&) = delete;
cmCTestCoverageHandlerLocale& operator=(
const cmCTestCoverageHandlerLocale&) = delete;
std::string lc_all;
};
@@ -999,7 +1004,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
static_cast<void>(locale_C);
std::vector<std::string> basecovargs =
cmSystemTools::ParseArguments(gcovExtraFlags.c_str());
cmSystemTools::ParseArguments(gcovExtraFlags);
basecovargs.insert(basecovargs.begin(), gcovCommand);
basecovargs.emplace_back("-o");
@@ -1058,8 +1063,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
this->Quiet);
std::vector<std::string> lines;
cmSystemTools::Split(output.c_str(), lines);
cmsys::SystemTools::Split(output, lines);
for (std::string const& line : lines) {
std::string sourceFile;
@@ -1373,7 +1377,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
static_cast<void>(locale_C);
std::vector<std::string> covargs =
cmSystemTools::ParseArguments(lcovExtraFlags.c_str());
cmSystemTools::ParseArguments(lcovExtraFlags);
covargs.insert(covargs.begin(), lcovCommand);
const std::string command = joinCommandLine(covargs);
@@ -1435,8 +1439,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
this->Quiet);
std::vector<std::string> lines;
cmSystemTools::Split(output.c_str(), lines);
cmsys::SystemTools::Split(output, lines);
for (std::string const& line : lines) {
std::string sourceFile;

View File

@@ -16,6 +16,8 @@ class cmCTestCurl
public:
cmCTestCurl(cmCTest*);
~cmCTestCurl();
cmCTestCurl(const cmCTestCurl&) = delete;
cmCTestCurl& operator=(const cmCTestCurl&) = delete;
bool UploadFile(std::string const& local_file, std::string const& url,
std::string const& fields, std::string& response);
bool HttpRequest(std::string const& url, std::string const& fields,

View File

@@ -162,7 +162,7 @@ bool cmCTestGIT::UpdateByFetchAndReset()
if (opts.empty()) {
opts = this->CTest->GetCTestConfiguration("GITUpdateOptions");
}
std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
for (std::string const& arg : args) {
git_fetch.push_back(arg.c_str());
}

View File

@@ -144,7 +144,7 @@ bool cmCTestHG::UpdateImpl()
if (opts.empty()) {
opts = this->CTest->GetCTestConfiguration("HGUpdateOptions");
}
std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
for (std::string const& arg : args) {
hg_update.push_back(arg.c_str());
}

View File

@@ -76,6 +76,8 @@ public:
}
}
}
SaveRestoreErrorState(const SaveRestoreErrorState&) = delete;
SaveRestoreErrorState& operator=(const SaveRestoreErrorState&) = delete;
private:
bool InitialErrorState;

View File

@@ -28,6 +28,9 @@ private:
cmCTestLaunch(int argc, const char* const* argv);
~cmCTestLaunch();
cmCTestLaunch(const cmCTestLaunch&) = delete;
cmCTestLaunch& operator=(const cmCTestLaunch&) = delete;
// Run the real command.
int Run();
void RunChild();

View File

@@ -520,7 +520,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->CTest->GetCTestConfiguration("ValgrindCommandOptions");
}
this->MemoryTesterOptions =
cmSystemTools::ParseArguments(memoryTesterOptions.c_str());
cmSystemTools::ParseArguments(memoryTesterOptions);
this->MemoryTesterOutputFile =
this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.??.log";
@@ -725,7 +725,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
cmsys::RegularExpression leakWarning("(Direct|Indirect) leak of .*");
int defects = 0;
std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
cmsys::SystemTools::Split(str, lines);
std::ostringstream ostr;
log.clear();
for (std::string const& l : lines) {
@@ -755,7 +755,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
const std::string& str, std::string& log, std::vector<int>& results)
{
std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
cmsys::SystemTools::Split(str, lines);
std::ostringstream ostr;
log.clear();
@@ -798,7 +798,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
const std::string& str, std::string& log, std::vector<int>& results)
{
std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
cmsys::SystemTools::Split(str, lines);
bool unlimitedOutput = false;
if (str.find("CTEST_FULL_OUTPUT") != std::string::npos ||
this->CustomMaximumFailedTestOutputSize == 0) {
@@ -937,7 +937,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
log.clear();
auto sttime = std::chrono::steady_clock::now();
std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
cmsys::SystemTools::Split(str, lines);
cmCTestOptionalLog(this->CTest, DEBUG,
"Start test: " << lines.size() << std::endl, this->Quiet);
std::vector<std::string>::size_type cc;

View File

@@ -8,6 +8,7 @@
#include "cmCTestTestHandler.h"
#include "cmDuration.h"
#include "cmListFileCache.h"
#include "cmRange.h"
#include "cmSystemTools.h"
#include "cmWorkingDirectory.h"
@@ -108,8 +109,8 @@ void cmCTestMultiProcessHandler::SetTestLoad(unsigned long load)
fake_load_value)) {
if (!cmSystemTools::StringToULong(fake_load_value.c_str(),
&this->FakeLoadForTesting)) {
cmSystemTools::Error("Failed to parse fake load value: ",
fake_load_value.c_str());
cmSystemTools::Error("Failed to parse fake load value: " +
fake_load_value);
}
}
}
@@ -651,9 +652,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
// Reverse iterate over the different dependency levels (deepest first).
// Sort tests within each level by COST and append them to the cost list.
for (std::list<TestSet>::reverse_iterator i = priorityStack.rbegin();
i != priorityStack.rend(); ++i) {
TestSet const& currentSet = *i;
for (TestSet const& currentSet : cmReverseRange(priorityStack)) {
TestComparator comp(this);
TestList sortedCopy;

View File

@@ -5,6 +5,7 @@
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmProcessTools.h"
#include "cmRange.h"
#include "cmSystemTools.h"
#include "cmsys/RegularExpression.hxx"
@@ -323,8 +324,7 @@ void cmCTestP4::SetP4Options(std::vector<char const*>& CommandOptions)
// The CTEST_P4_OPTIONS variable adds additional Perforce command line
// options before the main command
std::string opts = this->CTest->GetCTestConfiguration("P4Options");
std::vector<std::string> args =
cmSystemTools::ParseArguments(opts.c_str());
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
P4Options.insert(P4Options.end(), args.begin(), args.end());
}
@@ -425,12 +425,11 @@ bool cmCTestP4::LoadRevisions()
// p4 describe -s ...@1111111,2222222
std::vector<char const*> p4_describe;
for (std::vector<std::string>::reverse_iterator i = ChangeLists.rbegin();
i != ChangeLists.rend(); ++i) {
for (std::string const& i : cmReverseRange(ChangeLists)) {
SetP4Options(p4_describe);
p4_describe.push_back("describe");
p4_describe.push_back("-s");
p4_describe.push_back(i->c_str());
p4_describe.push_back(i.c_str());
p4_describe.push_back(nullptr);
DescribeParser outDescribe(this, "p4_describe-out> ");
@@ -501,7 +500,7 @@ bool cmCTestP4::UpdateImpl()
if (opts.empty()) {
opts = this->CTest->GetCTestConfiguration("P4UpdateOptions");
}
std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
for (std::string const& arg : args) {
p4_sync.push_back(arg.c_str());
}

View File

@@ -9,11 +9,10 @@
#include "cmSystemTools.h"
#include "cmWorkingDirectory.h"
#include "cm_zlib.h"
#include "cmsys/Base64.h"
#include "cmsys/RegularExpression.hxx"
#include <chrono>
#include <cmAlgorithms.h>
#include <cstdint>
#include <cstring>
#include <iomanip>
#include <ratio>
@@ -31,9 +30,6 @@ cmCTestRunTest::cmCTestRunTest(cmCTestMultiProcessHandler& multiHandler)
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
this->TestResult.TestCount = 0;
this->TestResult.Properties = nullptr;
this->ProcessOutput.clear();
this->CompressedOutput.clear();
this->CompressionRatio = 2;
this->NumberOfRunsLeft = 1; // default to 1 run of the test
this->RunUntilFail = false; // default to run the test once
this->RunAgain = false; // default to not having to run again
@@ -68,73 +64,8 @@ void cmCTestRunTest::CheckOutput(std::string const& line)
}
}
// Streamed compression of test output. The compressed data
// is appended to this->CompressedOutput
void cmCTestRunTest::CompressOutput()
{
int ret;
z_stream strm;
unsigned char* in = reinterpret_cast<unsigned char*>(
const_cast<char*>(this->ProcessOutput.c_str()));
// zlib makes the guarantee that this is the maximum output size
int outSize = static_cast<int>(
static_cast<double>(this->ProcessOutput.size()) * 1.001 + 13.0);
unsigned char* out = new unsigned char[outSize];
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
ret = deflateInit(&strm, -1); // default compression level
if (ret != Z_OK) {
delete[] out;
return;
}
strm.avail_in = static_cast<uInt>(this->ProcessOutput.size());
strm.next_in = in;
strm.avail_out = outSize;
strm.next_out = out;
ret = deflate(&strm, Z_FINISH);
if (ret != Z_STREAM_END) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Error during output compression. Sending uncompressed output."
<< std::endl);
delete[] out;
return;
}
(void)deflateEnd(&strm);
unsigned char* encoded_buffer =
new unsigned char[static_cast<int>(outSize * 1.5)];
size_t rlen = cmsysBase64_Encode(out, strm.total_out, encoded_buffer, 1);
this->CompressedOutput.clear();
for (size_t i = 0; i < rlen; i++) {
this->CompressedOutput += encoded_buffer[i];
}
if (strm.total_in) {
this->CompressionRatio =
static_cast<double>(strm.total_out) / static_cast<double>(strm.total_in);
}
delete[] encoded_buffer;
delete[] out;
}
bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
{
if ((!this->TestHandler->MemCheck &&
this->CTest->ShouldCompressTestOutput()) ||
(this->TestHandler->MemCheck &&
this->CTest->ShouldCompressTestOutput())) {
this->CompressOutput();
}
this->WriteLogOutputTop(completed, total);
std::string reason;
bool passed = true;
@@ -143,7 +74,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
if (res != cmProcess::State::Expired) {
this->TimeoutIsForStopTime = false;
}
int retVal = this->TestProcess->GetExitValue();
std::int64_t retVal = this->TestProcess->GetExitValue();
bool forceFail = false;
bool skipped = false;
bool outputTestErrorsToConsole = false;
@@ -335,10 +266,18 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
// if the test actually started and ran
// record the results in TestResult
if (started) {
bool compress = !this->TestHandler->MemCheck &&
this->CompressionRatio < 1 && this->CTest->ShouldCompressTestOutput();
std::string compressedOutput;
if (!this->TestHandler->MemCheck &&
this->CTest->ShouldCompressTestOutput()) {
std::string str = this->ProcessOutput;
if (this->CTest->CompressString(str)) {
compressedOutput = std::move(str);
}
}
bool compress = !compressedOutput.empty() &&
compressedOutput.length() < this->ProcessOutput.length();
this->TestResult.Output =
compress ? this->CompressedOutput : this->ProcessOutput;
compress ? compressedOutput : this->ProcessOutput;
this->TestResult.CompressOutput = compress;
this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
if (!skipped) {

View File

@@ -58,9 +58,6 @@ public:
// Read and store output. Returns true if it must be called again.
void CheckOutput(std::string const& line);
// Compresses the output, writing to CompressedOutput
void CompressOutput();
// launch the test process, return whether it started correctly
bool StartTest(size_t completed, size_t total);
// capture and report the test results
@@ -105,8 +102,6 @@ private:
cmCTest* CTest;
std::unique_ptr<cmProcess> TestProcess;
std::string ProcessOutput;
std::string CompressedOutput;
double CompressionRatio;
// The test results
cmCTestTestHandler::cmCTestTestResult TestResult;
cmCTestMultiProcessHandler& MultiTestHandler;

View File

@@ -242,7 +242,7 @@ bool cmCTestSVN::UpdateImpl()
if (opts.empty()) {
opts = this->CTest->GetCTestConfiguration("SVNUpdateOptions");
}
std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str());
std::vector<std::string> args = cmSystemTools::ParseArguments(opts);
// Specify the start time for nightly testing.
if (this->CTest->GetTestModel() == cmCTest::NIGHTLY) {
@@ -277,7 +277,7 @@ bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters,
std::string userOptions = this->CTest->GetCTestConfiguration("SVNOptions");
std::vector<std::string> parsedUserOptions =
cmSystemTools::ParseArguments(userOptions.c_str());
cmSystemTools::ParseArguments(userOptions);
for (std::string const& opt : parsedUserOptions) {
args.push_back(opt.c_str());
}

View File

@@ -199,7 +199,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
// Now create process object
cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetCommand(cp, &*argv.begin());
cmsysProcess_SetCommand(cp, argv.data());
// cmsysProcess_SetWorkingDirectory(cp, dir);
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
// cmsysProcess_SetTimeout(cp, timeout);
@@ -288,11 +288,12 @@ void cmCTestScriptHandler::CreateCMake()
this->ParentMakefile->GetRecursionDepth());
}
this->CMake->SetProgressCallback([this](const char* m, float /*unused*/) {
if (m && *m) {
cmCTestLog(this->CTest, HANDLER_OUTPUT, "-- " << m << std::endl);
}
});
this->CMake->SetProgressCallback(
[this](const std::string& m, float /*unused*/) {
if (!m.empty()) {
cmCTestLog(this->CTest, HANDLER_OUTPUT, "-- " << m << std::endl);
}
});
this->AddCTestCommand("ctest_build", new cmCTestBuildCommand);
this->AddCTestCommand("ctest_configure", new cmCTestConfigureCommand);
@@ -330,7 +331,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
}
// make sure the file exists
if (!cmSystemTools::FileExists(script)) {
cmSystemTools::Error("Cannot find file: ", script.c_str());
cmSystemTools::Error("Cannot find file: " + script);
return 1;
}
@@ -470,8 +471,8 @@ int cmCTestScriptHandler::ExtractVariables()
msg += "\nCTEST_COMMAND = ";
msg += (!this->CTestCmd.empty()) ? this->CTestCmd.c_str() : "(Null)";
cmSystemTools::Error(
"Some required settings in the configuration file were missing:\n",
msg.c_str());
"Some required settings in the configuration file were missing:\n" +
msg);
return 4;
}
@@ -607,12 +608,10 @@ int cmCTestScriptHandler::CheckOutSourceDir()
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Run cvs: " << this->CVSCheckOut << std::endl);
res = cmSystemTools::RunSingleCommand(
this->CVSCheckOut.c_str(), &output, &output, &retVal,
this->CTestRoot.c_str(), this->HandlerVerbose,
cmDuration::zero() /*this->TimeOut*/);
this->CVSCheckOut, &output, &output, &retVal, this->CTestRoot.c_str(),
this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
if (!res || retVal != 0) {
cmSystemTools::Error("Unable to perform cvs checkout:\n",
output.c_str());
cmSystemTools::Error("Unable to perform cvs checkout:\n" + output);
return 6;
}
}
@@ -675,11 +674,11 @@ int cmCTestScriptHandler::PerformExtraUpdates()
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Run Update: " << fullCommand << std::endl);
res = cmSystemTools::RunSingleCommand(
fullCommand.c_str(), &output, &output, &retVal, cvsArgs[0].c_str(),
fullCommand, &output, &output, &retVal, cvsArgs[0].c_str(),
this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
if (!res || retVal != 0) {
cmSystemTools::Error("Unable to perform extra updates:\n", eu.c_str(),
"\nWith output:\n", output.c_str());
cmSystemTools::Error("Unable to perform extra updates:\n" + eu +
"\nWith output:\n" + output);
return 0;
}
}
@@ -721,8 +720,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
if (!cmSystemTools::FileExists(this->BinaryDir) &&
this->SourceDir != this->BinaryDir) {
if (!cmSystemTools::MakeDirectory(this->BinaryDir)) {
cmSystemTools::Error("Unable to create the binary directory:\n",
this->BinaryDir.c_str());
cmSystemTools::Error("Unable to create the binary directory:\n" +
this->BinaryDir);
this->RestoreBackupDirectories();
return 7;
}
@@ -779,7 +778,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Run cmake command: " << command << std::endl);
res = cmSystemTools::RunSingleCommand(
command.c_str(), &output, &output, &retVal, this->BinaryDir.c_str(),
command, &output, &output, &retVal, this->BinaryDir.c_str(),
this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
if (!this->CMOutFile.empty()) {
@@ -818,7 +817,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Run ctest command: " << command << std::endl);
res = cmSystemTools::RunSingleCommand(
command.c_str(), &output, &output, &retVal, this->BinaryDir.c_str(),
command, &output, &output, &retVal, this->BinaryDir.c_str(),
this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
// did something critical fail in ctest

View File

@@ -343,7 +343,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
if (!chunk.empty()) {
cmCTestOptionalLog(this->CTest, DEBUG,
"CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size())
<< cmCTestLogWrite(chunk.data(), chunk.size())
<< "]" << std::endl,
this->Quiet);
this->ParseResponse(chunk);
@@ -352,7 +352,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
cmCTestOptionalLog(
this->CTest, DEBUG,
"CURL debug output: ["
<< cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]"
<< cmCTestLogWrite(chunkDebug.data(), chunkDebug.size()) << "]"
<< std::endl,
this->Quiet);
}
@@ -404,12 +404,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
res = ::curl_easy_perform(curl);
if (!chunk.empty()) {
cmCTestOptionalLog(
this->CTest, DEBUG,
"CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< std::endl,
this->Quiet);
cmCTestOptionalLog(this->CTest, DEBUG,
"CURL output: ["
<< cmCTestLogWrite(chunk.data(), chunk.size())
<< "]" << std::endl,
this->Quiet);
this->ParseResponse(chunk);
}
@@ -433,11 +432,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
// avoid deref of begin for zero size array
if (!chunk.empty()) {
*this->LogFile << " Curl output was: "
<< cmCTestLogWrite(&*chunk.begin(), chunk.size())
<< cmCTestLogWrite(chunk.data(), chunk.size())
<< std::endl;
cmCTestLog(this->CTest, ERROR_MESSAGE,
"CURL output: ["
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]"
<< cmCTestLogWrite(chunk.data(), chunk.size()) << "]"
<< std::endl);
}
::curl_easy_cleanup(curl);
@@ -486,7 +485,7 @@ void cmCTestSubmitHandler::ParseResponse(
if (this->HasWarnings || this->HasErrors) {
cmCTestLog(this->CTest, HANDLER_OUTPUT,
" Server Response:\n"
<< cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "\n");
<< cmCTestLogWrite(chunk.data(), chunk.size()) << "\n");
}
}

View File

@@ -1486,7 +1486,7 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<std::string>& vec)
int retVal = 0;
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Run command: " << it << std::endl, this->Quiet);
if (!cmSystemTools::RunSingleCommand(it.c_str(), nullptr, nullptr, &retVal,
if (!cmSystemTools::RunSingleCommand(it, nullptr, nullptr, &retVal,
nullptr, cmSystemTools::OUTPUT_MERGE
/*this->Verbose*/) ||
retVal != 0) {

View File

@@ -11,6 +11,7 @@
#include "cmsys/RegularExpression.hxx"
#include <chrono>
#include <cstdint>
#include <iosfwd>
#include <map>
#include <set>
@@ -153,7 +154,7 @@ public:
std::string Reason;
std::string FullCommandLine;
cmDuration ExecutionTime;
int ReturnValue;
std::int64_t ReturnValue;
int Status;
std::string ExceptionStatus;
bool CompressOutput;

View File

@@ -11,7 +11,9 @@
#include <iostream>
#include <signal.h>
#include <string>
#if !defined(_WIN32)
#if defined(_WIN32)
# include "cm_kwiml.h"
#else
# include <unistd.h>
#endif
#include <utility>
@@ -199,7 +201,7 @@ bool cmProcess::Buffer::GetLine(std::string& line)
for (size_type sz = this->size(); this->Last != sz; ++this->Last) {
if ((*this)[this->Last] == '\n' || (*this)[this->Last] == '\0') {
// Extract the range first..last as a line.
const char* text = &*this->begin() + this->First;
const char* text = this->data() + this->First;
size_type length = this->Last - this->First;
while (length && text[length - 1] == '\r') {
length--;
@@ -229,7 +231,7 @@ bool cmProcess::Buffer::GetLast(std::string& line)
{
// Return the partial last line, if any.
if (!this->empty()) {
line.assign(&*this->begin(), this->size());
line.assign(this->data(), this->size());
this->First = this->Last = 0;
this->clear();
return true;
@@ -353,7 +355,7 @@ void cmProcess::OnExit(int64_t exit_status, int term_signal)
}
// Record exit information.
this->ExitValue = static_cast<int>(exit_status);
this->ExitValue = exit_status;
this->Signal = term_signal;
this->TotalTime = std::chrono::steady_clock::now() - this->StartTime;
// Because of a processor clock scew the runtime may become slightly
@@ -539,7 +541,8 @@ std::string cmProcess::GetExitExceptionString()
case STATUS_NO_MEMORY:
default:
char buf[1024];
_snprintf(buf, 1024, "Exit code 0x%x\n", this->ExitValue);
const char* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n";
_snprintf(buf, 1024, fmt, this->ExitValue);
exception_str.assign(buf);
}
#else

View File

@@ -53,7 +53,7 @@ public:
State GetProcessStatus();
int GetId() { return this->Id; }
void SetId(int id) { this->Id = id; }
int GetExitValue() { return this->ExitValue; }
int64_t GetExitValue() { return this->ExitValue; }
cmDuration GetTotalTime() { return this->TotalTime; }
enum class Exception
@@ -122,7 +122,7 @@ private:
std::vector<std::string> Arguments;
std::vector<const char*> ProcessArgs;
int Id;
int ExitValue;
int64_t ExitValue;
};
#endif

View File

@@ -2,8 +2,21 @@
#include <memory>
#include <unordered_map>
#ifdef _MSC_VER
# include <comdef.h>
#endif
int main()
{
std::unique_ptr<int> u(new int(0));
#ifdef _MSC_VER
// clang-cl has problems instantiating this constructor in C++17 mode
// error: indirection requires pointer operand ('const _GUID' invalid)
// return *_IID;
IUnknownPtr ptr{};
IDispatchPtr disp(ptr);
#endif
return *u;
}

View File

@@ -150,7 +150,7 @@ int main(int argc, char const* const* argv)
}
cmSystemTools::SetMessageCallback(
[myform](const char* message, const char* title) {
[myform](const std::string& message, const char* title) {
myform->AddError(message, title);
});

View File

@@ -9,6 +9,8 @@
#include "cmsys/FStream.hxx"
#include <string>
class cmCursesForm
{
public:
@@ -34,7 +36,7 @@ public:
// Description:
// During a CMake run, an error handle should add errors
// to be displayed afterwards.
virtual void AddError(const char*, const char*) {}
virtual void AddError(const std::string&, const char*) {}
// Description:
// Turn debugging on. This will create ccmakelog.txt.

View File

@@ -19,9 +19,8 @@ cmCursesLongMessageForm::cmCursesLongMessageForm(
std::vector<std::string> const& messages, const char* title)
{
// Append all messages into on big string
std::vector<std::string>::const_iterator it;
for (it = messages.begin(); it != messages.end(); it++) {
this->Messages += (*it);
for (std::string const& message : messages) {
this->Messages += message;
// Add one blank line after each message
this->Messages += "\n\n";
}

Some files were not shown because too many files have changed in this diff Show More