Skip to content

Commit

Permalink
Merge pull request #88 from microsoft/dev/jgoshi/cmake3.16
Browse files Browse the repository at this point in the history
FI cmake 3.16
  • Loading branch information
jgoshi authored Nov 26, 2019
2 parents 62dad8b + 284e6c1 commit 4d9cd08
Show file tree
Hide file tree
Showing 2,546 changed files with 59,908 additions and 35,464 deletions.
24 changes: 24 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,28 @@ ColumnLimit: 79
IndentPPDirectives: AfterHash
SortUsingDeclarations: false
SpaceAfterTemplateKeyword: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"]cmConfigure\.h'
Priority: -1
- Regex: '^(<|")cm/'
Priority: 2
- Regex: '^(<|")windows\.h'
Priority: 3
- Regex: '^<sys/'
Priority: 5
- Regex: '^(<|")Qt?[A-Z]'
Priority: 6
- Regex: '^(<|")cmsys/'
Priority: 7
- Regex: '^(<|")cm_'
Priority: 8
- Regex: '^(<|")cm[A-Z][^.]+\.h'
Priority: 9
- Regex: '^<[^.]+\.h'
Priority: 4
- Regex: '^<'
Priority: 1
- Regex: '.*'
Priority: 10
...
18 changes: 9 additions & 9 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@ Checks: "-*,\
bugprone-*,\
-bugprone-macro-parentheses,\
-bugprone-misplaced-widening-cast,\
-bugprone-narrowing-conversions,\
-bugprone-too-small-loop-variable,\
google-readability-casting,\
misc-*,\
-misc-incorrect-roundings,\
-misc-macro-parentheses,\
-misc-misplaced-widening-cast,\
-misc-non-private-member-variables-in-classes,\
-misc-static-assert,\
modernize-*,\
-modernize-deprecated-headers,\
-modernize-return-braced-init-list,\
-modernize-use-auto,\
-modernize-avoid-c-arrays,\
-modernize-use-nodiscard,\
-modernize-use-noexcept,\
-modernize-use-transparent-functors,\
-modernize-use-using,\
performance-*,\
-performance-inefficient-string-concatenation,\
readability-*,\
-readability-function-size,\
-readability-identifier-naming,\
-readability-implicit-bool-cast,\
-readability-implicit-bool-conversion,\
-readability-inconsistent-declaration-parameter-name,\
-readability-magic-numbers,\
-readability-named-parameter,\
-readability-redundant-declaration,\
-readability-uppercase-literal-suffix,\
"
HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$'
CheckOptions:
- key: modernize-use-default-member-init.UseAssignment
value: '1'
- key: modernize-use-equals-default.IgnoreMacros
value: '0'
- key: modernize-use-auto.MinTypeNameLength
value: '80'
...
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.gitattributes export-ignore
.git* export-ignore
.hooks* export-ignore

# Custom attribute to mark sources as using our C code style.
Expand All @@ -11,6 +11,7 @@
bootstrap eol=lf
configure eol=lf
*.[1-9] eol=lf
*.bash eol=lf
*.sh eol=lf
*.sh.in eol=lf

Expand Down
4 changes: 2 additions & 2 deletions Auxiliary/bash-completion/cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ _cmake()
compopt -o nospace
else
# complete variable names
COMPREPLY=( $( compgen -W '$( cmake -LA -N | tail -n +2 |
cut -f1 -d: )' -P "$prefix" -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( cmake -LA -N 2>/dev/null |
tail -n +2 | cut -f1 -d: )' -P "$prefix" -- "$cur" ) )
compopt -o nospace
fi
return
Expand Down
10 changes: 3 additions & 7 deletions Auxiliary/cmake-mode.el
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
;;; cmake-mode.el --- major-mode for editing CMake sources

;; Package-Requires: ((emacs "24.1"))

; Distributed under the OSI-approved BSD 3-Clause License. See accompanying
; file Copyright.txt or https://cmake.org/licensing for details.

Expand Down Expand Up @@ -224,17 +226,11 @@ the indentation. Otherwise it retains the same position on the line"
;;
(defvar cmake-mode-hook nil)

;------------------------------------------------------------------------------

;; For compatibility with Emacs < 24
(defalias 'cmake--parent-mode
(if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))

