Skip to content

Commit

Permalink
Merge pull request #93 from microsoft/dev/jgoshi/updateToCMake3_17
Browse files Browse the repository at this point in the history
Dev/jgoshi/update to c make3 17
  • Loading branch information
jgoshi authored Mar 26, 2020
2 parents 5f518ec + 4ff5746 commit 76de697
Show file tree
Hide file tree
Showing 1,517 changed files with 32,971 additions and 8,855 deletions.
4 changes: 3 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"]cmConfigure\.h'
Priority: -1
- Regex: '^(<|")cm/'
- Regex: '^<queue>'
Priority: 1
- Regex: '^(<|")cm(ext)?/'
Priority: 2
- Regex: '^(<|")windows\.h'
Priority: 3
Expand Down
11 changes: 11 additions & 0 deletions Auxiliary/vim/syntax/cmake.vim
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ syn keyword cmakeProperty contained
\ CLEAN_NO_CUSTOM
\ CMAKE_CONFIGURE_DEPENDS
\ CMAKE_CXX_KNOWN_FEATURES
\ CMAKE_CUDA_KNOWN_FEATURES
\ CMAKE_C_KNOWN_FEATURES
\ CMAKE_ROLE
\ COMMON_LANGUAGE_RUNTIME
Expand Down Expand Up @@ -220,6 +221,7 @@ syn keyword cmakeProperty contained
\ JOB_POOLS
\ JOB_POOL_COMPILE
\ JOB_POOL_LINK
\ JOB_POOL_PRECOMPILE_HEADER
\ KEEP_EXTENSION
\ LABELS
\ LANGUAGE
Expand Down Expand Up @@ -725,6 +727,7 @@ syn keyword cmakeVariable contained
\ CMAKE_CUDA_COMPILER_AR
\ CMAKE_CUDA_COMPILER_ARCHITECTURE_ID
\ CMAKE_CUDA_COMPILER_EXTERNAL_TOOLCHAIN
\ CMAKE_CUDA_COMPILE_FEATURES
\ CMAKE_CUDA_COMPILER_ID
\ CMAKE_CUDA_COMPILER_LAUNCHER
\ CMAKE_CUDA_COMPILER_LOADED
Expand Down Expand Up @@ -1064,6 +1067,7 @@ syn keyword cmakeVariable contained
\ CMAKE_JOB_POOLS
\ CMAKE_JOB_POOL_COMPILE
\ CMAKE_JOB_POOL_LINK
\ CMAKE_JOB_POOL_PRECOMPILE_HEADER
\ CMAKE_Java
\ CMAKE_Java_ANDROID_TOOLCHAIN_MACHINE
\ CMAKE_Java_ANDROID_TOOLCHAIN_PREFIX
Expand Down Expand Up @@ -2862,6 +2866,11 @@ syn keyword cmakeKWtarget_link_options contained
\ _LINKER_WRAPPER_FLAG
\ _LINKER_WRAPPER_FLAG_SEP

syn keyword cmakeKWtarget_precompile_headers contained
\ INTERFACE
\ PRIVATE
\ PUBLIC

