summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/add_link_options.rst17
-rw-r--r--Help/command/ctest_update.rst3
-rw-r--r--Help/command/project.rst15
-rw-r--r--Help/command/target_link_options.rst24
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/manual/ctest.1.rst14
-rw-r--r--Help/release/dev/ctest_update_version_override.rst7
-rw-r--r--Help/variable/CTEST_UPDATE_VERSION_ONLY.rst2
-rw-r--r--Help/variable/CTEST_UPDATE_VERSION_OVERRIDE.rst5
-rw-r--r--Modules/CTestCoverageCollectGCOV.cmake40
-rw-r--r--Modules/FindBLAS.cmake3
-rw-r--r--Modules/FindMPI.cmake45
-rw-r--r--Modules/FindMPI/libver_mpi.c1
-rw-r--r--Modules/FindMPI/test_mpi.c1
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestGlobalVC.cxx5
-rw-r--r--Source/CTest/cmCTestGlobalVC.h2
-rw-r--r--Source/CTest/cmCTestUpdateCommand.cxx3
-rw-r--r--Source/CTest/cmCTestVC.cxx14
-rw-r--r--Source/CTest/cmCTestVC.h1
-rw-r--r--Source/cmMakefile.cxx10
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx14
-rw-r--r--Tests/CTestCoverageCollectGCOV/fakegcov.cmake21
-rw-r--r--Tests/RunCMake/ctest_update/RunCMakeTest.cmake16
-rw-r--r--Tests/RunCMake/ctest_update/UpdateActualVersion-check.cmake12
-rw-r--r--Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake2
-rw-r--r--Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt12
27 files changed, 212 insertions, 80 deletions
diff --git a/Help/command/add_link_options.rst b/Help/command/add_link_options.rst
index 1b02bee..a83005b 100644
--- a/Help/command/add_link_options.rst
+++ b/Help/command/add_link_options.rst
@@ -1,20 +1,25 @@
add_link_options
----------------
-Add options to the link of shared library, module and executable targets.
+Add options to the link step for executable, shared library or module
+library targets in the current directory and below that are added after
+this command is invoked.
.. code-block:: cmake
add_link_options(<option> ...)
-Adds options to the link step for targets in the current directory and below
-that are added after this command is invoked. See documentation of the
+This command can be used to add any link options, but alternative commands
+exist to add libraries (:command:`target_link_libraries` or
+:command:`link_libraries`). See documentation of the
:prop_dir:`directory <LINK_OPTIONS>` and
:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
-This command can be used to add any options, but alternative commands
-exist to add libraries (:command:`target_link_libraries` or
-:command:`link_libraries`).
+.. note::
+
+ This command cannot be used to add options for static library targets,
+ since they do not use a linker. To add archiver or MSVC librarian flags,
+ see the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property.
Arguments to ``add_link_options`` may use "generator expressions" with
the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
diff --git a/Help/command/ctest_update.rst b/Help/command/ctest_update.rst
index df1a4e5..96a11c9 100644
--- a/Help/command/ctest_update.rst
+++ b/Help/command/ctest_update.rst
@@ -35,4 +35,5 @@ The options are:
The update always follows the version control branch currently checked
out in the source directory. See the :ref:`CTest Update Step`
-documentation for more information.
+documentation for information about variables that change the behavior
+of ``ctest_update()``.
diff --git a/Help/command/project.rst b/Help/command/project.rst
index 7e33ccd..41e1112 100644
--- a/Help/command/project.rst
+++ b/Help/command/project.rst
@@ -112,12 +112,13 @@ Usage
The top-level ``CMakeLists.txt`` file for a project must contain a
literal, direct call to the :command:`project` command; loading one
through the :command:`include` command is not sufficient. If no such
-call exists CMake will implicitly add one to the top that enables the
-default languages (``C`` and ``CXX``).
+call exists, CMake will issue a warning and pretend there is a
+``project(Project)`` at the top to enable the default languages
+(``C`` and ``CXX``).
.. note::
- Call the :command:`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`.
+ Call the :command:`project()` command near the top of the top-level
+ ``CMakeLists.txt``, but *after* calling :command:`cmake_minimum_required`.
+ It is important to establish version and policy settings before invoking
+ other commands whose behavior they may affect.
+ See also policy :policy:`CMP0000`.
diff --git a/Help/command/target_link_options.rst b/Help/command/target_link_options.rst
index 285455a..b5abbc4 100644
--- a/Help/command/target_link_options.rst
+++ b/Help/command/target_link_options.rst
@@ -1,7 +1,8 @@
target_link_options
-------------------
-Add link options to a target.
+Add options to the link step for an executable, shared library or module
+library target.
.. code-block:: cmake
@@ -9,20 +10,25 @@ Add link options to a target.
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
-Specifies link options to use when linking a given target. The
-named ``<target>`` must have been created by a command such as
+The named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be an
:ref:`ALIAS target <Alias Targets>`.
+This command can be used to add any link options, but alternative commands
+exist to add libraries (:command:`target_link_libraries` or
+:command:`link_libraries`). See documentation of the
+:prop_dir:`directory <LINK_OPTIONS>` and
+:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
+
+.. note::
+
+ This command cannot be used to add options for static library targets,
+ since they do not use a linker. To add archiver or MSVC librarian flags,
+ see the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property.
+
If ``BEFORE`` is specified, the content will be prepended to the property
instead of being appended.
-This command can be used to add any options, but
-alternative commands exist to add libraries
-(:command:`target_link_libraries` and :command:`link_libraries`).
-See documentation of the :prop_dir:`directory <LINK_OPTIONS>` and
-:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
-
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC``
items will populate the :prop_tgt:`LINK_OPTIONS` property of
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 6d93ae9..86dc186 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -583,6 +583,7 @@ Variables for CTest
/variable/CTEST_UPDATE_COMMAND
/variable/CTEST_UPDATE_OPTIONS
/variable/CTEST_UPDATE_VERSION_ONLY
+ /variable/CTEST_UPDATE_VERSION_OVERRIDE
/variable/CTEST_USE_LAUNCHERS
Variables for CPack
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index 5a6b329..5773176 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -822,6 +822,8 @@ Configuration settings to specify the version control tool include:
* :module:`CTest` module variable: ``UPDATE_TYPE`` if set,
else ``CTEST_UPDATE_TYPE``
+.. _`UpdateVersionOnly`:
+
``UpdateVersionOnly``
Specify that you want the version control update command to only
discover the current version that is checked out, and not to update
@@ -829,6 +831,18 @@ Configuration settings to specify the version control tool include:
* `CTest Script`_ variable: :variable:`CTEST_UPDATE_VERSION_ONLY`
+.. _`UpdateVersionOverride`:
+
+``UpdateVersionOverride``
+ Specify the current version of your source tree.
+
+ When this variable is set to a non-empty string, CTest will report the value
+ you specified rather than using the update command to discover the current
+ version that is checked out. Use of this variable supersedes
+ ``UpdateVersionOnly``. Like ``UpdateVersionOnly``, using this variable tells
+ CTest not to update the source tree to a different version.
+
+ * `CTest Script`_ variable: :variable:`CTEST_UPDATE_VERSION_OVERRIDE`
Additional configuration settings include:
diff --git a/Help/release/dev/ctest_update_version_override.rst b/Help/release/dev/ctest_update_version_override.rst
new file mode 100644
index 0000000..03b47db
--- /dev/null
+++ b/Help/release/dev/ctest_update_version_override.rst
@@ -0,0 +1,7 @@
+CTEST_UPDATE_VERSION_OVERRIDE
+-----------------------------
+
+* The :command:`ctest_update` command learned to honor a new variable:
+ :variable:`CTEST_UPDATE_VERSION_OVERRIDE`. This can be used to specify
+ the current version of your source tree rather than using the update
+ command to discover the current version that is checked out.
diff --git a/Help/variable/CTEST_UPDATE_VERSION_ONLY.rst b/Help/variable/CTEST_UPDATE_VERSION_ONLY.rst
index e646e6e..a862baa 100644
--- a/Help/variable/CTEST_UPDATE_VERSION_ONLY.rst
+++ b/Help/variable/CTEST_UPDATE_VERSION_ONLY.rst
@@ -1,5 +1,5 @@
CTEST_UPDATE_VERSION_ONLY
-------------------------
-Specify the CTest ``UpdateVersionOnly`` setting
+Specify the CTest :ref:`UpdateVersionOnly <UpdateVersionOnly>` setting
in a :manual:`ctest(1)` dashboard client script.
diff --git a/Help/variable/CTEST_UPDATE_VERSION_OVERRIDE.rst b/Help/variable/CTEST_UPDATE_VERSION_OVERRIDE.rst
new file mode 100644
index 0000000..39fbaba
--- /dev/null
+++ b/Help/variable/CTEST_UPDATE_VERSION_OVERRIDE.rst
@@ -0,0 +1,5 @@
+CTEST_UPDATE_VERSION_OVERRIDE
+-----------------------------
+
+Specify the CTest :ref:`UpdateVersionOverride <UpdateVersionOverride>` setting
+in a :manual:`ctest(1)` dashboard client script.
diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index 2258271..655827a 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -52,7 +52,7 @@ After generating this tar file, it can be sent to CDash for display with the
``GCOV_OPTIONS <options>...``
Specify options to be passed to gcov. The ``gcov`` command
is run as ``gcov <options>... -o <gcov-dir> <file>.gcda``.
- If not specified, the default option is just ``-b``.
+ If not specified, the default option is just ``-b -x``.
``GLOB``
Recursively search for .gcda files in build_dir rather than
@@ -95,7 +95,7 @@ function(ctest_coverage_collect_gcov)
set(gcda_files)
set(label_files)
if (GCOV_GLOB)
- file(GLOB_RECURSE gfiles RELATIVE ${binary_dir} "${binary_dir}/*.gcda")
+ file(GLOB_RECURSE gfiles "${binary_dir}/*.gcda")
list(LENGTH gfiles len)
# if we have gcda files then also grab the labels file for that target
if(${len} GREATER 0)
@@ -109,7 +109,7 @@ function(ctest_coverage_collect_gcov)
file(STRINGS "${binary_dir}/CMakeFiles/TargetDirectories.txt" target_dirs
ENCODING UTF-8)
foreach(target_dir ${target_dirs})
- file(GLOB_RECURSE gfiles RELATIVE ${binary_dir} "${target_dir}/*.gcda")
+ file(GLOB_RECURSE gfiles "${target_dir}/*.gcda")
list(LENGTH gfiles len)
# if we have gcda files then also grab the labels file for that target
if(${len} GREATER 0)
@@ -132,27 +132,21 @@ function(ctest_coverage_collect_gcov)
# setup the dir for the coverage files
set(coverage_dir "${binary_dir}/Testing/CoverageInfo")
file(MAKE_DIRECTORY "${coverage_dir}")
- # call gcov on each .gcda file
- foreach (gcda_file ${gcda_files})
- # get the directory of the gcda file
- get_filename_component(gcda_file ${binary_dir}/${gcda_file} ABSOLUTE)
- get_filename_component(gcov_dir ${gcda_file} DIRECTORY)
- # run gcov, this will produce the .gcov file in the current
- # working directory
- if(NOT DEFINED GCOV_GCOV_OPTIONS)
- set(GCOV_GCOV_OPTIONS -b)
- endif()
- execute_process(COMMAND
- ${gcov_command} ${GCOV_GCOV_OPTIONS} -o ${gcov_dir} ${gcda_file}
- OUTPUT_VARIABLE out
- RESULT_VARIABLE res
- WORKING_DIRECTORY ${coverage_dir})
-
- if (GCOV_DELETE)
- file(REMOVE ${gcda_file})
- endif()
+ # run gcov, this will produce the .gcov files in the current
+ # working directory
+ if(NOT DEFINED GCOV_GCOV_OPTIONS)
+ set(GCOV_GCOV_OPTIONS -b -x)
+ endif()
+ execute_process(COMMAND
+ ${gcov_command} ${GCOV_GCOV_OPTIONS} ${gcda_files}
+ OUTPUT_VARIABLE out
+ RESULT_VARIABLE res
+ WORKING_DIRECTORY ${coverage_dir})
+
+ if (GCOV_DELETE)
+ file(REMOVE ${gcda_files})
+ endif()
- endforeach()
if(NOT "${res}" EQUAL 0)
if (NOT GCOV_QUIET)
message(STATUS "Error running gcov: ${res} ${out}")
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 77e689f..8d55ac7 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -239,7 +239,8 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
set(BLAS_mkl_DLL_SUFFIX "_dll")
endif()
else()
- if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
+ # Switch to GNU Fortran support layer if needed (but not on Apple, where MKL does not provide it)
+ if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT APPLE)
set(BLAS_mkl_INTFACE "gf")
set(BLAS_mkl_THREADING "gnu")
set(BLAS_mkl_OMP "gomp")
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 5288640..fe09764 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -216,7 +216,7 @@ If the following variables are set to true, the respective search will be perfor
and ``MPI_Fortran_<binding>_ASYNCPROT``, where ``<binding>`` is one of ``F77_HEADER``, ``F90_MODULE`` and
``F08_MODULE``.
``MPI_DETERMINE_LIBRARY_VERSION``
- For each language, find the output of ``MPI_Get_library_version`` and make it available as ``MPI_<lang>_LIBRARY_VERSION``.
+ For each language, find the output of ``MPI_Get_library_version`` and make it available as ``MPI_<lang>_LIBRARY_VERSION_STRING``.
This information is usually tied to the runtime component of an MPI implementation and might differ depending on ``<lang>``.
Note that the return value is entirely implementation defined. This information might be used to identify
the MPI vendor and for example pick the correct one of multiple third party binaries that matches the MPI vendor.
@@ -1155,7 +1155,7 @@ macro(_MPI_create_imported_target LANG)
set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MPI_${LANG}_INCLUDE_DIRS}")
endmacro()
-function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY)
+function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY SUPPRESS_ERRORS)
set(WORK_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI")
set(SRC_DIR "${CMAKE_ROOT}/Modules/FindMPI")
set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindMPI/${MPI_TEST_FILE_NAME}_${LANG}.bin")
@@ -1184,18 +1184,29 @@ function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY)
"${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}"
COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS}
LINK_LIBRARIES MPI::MPI_${LANG}
- RUN_OUTPUT_VARIABLE MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE})
+ RUN_OUTPUT_VARIABLE MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}
+ COMPILE_OUTPUT_VARIABLE _MPI_TRY_${MPI_TEST_FILE_NAME}_${MODE}_OUTPUT)
set(MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} "${MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}}" PARENT_SCOPE)
else()
try_compile(MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}
"${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}"
COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS}
LINK_LIBRARIES MPI::MPI_${LANG}
- COPY_FILE "${BIN_FILE}")
+ COPY_FILE "${BIN_FILE}"
+ OUTPUT_VARIABLE _MPI_TRY_${MPI_TEST_FILE_NAME}_${MODE}_OUTPUT)
+ endif()
+ if(NOT SUPPRESS_ERRORS)
+ if(NOT MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE})
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "The MPI test ${MPI_TEST_FILE_NAME} for ${LANG} in mode ${MODE} failed to compile with the following output:\n${_MPI_TRY_${MPI_TEST_FILE_NAME}_${MODE}_OUTPUT}\n\n")
+ elseif(DEFINED MPI_RUN_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} AND MPI_RUN_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE})
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "The MPI test ${MPI_TEST_FILE_NAME} for ${LANG} in mode ${MODE} failed to run with the following output:\n${MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}}\n\n")
+ endif()
endif()
endfunction()
-macro(_MPI_check_lang_works LANG)
+macro(_MPI_check_lang_works LANG SUPPRESS_ERRORS)
# For Fortran we may have by the MPI-3 standard an implementation that provides:
# - the mpi_f08 module
# - *both*, the mpi module and 'mpif.h'
@@ -1203,9 +1214,9 @@ macro(_MPI_check_lang_works LANG)
if( NOT MPI_${LANG}_WORKS )
if("${LANG}" STREQUAL "Fortran")
set(MPI_Fortran_INTEGER_LINE "(kind=MPI_INTEGER_KIND)")
- _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER FALSE)
- _MPI_try_staged_settings(${LANG} test_mpi F90_MODULE FALSE)
- _MPI_try_staged_settings(${LANG} test_mpi F08_MODULE FALSE)
+ _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER FALSE ${SUPPRESS_ERRORS})
+ _MPI_try_staged_settings(${LANG} test_mpi F90_MODULE FALSE ${SUPPRESS_ERRORS})
+ _MPI_try_staged_settings(${LANG} test_mpi F08_MODULE FALSE ${SUPPRESS_ERRORS})
set(MPI_${LANG}_WORKS FALSE)
@@ -1221,14 +1232,14 @@ macro(_MPI_check_lang_works LANG)
# However, MPI-1 also did not define the Fortran 90 and 08 modules, so we only try the F77 header.
unset(MPI_Fortran_INTEGER_LINE)
if(NOT MPI_${LANG}_WORKS)
- _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER_NOKIND FALSE)
+ _MPI_try_staged_settings(${LANG} test_mpi F77_HEADER_NOKIND FALSE ${SUPPRESS_ERRORS})
if(MPI_RESULT_${LANG}_test_mpi_F77_HEADER_NOKIND)
set(MPI_${LANG}_WORKS TRUE)
set(MPI_${LANG}_HAVE_F77_HEADER TRUE)
endif()
endif()
else()
- _MPI_try_staged_settings(${LANG} test_mpi normal FALSE)
+ _MPI_try_staged_settings(${LANG} test_mpi normal FALSE ${SUPPRESS_ERRORS})
# If 'test_mpi' built correctly, we've found valid MPI settings. There might not be MPI-2 C++ support, but there can't
# be MPI-2 C++ support without the C bindings being present, so checking for them is sufficient.
set(MPI_${LANG}_WORKS "${MPI_RESULT_${LANG}_test_mpi_normal}")
@@ -1390,7 +1401,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
# Should the imported targets be empty, we effectively try whether the compiler supports MPI on its own, which is the case on e.g.
# Cray PrgEnv.
_MPI_create_imported_target(${LANG})
- _MPI_check_lang_works(${LANG})
+ _MPI_check_lang_works(${LANG} TRUE)
# If the compiler can build MPI code on its own, it functions as an MPI compiler and we'll set the variable to point to it.
if(MPI_${LANG}_WORKS)
@@ -1442,7 +1453,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
# If we haven't made the implicit compiler test yet, perform it now.
if(NOT MPI_${LANG}_TRIED_IMPLICIT)
_MPI_create_imported_target(${LANG})
- _MPI_check_lang_works(${LANG})
+ _MPI_check_lang_works(${LANG} TRUE)
endif()
# Should the MPI compiler not work implicitly for MPI, still interrogate it.
@@ -1488,7 +1499,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
_MPI_create_imported_target(${LANG})
if(NOT MPI_${LANG}_WORKS)
- _MPI_check_lang_works(${LANG})
+ _MPI_check_lang_works(${LANG} FALSE)
endif()
# Next, we'll initialize the MPI variables that have not been previously set.
@@ -1507,7 +1518,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
if(MPI_${LANG}_WORKS)
if("${LANG}" STREQUAL "CXX" AND NOT DEFINED MPI_MPICXX_FOUND)
if(NOT MPI_CXX_SKIP_MPICXX AND NOT MPI_CXX_VALIDATE_SKIP_MPICXX)
- _MPI_try_staged_settings(${LANG} test_mpi MPICXX FALSE)
+ _MPI_try_staged_settings(${LANG} test_mpi MPICXX FALSE FALSE)
if(MPI_RESULT_${LANG}_test_mpi_MPICXX)
set(MPI_MPICXX_FOUND TRUE)
else()
@@ -1542,7 +1553,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
# and MPI_SUBVERSION are provided. These defines did not exist in MPI 1.0 and 1.1 and therefore might not
# exist. For C/C++, test_mpi.c will handle the MPI_VERSION extraction, but for Fortran, we need mpiver.f90.
if(NOT DEFINED MPI_${LANG}_VERSION)
- _MPI_try_staged_settings(${LANG} mpiver ${MPI_${LANG}_HIGHEST_METHOD} FALSE)
+ _MPI_try_staged_settings(${LANG} mpiver ${MPI_${LANG}_HIGHEST_METHOD} FALSE FALSE)
if(MPI_RESULT_${LANG}_mpiver_${MPI_${LANG}_HIGHEST_METHOD})
file(STRINGS ${MPI_BIN_FOLDER}/mpiver_${LANG}.bin _MPI_VERSION_STRING LIMIT_COUNT 1 REGEX "INFO:MPI-VER")
if("${_MPI_VERSION_STRING}" MATCHES ".*INFO:MPI-VER\\[([0-9]+)\\.([0-9]+)\\].*")
@@ -1561,7 +1572,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
if(MPI_${LANG}_HAVE_${mpimethod})
set(MPI_${LANG}_${mpimethod}_SUBARRAYS FALSE)
set(MPI_${LANG}_${mpimethod}_ASYNCPROT FALSE)
- _MPI_try_staged_settings(${LANG} fortranparam_mpi ${mpimethod} TRUE)
+ _MPI_try_staged_settings(${LANG} fortranparam_mpi ${mpimethod} TRUE FALSE)
if(MPI_RESULT_${LANG}_fortranparam_mpi_${mpimethod} AND
NOT "${MPI_RUN_RESULT_${LANG}_fortranparam_mpi_${mpimethod}}" STREQUAL "FAILED_TO_RUN")
if("${MPI_RUN_OUTPUT_${LANG}_fortranparam_mpi_${mpimethod}}" MATCHES
@@ -1602,7 +1613,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
# It's also worth noting that the installed version string can depend on the language, or on the system the binary
# runs on if MPI is not statically linked.
if(MPI_DETERMINE_LIBRARY_VERSION AND NOT MPI_${LANG}_LIBRARY_VERSION_STRING)
- _MPI_try_staged_settings(${LANG} libver_mpi ${MPI_${LANG}_HIGHEST_METHOD} TRUE)
+ _MPI_try_staged_settings(${LANG} libver_mpi ${MPI_${LANG}_HIGHEST_METHOD} TRUE FALSE)
if(MPI_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD} AND
"${MPI_RUN_RESULT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}" EQUAL "0")
string(STRIP "${MPI_RUN_OUTPUT_${LANG}_libver_mpi_${MPI_${LANG}_HIGHEST_METHOD}}"
diff --git a/Modules/FindMPI/libver_mpi.c b/Modules/FindMPI/libver_mpi.c
index 18d4a60..d89328a 100644
--- a/Modules/FindMPI/libver_mpi.c
+++ b/Modules/FindMPI/libver_mpi.c
@@ -16,4 +16,5 @@ int main(int argc, char* argv[])
#else
puts(mpilibver_str);
#endif
+ return 0;
}
diff --git a/Modules/FindMPI/test_mpi.c b/Modules/FindMPI/test_mpi.c
index 05cec89..7c96d54 100644
--- a/Modules/FindMPI/test_mpi.c
+++ b/Modules/FindMPI/test_mpi.c
@@ -34,4 +34,5 @@ int main(int argc, char* argv[])
MPI_Init(&argc, &argv);
MPI_Finalize();
#endif
+ return 0;
}
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 6bedd4e..503bd6e 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 14)
-set(CMake_VERSION_PATCH 20190506)
+set(CMake_VERSION_PATCH 20190508)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx
index a2d4d2c..54ebd4f 100644
--- a/Source/CTest/cmCTestGlobalVC.cxx
+++ b/Source/CTest/cmCTestGlobalVC.cxx
@@ -117,3 +117,8 @@ bool cmCTestGlobalVC::WriteXMLUpdates(cmXMLWriter& xml)
return result;
}
+
+void cmCTestGlobalVC::SetNewRevision(std::string const& revision)
+{
+ this->NewRevision = revision;
+}
diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h
index 76377ed..9c57215 100644
--- a/Source/CTest/cmCTestGlobalVC.h
+++ b/Source/CTest/cmCTestGlobalVC.h
@@ -32,6 +32,8 @@ protected:
// Implement cmCTestVC internal API.
bool WriteXMLUpdates(cmXMLWriter& xml) override;
+ void SetNewRevision(std::string const& revision) override;
+
/** Represent a vcs-reported action for one path in a revision. */
struct Change
{
diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx
index a2f1462..65dc921 100644
--- a/Source/CTest/cmCTestUpdateCommand.cxx
+++ b/Source/CTest/cmCTestUpdateCommand.cxx
@@ -62,6 +62,9 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
this->Makefile, "UpdateVersionOnly", "CTEST_UPDATE_VERSION_ONLY",
this->Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
+ this->Makefile, "UpdateVersionOverride", "CTEST_UPDATE_VERSION_OVERRIDE",
+ this->Quiet);
+ this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "HGCommand", "CTEST_HG_COMMAND", this->Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS", this->Quiet);
diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx
index 374e73f..eea41cf 100644
--- a/Source/CTest/cmCTestVC.cxx
+++ b/Source/CTest/cmCTestVC.cxx
@@ -141,6 +141,15 @@ void cmCTestVC::CleanupImpl()
bool cmCTestVC::Update()
{
bool result = true;
+
+ // Use the explicitly specified version.
+ std::string versionOverride =
+ this->CTest->GetCTestConfiguration("UpdateVersionOverride");
+ if (!versionOverride.empty()) {
+ this->SetNewRevision(versionOverride);
+ return true;
+ }
+
// if update version only is on then do not actually update,
// just note the current version and finish
if (!cmSystemTools::IsOn(
@@ -166,6 +175,11 @@ bool cmCTestVC::NoteNewRevision()
return true;
}
+void cmCTestVC::SetNewRevision(std::string const& /*unused*/)
+{
+ // We do nothing by default.
+}
+
bool cmCTestVC::UpdateImpl()
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h
index 69a3bf0..2a4765d 100644
--- a/Source/CTest/cmCTestVC.h
+++ b/Source/CTest/cmCTestVC.h
@@ -70,6 +70,7 @@ protected:
virtual bool NoteOldRevision();
virtual bool UpdateImpl();
virtual bool NoteNewRevision();
+ virtual void SetNewRevision(std::string const& revision);
virtual bool WriteXMLUpdates(cmXMLWriter& xml);
#if defined(__SUNPRO_CC) && __SUNPRO_CC <= 0x510
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3832427..6c390f7 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1599,6 +1599,16 @@ void cmMakefile::Configure()
}
// if no project command is found, add one
if (!hasProject) {
+ this->GetCMakeInstance()->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ "No project() command is present. The top-level CMakeLists.txt "
+ "file must contain a literal, direct call to the project() command. "
+ "Add a line of code such as\n"
+ " project(ProjectName)\n"
+ "near the top of the file, but after cmake_minimum_required().\n"
+ "CMake is pretending there is a \"project(Project)\" command on "
+ "the first line.",
+ this->Backtrace);
cmListFileFunction project;
project.Name.Lower = "project";
project.Arguments.emplace_back("Project", cmListFileArgument::Unquoted,
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index af47fa7..ebb7c15 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -535,6 +535,20 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
std::string const& linkCmd = mf->GetRequiredDefinition(linkCmdVar);
cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
}
+#ifdef __APPLE__
+ // On macOS ranlib truncates the fractional part of the static archive
+ // file modification time. If the archive and at least one contained
+ // object file were created within the same second this will make look
+ // the archive older than the object file. On subsequent ninja runs this
+ // leads to re-achiving and updating dependent targets.
+ // As a work-around we touch the archive after ranlib (see #19222).
+ {
+ std::string cmakeCommand =
+ this->GetLocalGenerator()->ConvertToOutputFormat(
+ cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
+ linkCmds.push_back(cmakeCommand + " -E touch $TARGET_FILE");
+ }
+#endif
return linkCmds;
}
case cmStateEnums::SHARED_LIBRARY:
diff --git a/Tests/CTestCoverageCollectGCOV/fakegcov.cmake b/Tests/CTestCoverageCollectGCOV/fakegcov.cmake
index b0c3a9b..6df4292 100644
--- a/Tests/CTestCoverageCollectGCOV/fakegcov.cmake
+++ b/Tests/CTestCoverageCollectGCOV/fakegcov.cmake
@@ -1,14 +1,17 @@
+function(create_gcov_file gcda_full_path)
+ get_filename_component(gcda_name ${gcda_full_path} NAME)
+ string(REPLACE ".gcda" ".gcov" gcov_name "${gcda_name}")
+
+ file(STRINGS "${gcda_full_path}" source_file LIMIT_COUNT 1 ENCODING UTF-8)
+
+ file(WRITE "${CMAKE_SOURCE_DIR}/${gcov_name}"
+ " -: 0:Source:${source_file}"
+ )
+endfunction()
+
foreach(I RANGE 0 ${CMAKE_ARGC})
if("${CMAKE_ARGV${I}}" MATCHES ".*\\.gcda")
set(gcda_file "${CMAKE_ARGV${I}}")
+ create_gcov_file(${gcda_file})
endif()
endforeach()
-
-get_filename_component(gcda_name ${gcda_file} NAME)
-string(REPLACE ".gcda" ".gcov" gcov_name "${gcda_name}")
-
-file(STRINGS "${gcda_file}" source_file LIMIT_COUNT 1 ENCODING UTF-8)
-
-file(WRITE "${CMAKE_SOURCE_DIR}/${gcov_name}"
- " -: 0:Source:${source_file}"
-)
diff --git a/Tests/RunCMake/ctest_update/RunCMakeTest.cmake b/Tests/RunCMake/ctest_update/RunCMakeTest.cmake
index 0e1748f..f8d7665 100644
--- a/Tests/RunCMake/ctest_update/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_update/RunCMakeTest.cmake
@@ -5,13 +5,21 @@ function(run_ctest_update CASE_NAME)
run_ctest(${CASE_NAME})
endfunction()
-run_ctest_update(TestQuiet QUIET)
+run_ctest_update(UpdateQuiet QUIET)
-function(run_TestChangeId)
+function(run_UpdateChangeId)
set(CASE_TEST_PREFIX_CODE [[
set(CTEST_CHANGE_ID "<>1")
]])
- run_ctest(TestChangeId)
+ run_ctest(UpdateChangeId)
endfunction()
-run_TestChangeId()
+run_UpdateChangeId()
+
+function(run_UpdateVersionOverride)
+ set(CASE_TEST_PREFIX_CODE [[
+ set(CTEST_UPDATE_VERSION_OVERRIDE "qwertyuiop")
+ ]])
+ run_ctest(UpdateVersionOverride)
+endfunction()
+run_UpdateVersionOverride()
diff --git a/Tests/RunCMake/ctest_update/UpdateActualVersion-check.cmake b/Tests/RunCMake/ctest_update/UpdateActualVersion-check.cmake
new file mode 100644
index 0000000..12bd5a0
--- /dev/null
+++ b/Tests/RunCMake/ctest_update/UpdateActualVersion-check.cmake
@@ -0,0 +1,12 @@
+file(GLOB update_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Update.xml")
+if(update_xml_file)
+ file(READ "${update_xml_file}" update_xml LIMIT 4096)
+ if(NOT update_xml MATCHES "qwertyuiop")
+ string(REPLACE "\n" "\n " update_xml " ${update_xml}")
+ set(RunCMake_TEST_FAILED
+ "Did not find 'qwertyuiop' in Update.xml:\n${update_xml}"
+ )
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "Update.xml not found")
+endif()
diff --git a/Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake b/Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake
index 9269fbc..382fbec 100644
--- a/Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake
+++ b/Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake
@@ -1,7 +1,7 @@
file(GLOB update_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Update.xml")
if(update_xml_file)
file(READ "${update_xml_file}" update_xml LIMIT 4096)
- if(NOT update_xml MATCHES [[ChangeId="&lt;&gt;1"]])
+ if(NOT update_xml MATCHES [[ChangeId>&lt;&gt;1]])
string(REPLACE "\n" "\n " update_xml " ${update_xml}")
set(RunCMake_TEST_FAILED
"Update.xml does not have expected ChangeId:\n${update_xml}"
diff --git a/Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt b/Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt
new file mode 100644
index 0000000..fc1a02b
--- /dev/null
+++ b/Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Warning \(dev\) in CMakeLists.txt:
+ No project\(\) command is present. The top-level CMakeLists.txt file must
+ contain a literal, direct call to the project\(\) command. Add a line of
+ code such as
+
+ project\(ProjectName\)
+
+ near the top of the file, but after cmake_minimum_required\(\).
+
+ CMake is pretending there is a "project\(Project\)" command on the first
+ line.
+This warning is for project developers. Use -Wno-dev to suppress it.$