;;------------------------------------------------------------------------------
;; Mode definition.
;;
;;;###autoload
(define-derived-mode cmake-mode cmake--parent-mode "CMake"
(define-derived-mode cmake-mode prog-mode "CMake"
"Major mode for editing CMake source files."

; Setup font-lock mode.
Expand Down
9 changes: 9 additions & 0 deletions Auxiliary/vim/syntax/cmake.vim
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ syn keyword cmakeProperty contained
\ SKIP_AUTORCC
\ SKIP_AUTOUIC
\ SKIP_BUILD_RPATH
\ SKIP_REGULAR_EXPRESSION
\ SKIP_RETURN_CODE
\ SOURCES
\ SOURCE_DIR
Expand Down Expand Up @@ -915,6 +916,7 @@ syn keyword cmakeVariable contained
\ CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES
\ CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT
\ CMAKE_ECLIPSE_MAKE_ARGUMENTS
\ CMAKE_ECLIPSE_RESOURCE_ENCODING
\ CMAKE_ECLIPSE_VERSION
\ CMAKE_EDIT_COMMAND
\ CMAKE_ENABLE_EXPORTS
Expand Down Expand Up @@ -948,6 +950,12 @@ syn keyword cmakeVariable contained
\ CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
\ CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
\ CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
\ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH
\ CMAKE_FIND_USE_CMAKE_PATH
\ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH
\ CMAKE_FIND_USE_PACKAGE_REGISTRY
\ CMAKE_FIND_USE_PACKAGE_ROOT_PATH
\ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH
\ CMAKE_FOLDER
\ CMAKE_FRAMEWORK
\ CMAKE_FRAMEWORK_PATH
Expand Down Expand Up @@ -1765,6 +1773,7 @@ syn keyword cmakeKWadd_test contained
\ NAME
\ OFF
\ PASS_REGULAR_EXPRESSION
\ SKIP_REGULAR_EXPRESSION
\ TARGET_FILE
\ WILL_FAIL
\ WORKING_DIRECTORY
Expand Down
2 changes: 1 addition & 1 deletion CMakeCPack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
endif()
endif()

set(CPACK_PACKAGE_CONTACT "cmake@cmake.org")
set(CPACK_PACKAGE_CONTACT "cmake+development@discourse.cmake.org")

if(UNIX)
set(CPACK_STRIP_FILES "${CMAKE_BIN_DIR}/ccmake;${CMAKE_BIN_DIR}/cmake;${CMAKE_BIN_DIR}/cpack;${CMAKE_BIN_DIR}/ctest")
Expand Down
44 changes: 34 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

cmake_minimum_required(VERSION 3.1...3.14 FATAL_ERROR)
cmake_minimum_required(VERSION 3.1...3.15 FATAL_ERROR)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideC.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideCXX.cmake)
project(CMake)
unset(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX)
unset(CMAKE_USER_MAKE_RULES_OVERRIDE_C)

# FIXME: This block should go away after a transition period.
if(MSVC AND NOT CMAKE_VERSION VERSION_LESS 3.15)
# Filter out MSVC runtime library flags that may have come from
# the cache of an existing build tree or from scripts.
foreach(l C CXX)
foreach(c DEBUG MINSIZEREL RELEASE RELWITHDEBINFO)
string(REGEX REPLACE "[-/]M[DT]d?( |$)" "" "CMAKE_${l}_FLAGS_${c}" "${CMAKE_${l}_FLAGS_${c}}")
endforeach()
endforeach()
endif()

# Make sure we can find internal find_package modules only used for
# building CMake and not for shipping externally
list(INSERT CMAKE_MODULE_PATH 0 ${CMake_SOURCE_DIR}/Source/Modules)
Expand All @@ -18,6 +29,10 @@ if(CMAKE_BOOTSTRAP)
unset(CMAKE_BOOTSTRAP CACHE)
endif()

if(CMake_TEST_HOST_CMAKE)
get_filename_component(CMake_TEST_EXTERNAL_CMAKE "${CMAKE_COMMAND}" DIRECTORY)
endif()

if(NOT CMake_TEST_EXTERNAL_CMAKE)
if(CMAKE_SYSTEM_NAME STREQUAL "HP-UX")
message(FATAL_ERROR
Expand Down Expand Up @@ -353,11 +368,24 @@ macro (CMAKE_BUILD_UTILITIES)
# Setup third-party libraries.
# Everything in the tree should be able to include files from the
# Utilities directory.
if (CMAKE_SYSTEM_NAME STREQUAL "AIX" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using -isystem option generate error "template with C linkage"
include_directories("${CMake_SOURCE_DIR}/Utilities/std")
else()
include_directories(SYSTEM "${CMake_SOURCE_DIR}/Utilities/std")
endif()

include_directories(
${CMake_BINARY_DIR}/Utilities
${CMake_SOURCE_DIR}/Utilities
)

#---------------------------------------------------------------------
# Build CMake std library for CMake and CTest.
set(CMAKE_STD_LIBRARY cmstd)
add_subdirectory(Utilities/std)
CMAKE_SET_TARGET_FOLDER(cmstd "Utilities/std")

# check for the use of system libraries versus builtin ones
# (a macro defined in this file)
CMAKE_HANDLE_SYSTEM_LIBRARIES()
Expand Down Expand Up @@ -429,10 +457,7 @@ macro (CMAKE_BUILD_UTILITIES)
set(_CMAKE_USE_OPENSSL_DEFAULT OFF)
if(NOT DEFINED CMAKE_USE_OPENSSL AND NOT WIN32 AND NOT APPLE
AND CMAKE_SYSTEM_NAME MATCHES "(Linux|FreeBSD)")
find_package(OpenSSL QUIET)
if(OPENSSL_FOUND)
set(_CMAKE_USE_OPENSSL_DEFAULT ON)
endif()
set(_CMAKE_USE_OPENSSL_DEFAULT ON)
endif()
option(CMAKE_USE_OPENSSL "Use OpenSSL." ${_CMAKE_USE_OPENSSL_DEFAULT})
mark_as_advanced(CMAKE_USE_OPENSSL)
Expand Down Expand Up @@ -511,7 +536,7 @@ macro (CMAKE_BUILD_UTILITIES)
#---------------------------------------------------------------------
# Build or use system libarchive for CMake and CTest.
if(CMAKE_USE_SYSTEM_LIBARCHIVE)
find_package(LibArchive 3.1.0)
find_package(LibArchive 3.3.3)
if(NOT LibArchive_FOUND)
message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!")
endif()
Expand Down Expand Up @@ -629,8 +654,7 @@ endif()
# The main section of the CMakeLists file
#
#-----------------------------------------------------------------------
# Compute CMake_VERSION, etc.
include(Source/CMakeVersionCompute.cmake)
include(Source/CMakeVersion.cmake)

# Include the standard Dart testing module
enable_testing()
Expand Down Expand Up @@ -677,7 +701,7 @@ endif()
# to a cdash4simpletest database. In these cases, the CDash dashboards
# should be run first.
#
if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x")
if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x" AND NOT CMake_TEST_NO_NETWORK)
set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org")
endif()

Expand Down Expand Up @@ -817,7 +841,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
REGEX "Help/dev($|/)" EXCLUDE
REGEX "Help/(dev|guide)($|/)" EXCLUDE
)

# Install auxiliary files integrating with other tools.
Expand Down
5 changes: 3 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ To contribute patches:
#. Run `Utilities/SetupForDevelopment.sh`_ for local git configuration.
#. See `Building CMake`_ for building CMake locally.
#. See the `CMake Source Code Guide`_ for coding guidelines.
#. Base all new work on the upstream ``master`` branch.
#. Create a topic branch named suitably for your work.
Base all new work on the upstream ``master`` branch.
Base work on the upstream ``release`` branch only if it fixes a
regression or bug in a feature new to that release.
If in doubt, prefer ``master``. Reviewers may simply ask for
a rebase if deemed appropriate in particular cases.
#. Create commits making incremental, distinct, logically complete changes
with appropriate `commit messages`_.
#. Push a topic branch to a personal repository fork on GitLab.
#. Push the topic branch to a personal repository fork on GitLab.
#. Create a GitLab Merge Request targeting the upstream ``master`` branch
(even if the change is intended for merge to the ``release`` branch).
Check the box labelled "Allow commits from members who can merge to the
Expand Down
29 changes: 18 additions & 11 deletions Help/command/FIND_XXX.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,28 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
|prefix_XXX_SUBDIR| for each ``<prefix>`` in
:variable:`CMAKE_SYSTEM_PREFIX_PATH`

1. If called from within a find module loaded by
1. If called from within a find module or any other script loaded by a call to
:command:`find_package(<PackageName>)`, search prefixes unique to the
current package being found. Specifically look in the
current package being found. Specifically, look in the
:variable:`<PackageName>_ROOT` CMake variable and the
:envvar:`<PackageName>_ROOT` environment variable.
The package root variables are maintained as a stack so if called from
nested find modules, root paths from the parent's find module will be
searched after paths from the current module,
i.e. ``<CurrentPackage>_ROOT``, ``ENV{<CurrentPackage>_ROOT}``,
The package root variables are maintained as a stack, so if called from
nested find modules or config packages, root paths from the parent's find
module or config package will be searched after paths from the current
module or package. In other words, the search order would be
``<CurrentPackage>_ROOT``, ``ENV{<CurrentPackage>_ROOT}``,
``<ParentPackage>_ROOT``, ``ENV{<ParentPackage>_ROOT}``, etc.
This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed.
This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
See policy :policy:`CMP0074`.

* |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX|

2. Search paths specified in cmake-specific cache variables.
These are intended to be used on the command line with a ``-DVAR=value``.
The values are interpreted as :ref:`semicolon-separated lists <CMake Language Lists>`.
This can be skipped if ``NO_CMAKE_PATH`` is passed.
This can be skipped if ``NO_CMAKE_PATH`` is passed or by setting the
:variable:`CMAKE_FIND_USE_CMAKE_PATH` to ``FALSE``.

* |CMAKE_PREFIX_PATH_XXX|
* |CMAKE_XXX_PATH|
Expand All @@ -107,7 +110,8 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
These are intended to be set in the user's shell configuration,
and therefore use the host's native path separator
(``;`` on Windows and ``:`` on UNIX).
This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed.
This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed or
by setting the :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH` to ``FALSE``.

* |CMAKE_PREFIX_PATH_XXX|
* |CMAKE_XXX_PATH|
Expand All @@ -119,13 +123,16 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
Hard-coded guesses should be specified with the ``PATHS`` option.

5. Search the standard system environment variables.
This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is an argument.
This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed or by
setting the :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` to ``FALSE``.

* |SYSTEM_ENVIRONMENT_PATH_XXX|
* |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX|

6. Search cmake variables defined in the Platform files
for the current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH``
is passed.
is passed or by setting the :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`
to ``FALSE``.

* |CMAKE_SYSTEM_PREFIX_PATH_XXX|
* |CMAKE_SYSTEM_XXX_PATH|
Expand Down
18 changes: 9 additions & 9 deletions Help/command/LINK_OPTIONS_LINKER.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
To pass options to the linker tool, each compiler driver has is own syntax.
The ``LINKER:`` prefix can be used to specify, in a portable way, options
to pass to the linker tool. The ``LINKER:`` prefix is replaced by the required
driver option and the rest of the option string defines linker arguments using
``,`` as separator. These arguments will be formatted according to the
To pass options to the linker tool, each compiler driver has its own syntax.
The ``LINKER:`` prefix and ``,`` separator can be used to specify, in a portable
way, options to pass to the linker tool. ``LINKER:`` is replaced by the
appropriate driver option and ``,`` by the appropriate driver separator.
The driver prefix and driver separator are given by the values of the
:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG` and
:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP` variables.

Expand All @@ -12,11 +12,11 @@ For example, ``"LINKER:-z,defs"`` becomes ``-Xlinker -z -Xlinker defs`` for
The ``LINKER:`` prefix can be specified as part of a ``SHELL:`` prefix
expression.

The ``LINKER:`` prefix supports, as alternate syntax, specification of
arguments using ``SHELL:`` prefix and space as separator. Previous example
becomes ``"LINKER:SHELL:-z defs"``.
The ``LINKER:`` prefix supports, as an alternative syntax, specification of
arguments using the ``SHELL:`` prefix and space as separator. The previous
example then becomes ``"LINKER:SHELL:-z defs"``.

.. note::

Specifying ``SHELL:`` prefix elsewhere than at the beginning of the
Specifying the ``SHELL:`` prefix anywhere other than at the beginning of the
``LINKER:`` prefix is not supported.
Loading

0 comments on commit 4d9cd08

Please sign in to comment.