syn keyword cmakeKWtarget_sources contained
\ ALIAS
\ IMPORTED
Expand Down Expand Up @@ -3166,6 +3175,7 @@ syn keyword cmakeCommand
\ target_link_directories
\ target_link_libraries
\ target_link_options
\ target_precompile_headers
\ target_sources
\ try_compile
\ try_run
Expand Down Expand Up @@ -3322,6 +3332,7 @@ hi def link cmakeKWtarget_include_directories ModeMsg
hi def link cmakeKWtarget_link_directories ModeMsg
hi def link cmakeKWtarget_link_libraries ModeMsg
hi def link cmakeKWtarget_link_options ModeMsg
hi def link cmakeKWtarget_precompile_headers ModeMsg
hi def link cmakeKWtarget_sources ModeMsg
hi def link cmakeKWtry_compile ModeMsg
hi def link cmakeKWtry_run ModeMsg
Expand Down
47 changes: 8 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ macro(CMAKE_SETUP_TESTING)
${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
endif()
mark_as_advanced(DART_ROOT)
mark_as_advanced(CURL_TESTING)
endmacro()


Expand Down Expand Up @@ -368,7 +367,7 @@ 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")
if ((CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CMAKE_SYSTEM_NAME STREQUAL "OS400") AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using -isystem option generate error "template with C linkage"
include_directories("${CMake_SOURCE_DIR}/Utilities/std")
else()
Expand Down Expand Up @@ -671,10 +670,6 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
"Where to put the libraries for CMake")

# The CMake executables usually do not need any rpath to run in the build or
# install tree.
set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")

# Load install destinations.
include(Source/CMakeInstallDestinations.cmake)

Expand Down Expand Up @@ -714,19 +709,6 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
# build the utilities (a macro defined in this file)
CMAKE_BUILD_UTILITIES()

# On NetBSD ncurses is required, since curses doesn't have the wsyncup()
# function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib,
# which isn't in the default linker search path. So without RPATH ccmake
# doesn't run and the build doesn't succeed since ccmake is executed for
# generating the documentation.
if(BUILD_CursesDialog)
get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH)
set(CURSES_NEED_RPATH FALSE)
if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64")
set(CURSES_NEED_RPATH TRUE)
endif()
endif()

if(BUILD_QtDialog)
if(APPLE)
set(CMAKE_BUNDLE_VERSION
Expand All @@ -739,28 +721,15 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
set(CMAKE_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}CMake.app/Contents")
endif()

set(QT_NEED_RPATH FALSE)
if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64")
set(QT_NEED_RPATH TRUE)
endif()
endif()


# The same might be true on other systems for other libraries.
# Then only enable RPATH if we have are building at least with cmake 2.4,
# since this one has much better RPATH features than cmake 2.2.
# The executables are then built with the RPATH for the libraries outside
# the build tree, which is both the build and the install RPATH.
if (UNIX)
if( CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB
OR CMAKE_USE_SYSTEM_EXPAT OR CURSES_NEED_RPATH OR QT_NEED_RPATH)
set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif()
endif ()

if(UNIX)
# Install executables with the RPATH set for libraries outside the build tree.
# This is also suitable for binaries in the build tree. Avoid re-link on install.
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON CACHE BOOL "Install with RPATH set to find custom-built libraries.")
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "Build with RPATH set to match install-tree RPATH.")
mark_as_advanced(CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_BUILD_WITH_INSTALL_RPATH)
endif()

