This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via fa077acba51393030586aa50f5eff9d6034c5c11 (commit) via be132dc6a6b5a979bdd115880911296e50c961a0 (commit) via 707c180ff0e16753a4053c86fb9ba49e58596c63 (commit) via 50c6204d26136176d95b69d0d399d4d8dd36b373 (commit) via ccb12f93c76d3867e963dbe0777b7dc0ced04025 (commit) via c499eccc5caa91700e033360f31604ecefff0238 (commit) via 521ea77fc03090175feb624cf266ecd5a2f2d904 (commit) via c672a6a4b95b5d5dd08620b3abdf286698c18229 (commit) via 6ced0b97d5fbcaf94f88a5f3062beeb0ad75f186 (commit) via 1527defbfe4ae9cb8f74d5954c790c403727063b (commit) via 8527dbbf4443daf3b43f3b1543192c3a2f26be80 (commit) via 41d262bd3ddf752a28f8e926b19bcc24224f8303 (commit) via 911b97867b72226df7cfab95374a6c2b89d9ffa3 (commit) from 1628e4677a25fc253e94eaae33f6e9aed13ca98a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa077acba51393030586aa50f5eff9d6034c5c11 commit fa077acba51393030586aa50f5eff9d6034c5c11 Merge: be132dc 1527def Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue May 7 15:16:12 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue May 7 11:17:26 2019 -0400 Merge topic 'enforce-explicit-use-of-project' 1527defbfe cmMakefile: Enforce explicit use of project() command Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3245 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=be132dc6a6b5a979bdd115880911296e50c961a0 commit be132dc6a6b5a979bdd115880911296e50c961a0 Merge: 707c180 c499ecc Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue May 7 15:15:35 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue May 7 11:16:07 2019 -0400 Merge topic 'findmpi-debug' c499eccc5c FindMPI: Make tests valid C89 by returning 0 521ea77fc0 FindMPI: Correct documentaiton for library version c672a6a4b9 FindMPI: Add error logging Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3289 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=707c180ff0e16753a4053c86fb9ba49e58596c63 commit 707c180ff0e16753a4053c86fb9ba49e58596c63 Merge: 50c6204 41d262b Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue May 7 15:15:08 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue May 7 11:15:18 2019 -0400 Merge topic 'CTestCoverageCollectGCOV-updates' 41d262bd3d CTestCoverageCollectGCOV: run gcov with -x 911b97867b CTestCoverageCollectGCOV: run gcov only once Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3258 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=50c6204d26136176d95b69d0d399d4d8dd36b373 commit 50c6204d26136176d95b69d0d399d4d8dd36b373 Merge: ccb12f9 8527dbb Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue May 7 15:14:00 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue May 7 11:14:20 2019 -0400 Merge topic 'use_intel_mkl_blas_intface_on_osX' 8527dbbf44 FindBLAS: Use Intel fortran interface on OS X even with GNU Fortran Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3286 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ccb12f93c76d3867e963dbe0777b7dc0ced04025 commit ccb12f93c76d3867e963dbe0777b7dc0ced04025 Merge: 1628e46 6ced0b9 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue May 7 11:13:35 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Tue May 7 11:13:35 2019 -0400 Merge branch 'release-3.14' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c499eccc5caa91700e033360f31604ecefff0238 commit c499eccc5caa91700e033360f31604ecefff0238 Author: Christian Pfeiffer <cpfeif...@live.de> AuthorDate: Mon May 6 18:42:28 2019 +0200 Commit: Christian Pfeiffer <cpfeif...@live.de> CommitDate: Mon May 6 18:42:28 2019 +0200 FindMPI: Make tests valid C89 by returning 0 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; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=521ea77fc03090175feb624cf266ecd5a2f2d904 commit 521ea77fc03090175feb624cf266ecd5a2f2d904 Author: Christian Pfeiffer <cpfeif...@live.de> AuthorDate: Mon May 6 18:42:02 2019 +0200 Commit: Christian Pfeiffer <cpfeif...@live.de> CommitDate: Mon May 6 18:42:02 2019 +0200 FindMPI: Correct documentaiton for library version diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index f655208..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. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c672a6a4b95b5d5dd08620b3abdf286698c18229 commit c672a6a4b95b5d5dd08620b3abdf286698c18229 Author: Christian Pfeiffer <cpfeif...@live.de> AuthorDate: Mon May 6 18:40:44 2019 +0200 Commit: Christian Pfeiffer <cpfeif...@live.de> CommitDate: Mon May 6 18:40:44 2019 +0200 FindMPI: Add error logging diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 5288640..f655208 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -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}}" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1527defbfe4ae9cb8f74d5954c790c403727063b commit 1527defbfe4ae9cb8f74d5954c790c403727063b Author: Bartosz Kosiorek <bartosz.kosio...@tomtom.com> AuthorDate: Fri Apr 19 10:44:41 2019 +0200 Commit: Bartosz Kosiorek <bartosz.kosio...@tomtom.com> CommitDate: Mon May 6 10:58:10 2019 +0200 cmMakefile: Enforce explicit use of project() command Fixes: 17714 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/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/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.$ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8527dbbf4443daf3b43f3b1543192c3a2f26be80 commit 8527dbbf4443daf3b43f3b1543192c3a2f26be80 Author: Jakub Benda <jacob.be...@gmail.com> AuthorDate: Sat May 4 10:38:02 2019 +0100 Commit: Jakub Benda <jacob.be...@gmail.com> CommitDate: Sat May 4 10:38:02 2019 +0100 FindBLAS: Use Intel fortran interface on OS X even with GNU Fortran According to Intel MKL Link Line Advisor, there is no GNU Fortran interface library provided for OS X variant of Intel MKL. Because of this missing library, FindBLAS was failing on OS X, looking for nonexistent library libmkl_gf_[i]lp64. To prevent this, FindBLAS will now always use Intel Fortran interface for MKL on OS X (libmkl_intel_[i]lp64), even with GNU Fortran. 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") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=41d262bd3ddf752a28f8e926b19bcc24224f8303 commit 41d262bd3ddf752a28f8e926b19bcc24224f8303 Author: Cristian Morales Vega <crist...@samknows.com> AuthorDate: Tue Apr 23 17:17:26 2019 +0100 Commit: Cristian Morales Vega <crist...@samknows.com> CommitDate: Fri May 3 21:28:28 2019 +0100 CTestCoverageCollectGCOV: run gcov with -x Using "-x" we avoid overwriting .gcov files from source files in different paths which happen to have the same name. It's similar to "-p", but it produces shorter file names, reducing the risk of reaching the file system limit. diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake index 8b029ee..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 @@ -135,7 +135,7 @@ function(ctest_coverage_collect_gcov) # run gcov, this will produce the .gcov files in the current # working directory if(NOT DEFINED GCOV_GCOV_OPTIONS) - set(GCOV_GCOV_OPTIONS -b) + set(GCOV_GCOV_OPTIONS -b -x) endif() execute_process(COMMAND ${gcov_command} ${GCOV_GCOV_OPTIONS} ${gcda_files} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=911b97867b72226df7cfab95374a6c2b89d9ffa3 commit 911b97867b72226df7cfab95374a6c2b89d9ffa3 Author: Cristian Morales Vega <crist...@samknows.com> AuthorDate: Tue Apr 23 17:12:11 2019 +0100 Commit: Cristian Morales Vega <crist...@samknows.com> CommitDate: Fri May 3 21:25:20 2019 +0100 CTestCoverageCollectGCOV: run gcov only once Running gcov once per .gcda file is not only inefficient, it also generates wrong data since .gcov files can get overwritten and in general gcov works with less information. fakegcov.cmake needs to be able to handle multiple .gcda files for the test to be meaningful. diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake index 2258271..8b029ee 100644 --- a/Modules/CTestCoverageCollectGCOV.cmake +++ b/Modules/CTestCoverageCollectGCOV.cmake @@ -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) + 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/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}" -) ----------------------------------------------------------------------- Summary of changes: Help/command/project.rst | 15 ++++---- Modules/CTestCoverageCollectGCOV.cmake | 40 ++++++++----------- Modules/FindBLAS.cmake | 3 +- Modules/FindMPI.cmake | 45 ++++++++++++++-------- Modules/FindMPI/libver_mpi.c | 1 + Modules/FindMPI/test_mpi.c | 1 + Source/cmMakefile.cxx | 10 +++++ Tests/CTestCoverageCollectGCOV/fakegcov.cmake | 21 +++++----- .../project_injected/CMP0048-WARN-stderr.txt | 12 ++++++ 9 files changed, 91 insertions(+), 57 deletions(-) create mode 100644 Tests/RunCMake/project_injected/CMP0048-WARN-stderr.txt hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits