diff --git a/.clang-tidy b/.clang-tidy index 8d79b0c5d4b..520b1a9e393 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,8 @@ --- Checks: "-*,\ +bugprone-*,\ +-bugprone-macro-parentheses,\ +-bugprone-misplaced-widening-cast,\ google-readability-casting,\ misc-*,\ -misc-incorrect-roundings,\ @@ -8,28 +11,28 @@ misc-*,\ -misc-static-assert,\ modernize-*,\ -modernize-deprecated-headers,\ --modernize-pass-by-value,\ -modernize-raw-string-literal,\ -modernize-return-braced-init-list,\ -modernize-use-auto,\ --modernize-use-default-member-init,\ --modernize-use-emplace,\ --modernize-use-equals-default,\ --modernize-use-equals-delete,\ -modernize-use-noexcept,\ -modernize-use-transparent-functors,\ -modernize-use-using,\ performance-*,\ -performance-inefficient-string-concatenation,\ +-performance-inefficient-vector-operation,\ readability-*,\ -readability-function-size,\ -readability-identifier-naming,\ -readability-implicit-bool-cast,\ +-readability-implicit-bool-conversion,\ -readability-inconsistent-declaration-parameter-name,\ -readability-named-parameter,\ -readability-redundant-declaration,\ --readability-redundant-member-init,\ --readability-simplify-boolean-expr,\ " HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$' +CheckOptions: + - key: modernize-use-default-member-init.UseAssignment + value: '1' + - key: modernize-use-equals-default.IgnoreMacros + value: '0' ... diff --git a/.gitattributes b/.gitattributes index d6fd5d6c92d..24fd9c2014e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -21,6 +21,7 @@ configure eol=lf *.pfx -text *.png -text +*.png.in -text *.c our-c-style *.cc our-c-style diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index 076b47fdbcf..7e029de4e0c 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -733,7 +733,7 @@ syn keyword cmakeVariable contained \ CTEST_CUSTOM_POST_TEST \ CTEST_CUSTOM_PRE_MEMCHECK \ CTEST_CUSTOM_PRE_TEST - \ CTEST_CUSTOM_TEST_IGNORE + \ CTEST_CUSTOM_TESTS_IGNORE \ CTEST_CUSTOM_WARNING_EXCEPTION \ CTEST_CUSTOM_WARNING_MATCH \ CTEST_CVS_CHECKOUT @@ -873,8 +873,12 @@ syn keyword cmakeKWExternalProject contained \ LOG_ \ LOG_BUILD \ LOG_CONFIGURE + \ LOG_DIR \ LOG_DOWNLOAD \ LOG_INSTALL + \ LOG_MERGED_STDOUTERR + \ LOG_OUTPUT_ON_FAILURE + \ LOG_PATCH \ LOG_TEST \ LOG_UPDATE \ MAKE_EXE @@ -2208,6 +2212,8 @@ syn keyword cmakeGeneratorExpressions contained \ DEBUG_MODE \ EXPORT \ FOO_EXTRA_THINGS + \ Fortran_COMPILER_ID + \ Fortran_COMPILER_VERSION \ GENEX_EVAL \ GNU \ IF diff --git a/CMakeLists.txt b/CMakeLists.txt index 998db15d35e..bd130ec3699 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # 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 FATAL_ERROR) +cmake_minimum_required(VERSION 3.1...3.12 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) @@ -117,6 +117,18 @@ option(CMake_BUILD_DEVELOPER_REFERENCE "Build CMake Developer Reference" OFF) mark_as_advanced(CMake_BUILD_DEVELOPER_REFERENCE) +# option to build using interprocedural optimizations (IPO/LTO) +if (NOT CMAKE_VERSION VERSION_LESS 3.12.2) + option(CMake_BUILD_LTO "Compile CMake with link-time optimization if supported" OFF) + if(CMake_BUILD_LTO) + include(CheckIPOSupported) + check_ipo_supported(RESULT HAVE_IPO) + if(HAVE_IPO) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + endif() + endif() +endif() + #----------------------------------------------------------------------- # a macro to deal with system libraries, implemented as a macro # simply to improve readability of the main script @@ -125,10 +137,6 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) # Options have dependencies. include(CMakeDependentOption) - # Optionally use system xmlrpc. We no longer build or use it by default. - option(CTEST_USE_XMLRPC "Enable xmlrpc submission method in CTest." OFF) - mark_as_advanced(CTEST_USE_XMLRPC) - # Allow the user to enable/disable all system utility library options by # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}. set(UTILITIES BZIP2 CURL EXPAT FORM JSONCPP LIBARCHIVE LIBLZMA LIBRHASH LIBUV ZLIB) @@ -159,10 +167,8 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) # Optionally use system utility libraries. option(CMAKE_USE_SYSTEM_LIBARCHIVE "Use system-installed libarchive" "${CMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE}") - CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_CURL "Use system-installed curl" - "${CMAKE_USE_SYSTEM_LIBRARY_CURL}" "NOT CTEST_USE_XMLRPC" ON) - CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat" - "${CMAKE_USE_SYSTEM_LIBRARY_EXPAT}" "NOT CTEST_USE_XMLRPC" ON) + option(CMAKE_USE_SYSTEM_CURL "Use system-installed curl" "${CMAKE_USE_SYSTEM_LIBRARY_CURL}") + option(CMAKE_USE_SYSTEM_EXPAT "Use system-installed expat" "${CMAKE_USE_SYSTEM_LIBRARY_EXPAT}") CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib" "${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON) CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2" @@ -200,7 +206,7 @@ endmacro() macro(CMAKE_SETUP_TESTING) if(BUILD_TESTING) set(CMAKE_TEST_SYSTEM_LIBRARIES 0) - foreach(util CURL EXPAT XMLRPC ZLIB) + foreach(util CURL EXPAT ZLIB) if(CMAKE_USE_SYSTEM_${util}) set(CMAKE_TEST_SYSTEM_LIBRARIES 1) endif() @@ -326,6 +332,9 @@ macro (CMAKE_BUILD_UTILITIES) set(KWSYS_USE_ConsoleBuf 1) set(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source) set(KWSYS_INSTALL_DOC_DIR "${CMAKE_DOC_DIR}") + if(CMake_NO_CXX_STANDARD) + set(KWSYS_CXX_STANDARD "") + endif() add_subdirectory(Source/kwsys) set(kwsys_folder "Utilities/KWSys") CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}") @@ -532,7 +541,7 @@ macro (CMAKE_BUILD_UTILITIES) #--------------------------------------------------------------------- # Build jsoncpp library. if(CMAKE_USE_SYSTEM_JSONCPP) - find_package(JsonCpp) + find_package(JsonCpp 1.4.1) if(NOT JsonCpp_FOUND) message(FATAL_ERROR "CMAKE_USE_SYSTEM_JSONCPP is ON but a JsonCpp is not found!") @@ -559,18 +568,6 @@ macro (CMAKE_BUILD_UTILITIES) CMAKE_SET_TARGET_FOLDER(cmlibuv "Utilities/3rdParty") endif() - #--------------------------------------------------------------------- - # Build XMLRPC library for CMake and CTest. - if(CTEST_USE_XMLRPC) - find_package(XMLRPC QUIET REQUIRED libwww-client) - if(NOT XMLRPC_FOUND) - message(FATAL_ERROR - "CTEST_USE_XMLRPC is ON but xmlrpc is not found!") - endif() - set(CMAKE_XMLRPC_INCLUDES ${XMLRPC_INCLUDE_DIRS}) - set(CMAKE_XMLRPC_LIBRARIES ${XMLRPC_LIBRARIES}) - endif() - #--------------------------------------------------------------------- # Use curses? if (UNIX) @@ -724,7 +721,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) # 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 CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH) + 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) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 84f6abbbe99..7e7111164e0 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -24,7 +24,8 @@ CMake uses `Kitware's GitLab Instance`_ to manage development and code review. To contribute patches: #. Fork the upstream `CMake Repository`_ into a personal account. -#. Run `Utilities/SetupForDevelopment.sh`_ for local configuration. +#. 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. Base work on the upstream ``release`` branch only if it fixes a @@ -45,6 +46,7 @@ The merge request will enter the `CMake Review Process`_ for consideration. .. _`Kitware's GitLab Instance`: https://gitlab.kitware.com .. _`CMake Repository`: https://gitlab.kitware.com/cmake/cmake .. _`Utilities/SetupForDevelopment.sh`: Utilities/SetupForDevelopment.sh +.. _`Building CMake`: README.rst#building-cmake .. _`CMake Source Code Guide`: Help/dev/source.rst .. _`commit messages`: Help/dev/review.rst#commit-messages .. _`CMake Review Process`: Help/dev/review.rst diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 18e00783a51..823ee3cb7c3 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -52,6 +52,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "(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" + "LexerParser.*warning.*empty expression statement has no effect; remove unnecessary" "PGC-W-0095-Type cast required for this conversion.*ProcessUNIX.c" "[Qq]t([Cc]ore|[Gg]ui|[Ww]idgets).*warning.*conversion.*may alter its value" "warning:.*is.*very unsafe.*consider using.*" diff --git a/CompileFlags.cmake b/CompileFlags.cmake index ec9b31bd910..5d0e14493d2 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -28,13 +28,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "AIX") endif() endif() -if(CMAKE_SYSTEM_NAME MATCHES "IRIX") - if(NOT CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15") - endif() -endif() - if(CMAKE_SYSTEM MATCHES "OSF1-V") if(NOT CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") diff --git a/Copyright.txt b/Copyright.txt index 743c63418e3..f2362144a1c 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -1,5 +1,5 @@ CMake - Cross Platform Makefile Generator -Copyright 2000-2018 Kitware, Inc. and Contributors +Copyright 2000-2019 Kitware, Inc. and Contributors All rights reserved. Redistribution and use in source and binary forms, with or without @@ -39,6 +39,7 @@ The following individuals and institutions are among the Contributors: * Alexander Neundorf * Alexander Smorkalov * Alexey Sokolov +* Alex Merry * Alex Turbov * Andreas Pakulat * Andreas Schneider @@ -62,13 +63,17 @@ The following individuals and institutions are among the Contributors: * Ilya Lavrenov * Insight Software Consortium * Jan Woetzel +* Julien Schueller * Kelly Thompson +* Laurent Montel * Konstantin Podsvirov * Mario Bensi +* Martin Gräßlin * Mathieu Malaterre * Matthaeus G. Chajdas * Matthias Kretz * Matthias Maennich +* Michael Hirsch, Ph.D. * Michael Stürmer * Miguel A. Figueroa-Villanueva * Mike Jackson diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 73dbd577428..dde4dbbbc18 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -96,7 +96,7 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: 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:`;-lists `. + The values are interpreted as :ref:`semicolon-separated lists `. This can be skipped if ``NO_CMAKE_PATH`` is passed. * |CMAKE_PREFIX_PATH_XXX| diff --git a/Help/command/add_compile_definitions.rst b/Help/command/add_compile_definitions.rst index 48815d44fa7..8225da783e4 100644 --- a/Help/command/add_compile_definitions.rst +++ b/Help/command/add_compile_definitions.rst @@ -1,9 +1,9 @@ add_compile_definitions ----------------------- -Adds preprocessor definitions to the compilation of source files. +Add preprocessor definitions to the compilation of source files. -:: +.. code-block:: cmake add_compile_definitions( ...) diff --git a/Help/command/add_compile_options.rst b/Help/command/add_compile_options.rst index 350a1c0bd4f..43805c3a91b 100644 --- a/Help/command/add_compile_options.rst +++ b/Help/command/add_compile_options.rst @@ -1,21 +1,18 @@ add_compile_options ------------------- -Adds options to the compilation of source files. +Add options to the compilation of source files. -:: +.. code-block:: cmake add_compile_options(