diff --git a/Auxiliary/bash-completion/cmake b/Auxiliary/bash-completion/cmake index 59e02987b..557f243e3 100644 --- a/Auxiliary/bash-completion/cmake +++ b/Auxiliary/bash-completion/cmake @@ -3,7 +3,14 @@ _cmake() { local cur prev words cword split=false - _init_completion -n := || return + if type -t _init_completion >/dev/null; then + _init_completion -n = || return + else + # manual initialization for older bash completion versions + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + fi # Workaround for options like -DCMAKE_BUILD_TYPE=Release local prefix= diff --git a/Auxiliary/bash-completion/cpack b/Auxiliary/bash-completion/cpack index 9ab604839..05e0e93ec 100644 --- a/Auxiliary/bash-completion/cpack +++ b/Auxiliary/bash-completion/cpack @@ -3,7 +3,14 @@ _cpack() { local cur prev words cword - _init_completion -n = || return + if type -t _init_completion >/dev/null; then + _init_completion -n = || return + else + # manual initialization for older bash completion versions + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + fi case "$prev" in -G) diff --git a/Auxiliary/bash-completion/ctest b/Auxiliary/bash-completion/ctest index 327e12c59..387672adf 100644 --- a/Auxiliary/bash-completion/ctest +++ b/Auxiliary/bash-completion/ctest @@ -3,7 +3,14 @@ _ctest() { local cur prev words cword - _init_completion -n = || return + if type -t _init_completion >/dev/null; then + _init_completion -n = || return + else + # manual initialization for older bash completion versions + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + fi case "$prev" in -C|--build-config) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 57ed4cafd..600356513 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -38,6 +38,10 @@ if(CPACK_GENERATOR MATCHES "IFW") @_CPACK_IFW_PACKAGE_ICON@ set(CPACK_IFW_PACKAGE_WINDOW_ICON "@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png") + set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT + "@CMake_SOURCE_DIR@/Source/QtIFW/controlscript.qs") + # Uninstaller configuration + set(CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME "cmake-maintenance") # Package configuration group set(CPACK_IFW_PACKAGE_GROUP CMake) # Group configuration @@ -87,4 +91,34 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") if(patch MATCHES "^[0-9]+$" AND patch LESS 65535) set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.${patch}") endif() + + set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "http://www.cmake.org") + + set(CPACK_WIX_PROPERTY_ARPCONTACT "@CPACK_PACKAGE_CONTACT@") + + set(CPACK_WIX_PROPERTY_ARPCOMMENTS + "CMake is a cross-platform, open-source build system." + ) + + set(CPACK_WIX_PRODUCT_ICON + "@CMake_SOURCE_DIR@/Utilities/Release/CMakeLogo.ico" + ) + + set_property(INSTALL "@CMAKE_DOC_DIR@/html/index.html" PROPERTY + CPACK_START_MENU_SHORTCUTS "CMake Documentation" + ) + + set_property(INSTALL "cmake.org.html" PROPERTY + CPACK_START_MENU_SHORTCUTS "CMake Web Site" + ) + + set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-dcl:high") + + set(CPACK_WIX_UI_BANNER + "@CMake_SOURCE_DIR@/Utilities/Release/cpack_wix_ui_banner.jpg" + ) + + set(CPACK_WIX_UI_DIALOG + "@CMake_SOURCE_DIR@/Utilities/Release/cpack_wix_ui_dialog.jpg" + ) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 1250a9477..1b91ab893 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,11 +37,19 @@ if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") endif() # Use most-recent available language dialects with GNU and Clang -if(NOT DEFINED CMAKE_C_STANDARD) +if(NOT DEFINED CMAKE_C_STANDARD AND NOT CMake_NO_C_STANDARD) set(CMAKE_C_STANDARD 11) endif() -if(NOT DEFINED CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) +if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD) + include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx14_cstdio.cmake) + if(NOT CMake_CXX14_CSTDIO_BROKEN) + set(CMAKE_CXX_STANDARD 14) + else() + set(CMAKE_CXX_STANDARD 11) + endif() +endif() +if(NOT CMake_TEST_EXTERNAL_CMAKE) + include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx11_unordered_map.cmake) endif() # option to set the internal encoding of CMake to UTF-8 @@ -543,10 +551,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}") # make sure CMAKE_INSTALL_PREFIX ends in / - string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN) - math(EXPR LEN "${LEN} -1" ) - string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH) - if(NOT "${ENDCH}" STREQUAL "/") + if(NOT CMAKE_INSTALL_PREFIX MATCHES "/$") set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/") endif() set(CMAKE_INSTALL_PREFIX diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index f499be1d9..7f20d1062 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -33,8 +33,11 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "warning .980: wrong number of actual arguments to intrinsic function .std::basic_" "LINK : warning LNK4089: all references to.*ADVAPI32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*PSAPI.DLL.*discarded by /OPT:REF" + "LINK : warning LNK4089: all references to.*RPCRT4.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*SHELL32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF" + "LINK : warning LNK4089: all references to.*ole32.dll.*discarded by /OPT:REF" + "Warning.*: .*/Utilities/KWIML/test/test_INT_format.h.* # Redundant preprocessing concatenation" "Warning: library was too large for page size.*" "Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*" "Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*" @@ -53,6 +56,9 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element" "cc-3968 CC: WARNING File.*" # "implicit" truncation by static_cast "ld: warning: directory not found for option .-(F|L)" + "ld: warning .*/libgcc.a archive's cputype" + "ld: warning: ignoring file .*/libgcc.a, file was built for archive which is not the architecture being linked" + "ld: warning: in .*/libgcc.a, file is not of required architecture" "warning.*This version of Mac OS X is unsupported" "clang.*: warning: argument unused during compilation: .-g" "note: in expansion of macro" # diagnostic context note @@ -62,6 +68,18 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION # Ignore clang's summary warning, assuming prior text has matched some # other warning expression: "[0-9,]+ warnings? generated." + +# scanbuild exceptions + "char_traits.h:.*: warning: Null pointer argument in call to string length function" + "stl_construct.h:.*: warning: Forming reference to null pointer" + ".*stl_uninitialized.h:75:19: warning: Forming reference to null pointer.*" + ".*stl_vector.h:.*: warning: Returning null reference.*" + "warning: Value stored to 'yymsg' is never read" + "warning: Value stored to 'yytoken' is never read" + "index_encoder.c.241.2. warning: Value stored to .out_start. is never read" + "index.c.*warning: Access to field.*results in a dereference of a null pointer.*loaded from variable.*" + "cm_sha2.*warning: Value stored to.*is never read" + "testProcess.*warning: Dereference of null pointer .loaded from variable .invalidAddress.." ) if(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode") diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 5889e9009..935832930 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -53,6 +53,10 @@ If NO_DEFAULT_PATH is not specified, the search process is as follows: .. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace:: /|XXX_SUBDIR| for each in CMAKE_PREFIX_PATH +.. |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR| replace:: + /|XXX_SUBDIR| for each /[s]bin in PATH, and + /|XXX_SUBDIR| for other entries in PATH + .. |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| replace:: /|XXX_SUBDIR| for each in CMAKE_SYSTEM_PREFIX_PATH diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index e646c567b..ecbf9ddc3 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -79,6 +79,9 @@ The options are: If ``COMMAND`` specifies an executable target (created by the :command:`add_executable` command) it will automatically be replaced by the location of the executable created at build time. + (Use the ``TARGET_FILE`` + :manual:`generator expression ` to + reference an executable later in the command line.) Additionally a target-level dependency will be added so that the executable target will be built before any target using this custom command. However this does NOT add a file-level dependency that diff --git a/Help/command/add_dependencies.rst b/Help/command/add_dependencies.rst index 10997ec20..7a6614328 100644 --- a/Help/command/add_dependencies.rst +++ b/Help/command/add_dependencies.rst @@ -7,13 +7,17 @@ Add a dependency between top-level targets. add_dependencies( []...) -Make a top-level depend on other top-level targets to ensure -that they build before does. A top-level target is one -created by ADD_EXECUTABLE, ADD_LIBRARY, or ADD_CUSTOM_TARGET. -Dependencies added to an IMPORTED target are followed transitively in -its place since the target itself does not build. +Make a top-level ```` depend on other top-level targets to +ensure that they build before ```` does. A top-level target +is one created by one of the :command:`add_executable`, +:command:`add_library`, or :command:`add_custom_target` commands +(but not targets generated by CMake like ``install``). -See the DEPENDS option of ADD_CUSTOM_TARGET and ADD_CUSTOM_COMMAND for -adding file-level dependencies in custom rules. See the -OBJECT_DEPENDS option in SET_SOURCE_FILES_PROPERTIES to add file-level -dependencies to object files. +Dependencies added to an :ref:`imported target ` +or an :ref:`interface library ` are followed +transitively in its place since the target itself does not build. + +See the ``DEPENDS`` option of :command:`add_custom_target` and +:command:`add_custom_command` commands for adding file-level +dependencies in custom rules. See the :prop_sf:`OBJECT_DEPENDS` +source file property to add file-level dependencies to object files. diff --git a/Help/command/build_command.rst b/Help/command/build_command.rst index 82a9a42b9..1298c1f8f 100644 --- a/Help/command/build_command.rst +++ b/Help/command/build_command.rst @@ -19,7 +19,8 @@ Sets the given ```` to a command-line string of the form:: where ```` is the location of the :manual:`cmake(1)` command-line tool, and ```` and ```` are the values provided to the ``CONFIGURATION`` and ``TARGET`` options, if any. The trailing ``-- -i`` -option is added for Makefile generators. +option is added for :ref:`Makefile Generators` if policy :policy:`CMP0061` +is not set to ``NEW``. When invoked, this ``cmake --build`` command line will launch the underlying build system tool. @@ -32,7 +33,7 @@ This second signature is deprecated, but still available for backwards compatibility. Use the first signature instead. It sets the given ```` to a command-line string as -above but without the ``--config`` or ``--target`` options. +above but without the ``--target`` option. The ```` is ignored but should be the full path to msdev, devenv, nmake, make or one of the end user build tools for legacy invocations. diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index 1bdffa46e..9865eeb75 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -28,3 +28,14 @@ which enables compatibility features for CMake 2.4 and lower. The FATAL_ERROR option is accepted but ignored by CMake 2.6 and higher. It should be specified so CMake versions 2.4 and lower fail with an error instead of just a warning. + +.. note:: + Call the ``cmake_minimum_required()`` command at the beginning of + the top-level ``CMakeLists.txt`` file even before calling the + :command:`project` command. It is important to establish version + and policy settings before invoking other commands whose behavior + they may affect. See also policy :policy:`CMP0000`. + + Calling ``cmake_minimum_required()`` inside a :command:`function` + limits some effects to the function scope when invoked. Such calls + should not be made with the intention of having global effects. diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst index 2bc32870f..b51b9512c 100644 --- a/Help/command/cmake_policy.rst +++ b/Help/command/cmake_policy.rst @@ -53,6 +53,8 @@ policy warning by setting the policy state to ``OLD``. Alternatively one may fix the project to work with the new behavior and set the policy state to ``NEW``. +.. include:: ../policy/DEPRECATED.txt + Checking Policy Settings ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/command/ctest_build.rst b/Help/command/ctest_build.rst index 4a95cdde7..e1b7793fc 100644 --- a/Help/command/ctest_build.rst +++ b/Help/command/ctest_build.rst @@ -1,29 +1,73 @@ ctest_build ----------- -Build the project. +Perform the :ref:`CTest Build Step` as a :ref:`Dashboard Client`. :: - ctest_build([BUILD build_dir] [TARGET target] [RETURN_VALUE res] - [APPEND][NUMBER_ERRORS val] [NUMBER_WARNINGS val]) + ctest_build([BUILD ] [APPEND] + [CONFIGURATION ] + [FLAGS ] + [PROJECT_NAME ] + [TARGET ] + [NUMBER_ERRORS ] + [NUMBER_WARNINGS ] + [RETURN_VALUE ] + ) -Builds the given build directory and stores results in Build.xml. If -no BUILD is given, the CTEST_BINARY_DIRECTORY variable is used. +Build the project and store results in ``Build.xml`` +for submission with the :command:`ctest_submit` command. -The TARGET variable can be used to specify a build target. If none is -specified, the "all" target will be built. +The :variable:`CTEST_BUILD_COMMAND` variable may be set to explicitly +specify the build command line. Otherwise the build command line is +computed automatically based on the options given. -The RETURN_VALUE option specifies a variable in which to store the -return value of the native build tool. The NUMBER_ERRORS and -NUMBER_WARNINGS options specify variables in which to store the number -of build errors and warnings detected. +The options are: -The APPEND option marks results for append to those previously -submitted to a dashboard server since the last ctest_start. Append -semantics are defined by the dashboard server in use. +``BUILD `` + Specify the top-level build directory. If not given, the + :variable:`CTEST_BINARY_DIRECTORY` variable is used. -If set, the contents of the variable CTEST_BUILD_FLAGS are passed as -additional arguments to the underlying build command. This can e.g. be -used to trigger a parallel build using the -j option of make. See -:module:`ProcessorCount` for an example. +``APPEND`` + Mark results for append to those previously submitted to a + dashboard server since the last :command:`ctest_start` call. + Append semantics are defined by the dashboard server in use. + +``CONFIGURATION `` + Specify the build configuration (e.g. ``Debug``). If not + specified the ``CTEST_BUILD_CONFIGURATION`` variable will be checked. + Otherwise the ``-C `` option given to the :manual:`ctest(1)` + command will be used, if any. + +``FLAGS `` + Pass additional arguments to the underlying build command. + If not specified the ``CTEST_BUILD_FLAGS`` variable will be checked. + This can, e.g., be used to trigger a parallel build using the + ``-j`` option of make. See the :module:`ProcessorCount` module + for an example. + +``PROJECT_NAME `` + Set the name of the project to build. This should correspond + to the top-level call to the :command:`project` command. + If not specified the ``CTEST_PROJECT_NAME`` variable will be checked. + +``TARGET `` + Specify the name of a target to build. If not specified the + ``CTEST_BUILD_TARGET`` variable will be checked. Otherwise the + default target will be built. This is the "all" target + (called ``ALL_BUILD`` in :ref:`Visual Studio Generators`). + +``NUMBER_ERRORS `` + Store the number of build errors detected in the given variable. + +``NUMBER_WARNINGS `` + Store the number of build warnings detected in the given variable. + +``RETURN_VALUE `` + Store the return value of the native build tool in the given variable. + +``QUIET`` + Suppress any CTest-specific non-error output that would have been + printed to the console otherwise. The summary of warnings / errors, + as well as the output from the native build tool is unaffected by + this option. diff --git a/Help/command/ctest_configure.rst b/Help/command/ctest_configure.rst index 2c4e305ff..851c29292 100644 --- a/Help/command/ctest_configure.rst +++ b/Help/command/ctest_configure.rst @@ -1,21 +1,39 @@ ctest_configure --------------- -Configure the project build tree. +Perform the :ref:`CTest Configure Step` as a :ref:`Dashboard Client`. :: - ctest_configure([BUILD build_dir] [SOURCE source_dir] [APPEND] - [OPTIONS options] [RETURN_VALUE res]) + ctest_configure([BUILD ] [SOURCE ] [APPEND] + [OPTIONS ] [RETURN_VALUE ] [QUIET]) -Configures the given build directory and stores results in -Configure.xml. If no BUILD is given, the CTEST_BINARY_DIRECTORY -variable is used. If no SOURCE is given, the CTEST_SOURCE_DIRECTORY -variable is used. The OPTIONS argument specifies command line -arguments to pass to the configuration tool. The RETURN_VALUE option -specifies a variable in which to store the return value of the native -build tool. +Configure the project build tree and record results in ``Configure.xml`` +for submission with the :command:`ctest_submit` command. -The APPEND option marks results for append to those previously -submitted to a dashboard server since the last ctest_start. Append -semantics are defined by the dashboard server in use. +The options are: + +``BUILD `` + Specify the top-level build directory. If not given, the + :variable:`CTEST_BINARY_DIRECTORY` variable is used. + +``SOURCE `` + Specify the source directory. If not given, the + :variable:`CTEST_SOURCE_DIRECTORY` variable is used. + +``APPEND`` + Mark results for append to those previously submitted to a + dashboard server since the last :command:`ctest_start` call. + Append semantics are defined by the dashboard server in use. + +``OPTIONS `` + Specify command-line arguments to pass to the configuration tool. + +``RETURN_VALUE `` + Store in the ```` variable the return value of the native + configuration tool. + +``QUIET`` + Suppress any CTest-specific non-error messages that would have + otherwise been printed to the console. Output from the underlying + configure command is not affected. diff --git a/Help/command/ctest_coverage.rst b/Help/command/ctest_coverage.rst index 4c90f9c01..12429b99d 100644 --- a/Help/command/ctest_coverage.rst +++ b/Help/command/ctest_coverage.rst @@ -1,20 +1,39 @@ ctest_coverage -------------- -Collect coverage tool results. +Perform the :ref:`CTest Coverage Step` as a :ref:`Dashboard Client`. :: - ctest_coverage([BUILD build_dir] [RETURN_VALUE res] [APPEND] - [LABELS label1 [label2 [...]]]) + ctest_coverage([BUILD ] [APPEND] + [LABELS