# add the uninstall support
configure_file(
Expand Down
2 changes: 2 additions & 0 deletions CTestCustom.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"WarningMessagesDialog\\.cxx"
"warning.*directory name.*CMake-Xcode.*/bin/.*does not exist.*"
"stl_deque.h:1051"
"Tests/CMakeLib/testCTestResourceSpec.cxx:.*warning: missing initializer for member.*cmCTestResourceSpec::.*" # GCC 4.8 disagrees with later compilers on C++11 initializer list conversion
"(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)"
"(Lexer|Parser).*warning.*(statement is unreachable|will never be executed)"
"(Lexer|Parser).*warning.*variable.*was set but never used"
Expand All @@ -71,6 +72,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"cm(StringCommand|CTestTestHandler)\\.cxx.*warning.*rand.*isn.*t random" # we do not do crypto
"cm(StringCommand|CTestTestHandler)\\.cxx.*warning.*srand.*seed choices are.*poor" # we do not do crypto
"IPA warning: function.*multiply defined in"
"LICENSE WARNING" # PGI license expiry. Not useful in nightly testing.

# Ignore compiler summary warning, assuming prior text has matched some
# other warning expression:
Expand Down
12 changes: 10 additions & 2 deletions CompileFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,20 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^parisc")
endif()

# Workaround for TOC Overflow on ppc64
set(bigTocFlag "")
if(CMAKE_SYSTEM_NAME STREQUAL "AIX" AND
CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-bbigtoc")
set(bigTocFlag "-Wl,-bbigtoc")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-multi-toc")
set(bigTocFlag "-Wl,--no-multi-toc")
endif()
if(bigTocFlag)
include(CheckCXXLinkerFlag)
check_cxx_linker_flag(${bigTocFlag} BIG_TOC_FLAG_SUPPORTED)
if(BIG_TOC_FLAG_SUPPORTED)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${bigTocFlag}")
endif()
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND
Expand Down
3 changes: 2 additions & 1 deletion Copyright.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CMake - Cross Platform Makefile Generator
Copyright 2000-2019 Kitware, Inc. and Contributors
Copyright 2000-2020 Kitware, Inc. and Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -99,6 +99,7 @@ The following individuals and institutions are among the Contributors:
* Sebastian Holtermann <[email protected]>
* Stephen Kelly <[email protected]>
* Sylvain Joubert <[email protected]>
* The Qt Company Ltd.
* Thomas Sondergaard <[email protected]>
* Tobias Hunger <[email protected]>
* Todd Gamblin <[email protected]>
Expand Down
47 changes: 34 additions & 13 deletions Help/command/add_custom_command.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ The options are:
order-only dependencies to ensure the byproducts will be
available before their dependents build.

The :ref:`Makefile Generators` will remove ``BYPRODUCTS`` and other
:prop_sf:`GENERATED` files during ``make clean``.

``COMMAND``
Specify the command-line(s) to execute at build time.
If more than one ``COMMAND`` is specified they will be executed in order,
Expand Down Expand Up @@ -112,24 +115,42 @@ The options are:
build time.

``DEPENDS``
Specify files on which the command depends. If any dependency is
an ``OUTPUT`` of another custom command in the same directory
(``CMakeLists.txt`` file) CMake automatically brings the other
Specify files on which the command depends. Each argument is converted
to a dependency as follows:

1. If the argument is the name of a target (created by the
:command:`add_custom_target`, :command:`add_executable`, or
:command:`add_library` command) a target-level dependency is
created to make sure the target is built before any target
using this custom command. Additionally, if the target is an
executable or library, a file-level dependency is created to
cause the custom command to re-run whenever the target is
recompiled.

2. If the argument is an absolute path, a file-level dependency
is created on that path.

3. If the argument is the name of a source file that has been
added to a target or on which a source file property has been set,
a file-level dependency is created on that source file.

4. If the argument is a relative path and it exists in the current
source directory, a file-level dependency is created on that
file in the current source directory.

5. Otherwise, a file-level dependency is created on that path relative
to the current binary directory.

If any dependency is an ``OUTPUT`` of another custom command in the same
directory (``CMakeLists.txt`` file), CMake automatically brings the other
custom command into the target in which this command is built.
A target-level dependency is added if any dependency is listed as
``BYPRODUCTS`` of a target or any of its build events in the same
directory to ensure the byproducts will be available.
If ``DEPENDS`` is not specified the command will run whenever

If ``DEPENDS`` is not specified, the command will run whenever
the ``OUTPUT`` is missing; if the command does not actually
create the ``OUTPUT`` then the rule will always run.
If ``DEPENDS`` specifies any target (created by the
:command:`add_custom_target`, :command:`add_executable`, or
:command:`add_library` command) a target-level dependency is
created to make sure the target is built before any target
using this custom command. Additionally, if the target is an
executable or library a file-level dependency is created to
cause the custom command to re-run whenever the target is
recompiled.
create the ``OUTPUT``, the rule will always run.

Arguments to ``DEPENDS`` may use
:manual:`generator expressions <cmake-generator-expressions(7)>`.
Expand Down
3 changes: 3 additions & 0 deletions Help/command/add_custom_target.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ The options are:
order-only dependencies to ensure the byproducts will be
available before their dependents build.

The :ref:`Makefile Generators` will remove ``BYPRODUCTS`` and other
:prop_sf:`GENERATED` files during ``make clean``.

``COMMAND``
Specify the command-line(s) to execute at build time.
If more than one ``COMMAND`` is specified they will be executed in order,
Expand Down
20 changes: 20 additions & 0 deletions Help/command/ctest_test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Perform the :ref:`CTest Test Step` as a :ref:`Dashboard Client`.
[STOP_TIME <time-of-day>]
[RETURN_VALUE <result-var>]
[CAPTURE_CMAKE_ERROR <result-var>]
[REPEAT <mode>:<n>]
[QUIET]
)

Expand Down Expand Up @@ -95,6 +96,25 @@ The options are:
and then the ``--test-load`` command-line argument to :manual:`ctest(1)`.
See also the ``TestLoad`` setting in the :ref:`CTest Test Step`.

``REPEAT <mode>:<n>``
Run tests repeatedly based on the given ``<mode>`` up to ``<n>`` times.
The modes are:

``UNTIL_FAIL``
Require each test to run ``<n>`` times without failing in order to pass.
This is useful in finding sporadic failures in test cases.

``UNTIL_PASS``
Allow each test to run up to ``<n>`` times in order to pass.
Repeats tests if they fail for any reason.
This is useful in tolerating sporadic failures in test cases.

``AFTER_TIMEOUT``
Allow each test to run up to ``<n>`` times in order to pass.
Repeats tests only if they timeout.
This is useful in tolerating sporadic timeouts in test cases
on busy machines.

``SCHEDULE_RANDOM <ON|OFF>``
Launch tests in a random order. This may be useful for detecting
implicit test dependencies.
Expand Down
2 changes: 1 addition & 1 deletion Help/command/file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ are only traversed if ``FOLLOW_SYMLINKS`` is given or policy
By default ``GLOB_RECURSE`` omits directories from result list - setting
``LIST_DIRECTORIES`` to true adds directories to result list.
If ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to
``OLD`` then ``LIST_DIRECTORIES`` treats symlinks as directories.
``NEW`` then ``LIST_DIRECTORIES`` treats symlinks as directories.

Examples of recursive globbing include::

Expand Down
45 changes: 44 additions & 1 deletion Help/command/foreach.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ of undocumented behavior that may change in future releases.

.. code-block:: cmake
foreach(loop_var IN [LISTS [<lists>]] [ITEMS [<items>]])
foreach(<loop_var> IN [LISTS [<lists>]] [ITEMS [<items>]])
In this variant, ``<lists>`` is a whitespace or semicolon
separated list of list-valued variables. The ``foreach``
Expand Down Expand Up @@ -82,3 +82,46 @@ yields
-- X=6
-- X=7
-- X=8


.. code-block:: cmake
foreach(<loop_var>... IN ZIP_LISTS <lists>)
In this variant, ``<lists>`` is a whitespace or semicolon
separated list of list-valued variables. The ``foreach``
command iterates over each list simultaneously setting the
iteration variables as follows:

- if the only ``loop_var`` given, then it sets a series of
``loop_var_N`` variables to the current item from the
corresponding list;
- if multiple variable names passed, their count should match
the lists variables count;
- if any of the lists are shorter, the corresponding iteration
variable is not defined for the current iteration.

.. code-block:: cmake
list(APPEND English one two three four)
list(APPEND Bahasa satu dua tiga)
foreach(num IN ZIP_LISTS English Bahasa)
message(STATUS "num_0=${num_0}, num_1=${num_1}")
endforeach()
foreach(en ba IN ZIP_LISTS English Bahasa)
message(STATUS "en=${en}, ba=${ba}")
endforeach()
yields
::

-- num_0=one, num_1=satu
-- num_0=two, num_1=dua
-- num_0=three, num_1=tiga
-- num_0=four, num_1=
-- en=one, ba=satu
-- en=two, ba=dua
-- en=three, ba=tiga
-- en=four, ba=
6 changes: 6 additions & 0 deletions Help/command/macro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ just terminate execution of the macro; rather, control is returned
from the scope of the macro call. To avoid confusion, it is recommended
to avoid :command:`return()` in macros altogether.

Unlike a function, the :variable:`CMAKE_CURRENT_FUNCTION`,
:variable:`CMAKE_CURRENT_FUNCTION_LIST_DIR`,
:variable:`CMAKE_CURRENT_FUNCTION_LIST_FILE`,
:variable:`CMAKE_CURRENT_FUNCTION_LIST_LINE` variables are not
set for macro.

.. _`Argument Caveats`:

Argument Caveats
Expand Down
Loading

0 comments on commit 76de697

Please sign in to comment.