From 5b13f2e6aa1ca2f812f53a40b11ff1f80277f897 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 8 Oct 2021 09:13:10 +0900 Subject: Imported Upstream version 3.10.1 --- Help/manual/cmake-server.7.rst | 42 +-- Help/release/3.10.rst | 12 + Modules/CMakeDetermineCompilerId.cmake | 6 +- Modules/Compiler/IAR-FindBinUtils.cmake | 4 +- Modules/FindMPI.cmake | 285 ++++++++++++--------- Modules/GoogleTest.cmake | 41 ++- Modules/GoogleTestAddTests.cmake | 11 +- Modules/InstallRequiredSystemLibraries.cmake | 9 +- Modules/Platform/Darwin-NVIDIA-CUDA.cmake | 19 ++ Modules/Platform/UnixPaths.cmake | 3 + Source/CMakeVersion.cmake | 2 +- Source/CPack/cmCPackPKGGenerator.cxx | 2 +- Source/cmQtAutoGeneratorInitializer.cxx | 47 ++-- Source/cmServerDictionary.h | 5 - Source/cmServerProtocol.cxx | 49 ---- Tests/QtAutogen/CMakeLists.txt | 6 + Tests/QtAutogen/macosFW/CMakeLists.txt | 20 ++ Tests/QtAutogen/macosFW/src/CMakeLists.txt | 33 +++ Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp | 17 ++ Tests/QtAutogen/macosFW/src/macos_fw_lib.h | 18 ++ Tests/QtAutogen/macosFW/test/CMakeLists.txt | 19 ++ Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp | 42 +++ Tests/QtAutogen/macosFW/test/testMacosFWLib.h | 7 + .../GoogleTest/GoogleTest-test-missing-result.txt | 1 + .../GoogleTest/GoogleTest-test-missing-stderr.txt | 2 + .../RunCMake/GoogleTest/GoogleTest-test-stdout.txt | 25 -- .../GoogleTest/GoogleTest-test1-stdout.txt | 25 ++ .../GoogleTest/GoogleTest-test2-stdout.txt | 25 ++ .../GoogleTest/GoogleTest-timeout-result.txt | 1 + .../GoogleTest/GoogleTest-timeout-stdout.txt | 7 + Tests/RunCMake/GoogleTest/GoogleTest.cmake | 16 +- Tests/RunCMake/GoogleTest/RunCMakeTest.cmake | 31 ++- Tests/RunCMake/GoogleTest/timeout_test.cpp | 15 ++ bootstrap | 1 + 34 files changed, 570 insertions(+), 278 deletions(-) create mode 100644 Modules/Platform/Darwin-NVIDIA-CUDA.cmake create mode 100644 Tests/QtAutogen/macosFW/CMakeLists.txt create mode 100644 Tests/QtAutogen/macosFW/src/CMakeLists.txt create mode 100644 Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp create mode 100644 Tests/QtAutogen/macosFW/src/macos_fw_lib.h create mode 100644 Tests/QtAutogen/macosFW/test/CMakeLists.txt create mode 100644 Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp create mode 100644 Tests/QtAutogen/macosFW/test/testMacosFWLib.h create mode 100644 Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt create mode 100644 Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt delete mode 100644 Tests/RunCMake/GoogleTest/GoogleTest-test-stdout.txt create mode 100644 Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt create mode 100644 Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt create mode 100644 Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt create mode 100644 Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt create mode 100644 Tests/RunCMake/GoogleTest/timeout_test.cpp diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index c56e5a716..50a90ee7d 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -506,9 +506,6 @@ Each target object can have the following keys: with the sysroot path. "fileGroups" contains the source files making up the target. -"crossReferences" - contains the location of the target in the corresponding CMakeLists.txt - file and the locations of the related statements like "target_link_libraries" FileGroups are used to group sources using similar settings together. @@ -534,16 +531,6 @@ Each fileGroup object may contain the following keys: All file paths in the fileGroup are either absolute or relative to the sourceDirectory of the target. -CrossReferences object is used to report the location of the target (including -the entire call stack if the target is defined in a function) and the related -"target_link_libraries", "target_include_directories", "target_compile_definitions" -and "target_compile_options" statements. - -See the example below for details on the internal format of the "crossReferences" object. -Line numbers stated in the "backtrace" entries are 1-based. The last entry of a backtrace -is a special entry with missing "line" and "name" fields that specifies the initial -CMakeLists.txt file. - Example:: [== "CMake Server" ==[ @@ -580,34 +567,7 @@ CMake will reply:: "linkerLanguage": "C", "name": "cmForm", "sourceDirectory": "/home/code/src/cmake/Source/CursesDialog/form", - "type": "STATIC_LIBRARY", - "crossReferences": { - "backtrace": [ - { - "line": 7, - "name": "add_executable", - "path": "C:/full/path/CMakeLists.txt" - }, - { - "path": "c:/full/path/CMakeLists.txt" - } - ], - "relatedStatements": [ - { - "backtrace": [ - { - "line": 8, - "name": "target_link_libraries", - "path": "c:/full/path/CMakeLists.txt" - }, - { - "path": "c:/full/path/CMakeLists.txt" - } - ], - "type": "target_link_libraries" - } - ] - } + "type": "STATIC_LIBRARY" } ] }, diff --git a/Help/release/3.10.rst b/Help/release/3.10.rst index 35fe602ed..6a19dbfe6 100644 --- a/Help/release/3.10.rst +++ b/Help/release/3.10.rst @@ -255,3 +255,15 @@ Other Changes incompatible with the old behavior, it is expected that behavior under typical use cases with properly-quoted command-lines has not changed. + +Updates +======= + +Changes made since CMake 3.10.0 include the following. + +3.10.1 +------ + +* The :manual:`cmake-server(7)` ``codemodel`` response ``crossReferences`` + field added by 3.10.0 has been dropped due to excessive memory usage. + Another approach will be needed to provide backtrace information. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 347106e78..15c304c1e 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -742,12 +742,12 @@ function(CMAKE_DIAGNOSE_UNSUPPORTED_CLANG lang envvar) return() endif() - # Test whether a GNU-like command-line option works. - execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" --version + # Test whether an MSVC-like command-line option works. + execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" /? RESULT_VARIABLE _clang_result OUTPUT_VARIABLE _clang_stdout ERROR_VARIABLE _clang_stderr) - if(NOT _clang_result EQUAL 0) + if(_clang_result EQUAL 0) return() endif() diff --git a/Modules/Compiler/IAR-FindBinUtils.cmake b/Modules/Compiler/IAR-FindBinUtils.cmake index 2b0479507..d662f5615 100644 --- a/Modules/Compiler/IAR-FindBinUtils.cmake +++ b/Modules/Compiler/IAR-FindBinUtils.cmake @@ -10,7 +10,7 @@ get_filename_component(__iar_hint_2 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPI set(__iar_hints "${__iar_hint_1}" "${__iar_hint_2}") -if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") +if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") # could allow using normal binutils ar, since objects are normal ELF files? find_program(CMAKE_IAR_LINKARM ilinkarm.exe HINTS ${__iar_hints} DOC "The IAR ARM linker") @@ -38,7 +38,7 @@ set(CMAKE_IAR_LINKARM \"${CMAKE_IAR_LINKARM}\") ") -elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") +elseif("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") # For AVR and AVR32, IAR uses the "xlink" linker and the "xar" archiver: find_program(CMAKE_IAR_LINKER xlink.exe HINTS ${__iar_hints} diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 7f4c44c5e..22493f69b 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -614,6 +614,16 @@ function (_MPI_interrogate_compiler lang) endif() endif() + if(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + list(APPEND MPI_COMPILE_DEFINITIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS}") + endif() + if(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + list(APPEND MPI_COMPILE_OPTIONS_WORK "${MPI_${LANG}_EXTRA_COMPILE_OPTIONS}") + endif() + if(MPI_${LANG}_EXTRA_LIB_NAMES) + list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}") + endif() + # If we found MPI, set up all of the appropriate cache entries if(NOT MPI_${LANG}_COMPILE_OPTIONS) set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_COMPILE_OPTIONS_WORK} CACHE STRING "MPI ${LANG} compilation options" FORCE) @@ -822,33 +832,43 @@ endfunction() macro(_MPI_assemble_libraries LANG) set(MPI_${LANG}_LIBRARIES "") - foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) - list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) - endforeach() + # Only for libraries do we need to check whether the compiler's linking stage is separate. + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS_IMPLICIT) + foreach(mpilib IN LISTS MPI_${LANG}_LIB_NAMES) + list(APPEND MPI_${LANG}_LIBRARIES ${MPI_${mpilib}_LIBRARY}) + endforeach() + endif() endmacro() macro(_MPI_assemble_include_dirs LANG) - set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") - if("${LANG}" MATCHES "(C|CXX)") - if(MPI_${LANG}_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") - endif() - else() # Fortran - if(MPI_${LANG}_F77_HEADER_DIR) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_${LANG}_INCLUDE_DIRS "") + else() + set(MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS}") + if("${LANG}" MATCHES "(C|CXX)") + if(MPI_${LANG}_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}") + endif() + else() # Fortran + if(MPI_${LANG}_F77_HEADER_DIR) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}") + endif() + if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") + endif() endif() - if(MPI_${LANG}_MODULE_DIR AND NOT "${MPI_${LANG}_MODULE_DIR}" IN_LIST MPI_${LANG}_INCLUDE_DIRS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}") + if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + foreach(MPI_ADDITIONAL_INC_DIR IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) + list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${MPI_ADDITIONAL_INC_DIR}_INCLUDE_DIR}") + endforeach() endif() endif() - if(MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - foreach(mpiadditionalinclude IN LISTS MPI_${LANG}_ADDITIONAL_INCLUDE_VARS) - list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${mpiadditionalinclude}_INCLUDE_DIR}") - endforeach() - endif() endmacro() function(_MPI_split_include_dirs LANG) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + return() + endif() # Backwards compatibility: Search INCLUDE_PATH if given. if(MPI_${LANG}_INCLUDE_PATH) list(APPEND MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "${MPI_${LANG}_INCLUDE_PATH}") @@ -884,6 +904,13 @@ function(_MPI_split_include_dirs LANG) endif() mark_as_advanced(MPI_${LANG}_F77_HEADER_DIR MPI_${LANG}_MODULE_DIR) endif() + # Remove duplicates and default system directories from the list. + if(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + list(REMOVE_DUPLICATES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS) + foreach(MPI_IMPLICIT_INC_DIR IN LISTS CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES) + list(REMOVE_ITEM MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_IMPLICIT_INC_DIR}) + endforeach() + endif() set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories" FORCE) endfunction() @@ -1013,7 +1040,7 @@ elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "FreeBSD") # FreeBSD ships mpich under the normal system paths - but available openmpi implementations # will be found in /usr/local/mpi/ - MPI_search_mpi_prefix_folder("/usr/local/mpi/") + MPI_search_mpi_prefix_folder("/usr/local/mpi") endif() # Most MPI distributions have some form of mpiexec or mpirun which gives us something we can look for. @@ -1049,48 +1076,54 @@ mark_as_advanced(MPIEXEC_EXECUTABLE MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXE # # Once we find the new variables, we translate them back into their old # equivalents below. -foreach (LANG IN ITEMS C CXX) - # Old input variables. - set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) - - # Set new vars based on their old equivalents, if the new versions are not already set. - foreach (var ${_MPI_OLD_INPUT_VARS}) - if (NOT MPI_${LANG}_${var} AND MPI_${var}) - set(MPI_${LANG}_${var} "${MPI_${var}}") - endif() - endforeach() - - # Chop the old compile flags into options and definitions - if(MPI_${LANG}_COMPILE_FLAGS) - unset(MPI_${LANG}_COMPILE_OPTIONS) - unset(MPI_${LANG}_COMPILE_DEFINITIONS) - separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") - foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) - if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") - list(APPEND MPI_${LANG}_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") - else() - list(APPEND MPI_${LANG}_COMPILE_FLAGS "${_MPI_FLAG}") +if(NOT MPI_IGNORE_LEGACY_VARIABLES) + foreach (LANG IN ITEMS C CXX) + # Old input variables. + set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS) + + # Set new vars based on their old equivalents, if the new versions are not already set. + foreach (var ${_MPI_OLD_INPUT_VARS}) + if (NOT MPI_${LANG}_${var} AND MPI_${var}) + set(MPI_${LANG}_${var} "${MPI_${var}}") endif() endforeach() - unset(MPI_SEPARATE_FLAGS) - endif() - # If a list of libraries was given, we'll split it into new-style cache variables - if(NOT MPI_${LANG}_LIB_NAMES) - foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) - get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) - get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) - get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) - list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}") - find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY - NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" - HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} - DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" - ) - mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) - endforeach() - endif() -endforeach() + # Chop the old compile flags into options and definitions + + unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) + unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) + if(MPI_${LANG}_COMPILE_FLAGS) + separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") + foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) + if("${_MPI_FLAG}" MATCHES "^ *[-/D]([^ ]+)") + list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") + else() + list(APPEND MPI_${LANG}_EXTRA_COMPILE_OPTIONS "${_MPI_FLAG}") + endif() + endforeach() + unset(MPI_SEPARATE_FLAGS) + endif() + + # If a list of libraries was given, we'll split it into new-style cache variables + unset(MPI_${LANG}_EXTRA_LIB_NAMES) + if(NOT MPI_${LANG}_LIB_NAMES) + foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY) + if(_MPI_LIB) + get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE) + get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME) + get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY) + list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}") + find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY + NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}" + HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB} + DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI" + ) + mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY) + endif() + endforeach() + endif() + endforeach() +endif() #============================================================================= unset(MPI_VERSION) @@ -1099,6 +1132,11 @@ unset(MPI_VERSION_MINOR) unset(_MPI_MIN_VERSION) +# If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. +if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) + set(MPI_SKIP_COMPILER_WRAPPER TRUE) +endif() + # This loop finds the compilers and sends them off for interrogation. foreach(LANG IN ITEMS C CXX Fortran) if(CMAKE_${LANG}_COMPILER_LOADED) @@ -1120,6 +1158,8 @@ foreach(LANG IN ITEMS C CXX Fortran) mark_as_advanced(MPI_CXX_SKIP_MPICXX) endif() if(NOT (MPI_${LANG}_LIB_NAMES AND (MPI_${LANG}_INCLUDE_PATH OR MPI_${LANG}_INCLUDE_DIRS OR MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS))) + set(MPI_${LANG}_TRIED_IMPLICIT FALSE) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) if(NOT MPI_${LANG}_COMPILER AND NOT MPI_ASSUME_NO_BUILTIN_MPI) # 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. @@ -1129,80 +1169,90 @@ foreach(LANG IN ITEMS C CXX Fortran) # 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) set(MPI_${LANG}_COMPILER "${CMAKE_${LANG}_COMPILER}" CACHE FILEPATH "MPI compiler for ${LANG}" FORCE) + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) endif() + set(MPI_${LANG}_TRIED_IMPLICIT TRUE) endif() - # If the user specified a library name we assume they prefer that library over a wrapper. If not, they can disable skipping manually. - if(NOT DEFINED MPI_SKIP_COMPILER_WRAPPER AND MPI_GUESS_LIBRARY_NAME) - set(MPI_SKIP_COMPILER_WRAPPER TRUE) - endif() - if(NOT MPI_SKIP_COMPILER_WRAPPER) - if(MPI_${LANG}_COMPILER) - # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. - if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") - # Get rid of our default list of names and just search for the name the user wants. - set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") - unset(MPI_${LANG}_COMPILER CACHE) + if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}" OR NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WRAPPER_FOUND FALSE) + set(MPI_PINNED_COMPILER FALSE) + + if(NOT MPI_SKIP_COMPILER_WRAPPER) + if(MPI_${LANG}_COMPILER) + # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler. + if (NOT IS_ABSOLUTE "${MPI_${LANG}_COMPILER}") + # Get rid of our default list of names and just search for the name the user wants. + set(_MPI_${LANG}_COMPILER_NAMES "${MPI_${LANG}_COMPILER}") + unset(MPI_${LANG}_COMPILER CACHE) + endif() + # If the user specifies a compiler, we don't want to try to search libraries either. + set(MPI_PINNED_COMPILER TRUE) + endif() + + # If we have an MPI base directory, we'll try all compiler names in that one first. + # This should prevent mixing different MPI environments + if(_MPI_BASE_DIR) + find_program(MPI_${LANG}_COMPILER + NAMES ${_MPI_${LANG}_COMPILER_NAMES} + PATH_SUFFIXES bin sbin + HINTS ${_MPI_BASE_DIR} + NO_DEFAULT_PATH + DOC "MPI compiler for ${LANG}" + ) endif() - # If the user specifies a compiler, we don't want to try to search libraries either. - set(MPI_PINNED_COMPILER TRUE) - else() - set(MPI_PINNED_COMPILER FALSE) - endif() - # If we have an MPI base directory, we'll try all compiler names in that one first. - # This should prevent mixing different MPI environments - if(_MPI_BASE_DIR) + # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), + # we shall try searching in the default paths. find_program(MPI_${LANG}_COMPILER NAMES ${_MPI_${LANG}_COMPILER_NAMES} PATH_SUFFIXES bin sbin - HINTS ${_MPI_BASE_DIR} - NO_DEFAULT_PATH DOC "MPI compiler for ${LANG}" ) - endif() - # If the base directory did not help (for example because the mpiexec isn't in the same directory as the compilers), - # we shall try searching in the default paths. - find_program(MPI_${LANG}_COMPILER - NAMES ${_MPI_${LANG}_COMPILER_NAMES} - PATH_SUFFIXES bin sbin - DOC "MPI compiler for ${LANG}" - ) - - if(MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - set(MPI_SKIP_GUESSING TRUE) - elseif(MPI_${LANG}_COMPILER) - _MPI_interrogate_compiler(${LANG}) - else() - set(MPI_${LANG}_WRAPPER_FOUND FALSE) + if("${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") + set(MPI_PINNED_COMPILER TRUE) + + # 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}) + endif() + + # Should the MPI compiler not work implicitly for MPI, still interrogate it. + # Otherwise, MPI compilers for which CMake has separate linking stages, e.g. Intel MPI on Windows where link.exe is being used + # directly during linkage instead of CMAKE__COMPILER will not work. + if(NOT MPI_${LANG}_WORKS) + set(MPI_${LANG}_WORKS_IMPLICIT FALSE) + _MPI_interrogate_compiler(${LANG}) + else() + set(MPI_${LANG}_WORKS_IMPLICIT TRUE) + endif() + elseif(MPI_${LANG}_COMPILER) + _MPI_interrogate_compiler(${LANG}) + endif() endif() - else() - set(MPI_${LANG}_WRAPPER_FOUND FALSE) - set(MPI_PINNED_COMPILER FALSE) - endif() - if(NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) - # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the - # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. - if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) - set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) - set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) - set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") - set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) - set(MPI_${LANG}_WRAPPER_FOUND TRUE) - elseif(NOT MPI_SKIP_GUESSING) - _MPI_guess_settings(${LANG}) + if(NOT MPI_SKIP_GUESSING AND NOT MPI_${LANG}_WRAPPER_FOUND AND NOT MPI_PINNED_COMPILER) + # For C++, we may use the settings for C. Should a given compiler wrapper for C++ not exist, but one for C does, we copy over the + # settings for C. An MPI distribution that is in this situation would be IBM Platform MPI. + if("${LANG}" STREQUAL "CXX" AND MPI_C_WRAPPER_FOUND) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_C_COMPILE_OPTIONS} CACHE STRING "MPI ${LANG} compilation options" ) + set(MPI_${LANG}_COMPILE_DEFINITIONS ${MPI_C_COMPILE_DEFINITIONS} CACHE STRING "MPI ${LANG} compilation definitions" ) + set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS ${MPI_C_INCLUDE_DIRS} CACHE STRING "MPI ${LANG} additional include directories") + set(MPI_${LANG}_LINK_FLAGS ${MPI_C_LINK_FLAGS} CACHE STRING "MPI ${LANG} linker flags" ) + set(MPI_${LANG}_LIB_NAMES ${MPI_C_LIB_NAMES} CACHE STRING "MPI ${LANG} libraries to link against" ) + else() + _MPI_guess_settings(${LANG}) + endif() endif() endif() endif() _MPI_split_include_dirs(${LANG}) - if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) - _MPI_assemble_include_dirs(${LANG}) - _MPI_assemble_libraries(${LANG}) - endif() + _MPI_assemble_include_dirs(${LANG}) + _MPI_assemble_libraries(${LANG}) + _MPI_adjust_compile_definitions(${LANG}) # We always create imported targets even if they're empty _MPI_create_imported_target(${LANG}) @@ -1216,7 +1266,9 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_COMPILE_DEFINITIONS "" CACHE STRING "MPI ${LANG} compilation definitions" ) set(MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "MPI ${LANG} additional include directories") set(MPI_${LANG}_LINK_FLAGS "" CACHE STRING "MPI ${LANG} linker flags" ) - set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) + if(NOT MPI_${LANG}_COMPILER STREQUAL CMAKE_${LANG}_COMPILER) + set(MPI_${LANG}_LIB_NAMES "" CACHE STRING "MPI ${LANG} libraries to link against" ) + endif() mark_as_advanced(MPI_${LANG}_COMPILE_OPTIONS MPI_${LANG}_COMPILE_DEFINITIONS MPI_${LANG}_LINK_FLAGS MPI_${LANG}_LIB_NAMES MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS MPI_${LANG}_COMPILER) @@ -1336,7 +1388,7 @@ foreach(LANG IN ITEMS C CXX Fortran) set(MPI_${LANG}_FIND_VERSION_EXACT ${MPI_FIND_VERSION_EXACT}) unset(MPI_${LANG}_REQUIRED_VARS) - if (MPI_${LANG}_WRAPPER_FOUND OR MPI_${LANG}_GUESS_FOUND) + if (NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}") foreach(mpilibname IN LISTS MPI_${LANG}_LIB_NAMES) list(APPEND MPI_${LANG}_REQUIRED_VARS "MPI_${mpilibname}_LIBRARY") endforeach() @@ -1447,6 +1499,7 @@ if (MPI_NUMLIBS GREATER 1) else() set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND") endif() +set(MPI_IGNORE_LEGACY_VARIABLES TRUE) #============================================================================= # unset these vars to cleanup namespace diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake index 41bd1dccd..c525101c7 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -217,6 +217,14 @@ same as the Google Test name (i.e. ``suite.testcase``); see also executable is being used in multiple calls to ``gtest_discover_tests()``. Note that this variable is only available in CTest. + ``TIMEOUT num`` + Specifies how long (in seconds) CMake will wait for the test to enumerate + available tests. If the test takes longer than this, discovery (and your + build) will fail. Most test executables will enumerate their tests very + quickly, but under some exceptional circumstances, a test may require a + longer timeout. The default is 5. See also the ``TIMEOUT`` option of + :command:`execute_process`. + #]=======================================================================] #------------------------------------------------------------------------------ @@ -349,7 +357,7 @@ function(gtest_discover_tests TARGET) cmake_parse_arguments( "" "NO_PRETTY_TYPES;NO_PRETTY_VALUES" - "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST" + "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;TIMEOUT" "EXTRA_ARGS;PROPERTIES" ${ARGN} ) @@ -360,10 +368,36 @@ function(gtest_discover_tests TARGET) if(NOT _TEST_LIST) set(_TEST_LIST ${TARGET}_TESTS) endif() + if(NOT _TIMEOUT) + set(_TIMEOUT 5) + endif() + + get_property( + has_counter + TARGET ${TARGET} + PROPERTY CTEST_DISCOVERED_TEST_COUNTER + SET + ) + if(has_counter) + get_property( + counter + TARGET ${TARGET} + PROPERTY CTEST_DISCOVERED_TEST_COUNTER + ) + math(EXPR counter "${counter} + 1") + else() + set(counter 1) + endif() + set_property( + TARGET ${TARGET} + PROPERTY CTEST_DISCOVERED_TEST_COUNTER + ${counter} + ) # Define rule to generate test list for aforementioned test executable - set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include.cmake") - set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests.cmake") + set(ctest_file_base "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}[${counter}]") + set(ctest_include_file "${ctest_file_base}_include.cmake") + set(ctest_tests_file "${ctest_file_base}_tests.cmake") get_property(crosscompiling_emulator TARGET ${TARGET} PROPERTY CROSSCOMPILING_EMULATOR @@ -384,6 +418,7 @@ function(gtest_discover_tests TARGET) -D "NO_PRETTY_VALUES=${_NO_PRETTY_VALUES}" -D "TEST_LIST=${_TEST_LIST}" -D "CTEST_FILE=${ctest_tests_file}" + -D "TEST_DISCOVERY_TIMEOUT=${_TIMEOUT}" -P "${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}" VERBATIM ) diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 7d0d9097b..5a4bdcad3 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -24,19 +24,24 @@ endfunction() # Run test executable to get list of available tests if(NOT EXISTS "${TEST_EXECUTABLE}") message(FATAL_ERROR - "Specified test executable '${TEST_EXECUTABLE}' does not exist" + "Specified test executable does not exist.\n" + " Path: '${TEST_EXECUTABLE}'" ) endif() execute_process( COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" --gtest_list_tests + TIMEOUT ${TEST_DISCOVERY_TIMEOUT} OUTPUT_VARIABLE output RESULT_VARIABLE result ) if(NOT ${result} EQUAL 0) + string(REPLACE "\n" "\n " output "${output}") message(FATAL_ERROR - "Error running test executable '${TEST_EXECUTABLE}':\n" + "Error running test executable.\n" + " Path: '${TEST_EXECUTABLE}'\n" " Result: ${result}\n" - " Output: ${output}\n" + " Output:\n" + " ${output}\n" ) endif() diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 1ba4877e6..f62bd09b4 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -56,10 +56,13 @@ # Specify the :command:`install(PROGRAMS)` command ``COMPONENT`` # option. If not specified, no such option will be used. +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced + set(_IRSL_HAVE_Intel FALSE) set(_IRSL_HAVE_MSVC FALSE) foreach(LANG IN ITEMS C CXX Fortran) - if(CMAKE_${LANG}_COMPILER_ID STREQUAL Intel) + if("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Intel") if(NOT _IRSL_HAVE_Intel) get_filename_component(_Intel_basedir "${CMAKE_${LANG}_COMPILER}" PATH) if(CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -81,7 +84,7 @@ foreach(LANG IN ITEMS C CXX Fortran) endif() set(_IRSL_HAVE_Intel TRUE) endif() - elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL MSVC) + elseif("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "MSVC") set(_IRSL_HAVE_MSVC TRUE) endif() endforeach() @@ -740,3 +743,5 @@ if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) ) endif() endif() + +cmake_policy(POP) diff --git a/Modules/Platform/Darwin-NVIDIA-CUDA.cmake b/Modules/Platform/Darwin-NVIDIA-CUDA.cmake new file mode 100644 index 000000000..bec394839 --- /dev/null +++ b/Modules/Platform/Darwin-NVIDIA-CUDA.cmake @@ -0,0 +1,19 @@ +include(Platform/Darwin) + +set(__IMPLICT_LINKS ) +foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) + string(APPEND __IMPLICT_LINKS " -L\"${dir}\"") +endforeach() +foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES}) + if(${lib} MATCHES "/") + string(APPEND __IMPLICT_LINKS " \"${lib}\"") + else() + string(APPEND __IMPLICT_LINKS " -l${lib}") + endif() +endforeach() + +set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS "-shared -Wl,-headerpad_max_install_names") +set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS "-shared -Wl,-headerpad_max_install_names") + +set(CMAKE_CUDA_CREATE_SHARED_LIBRARY " -o ${__IMPLICT_LINKS}") +set(CMAKE_CUDA_CREATE_SHARED_MODULE " -o ${__IMPLICT_LINKS}") diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 5687653cf..328d3c6d3 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -69,6 +69,9 @@ list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /usr/include ) +list(APPEND CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES + /usr/include + ) # Enable use of lib32 and lib64 search path variants by default. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8a93c36ca..57fe0b185 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 10) -set(CMake_VERSION_PATCH 0) +set(CMake_VERSION_PATCH 1) #set(CMake_VERSION_RC 0) diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 4f5b2a05a..9ea85405c 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -189,7 +189,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component, // This way, selecting C will automatically select everything it depends // on (B and A), while selecting something that depends on C--either D // or E--will automatically cause C to get selected. - std::ostringstream selected("my.choice.selected"); + std::ostringstream selected("my.choice.selected", std::ios_base::ate); std::set visited; AddDependencyAttributes(component, visited, selected); visited.clear(); diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index c7550e60e..b02d872a4 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -1046,40 +1046,39 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( target->Target->AddPreBuildCommand(cc); } else { - // Convert file dependencies std::set to std::vector - std::vector autogenDepends(autogenDependFiles.begin(), - autogenDependFiles.end()); - // Add link library target dependencies to the autogen target dependencies - for (std::string const& config : configsList) { - cmLinkImplementationLibraries const* libs = - target->GetLinkImplementationLibraries(config); - if (libs != nullptr) { - for (cmLinkItem const& item : libs->Libraries) { - cmGeneratorTarget const* libTarget = item.Target; - if ((libTarget != nullptr) && - !StaticLibraryCycle(target, libTarget, config)) { - std::string util; - if (configsList.size() > 1) { - util += "$<$GetName(); - if (configsList.size() > 1) { - util += ">"; + { + // add_dependencies/addUtility do not support generator expressions. + // We depend only on the libraries found in all configs therefore. + std::map commonTargets; + for (std::string const& config : configsList) { + cmLinkImplementationLibraries const* libs = + target->GetLinkImplementationLibraries(config); + if (libs != nullptr) { + for (cmLinkItem const& item : libs->Libraries) { + cmGeneratorTarget const* libTarget = item.Target; + if ((libTarget != nullptr) && + !StaticLibraryCycle(target, libTarget, config)) { + // Increment target config count + commonTargets[libTarget]++; } - autogenDepends.push_back(util); } } } + for (auto const& item : commonTargets) { + if (item.second == configsList.size()) { + autogenDependTargets.insert(item.first->Target); + } + } } // Create autogen target cmTarget* autogenTarget = makefile->AddUtilityCommand( autogenTargetName, true, workingDirectory.c_str(), - /*byproducts=*/autogenProvides, autogenDepends, commandLines, false, - autogenComment.c_str()); + /*byproducts=*/autogenProvides, + std::vector(autogenDependFiles.begin(), + autogenDependFiles.end()), + commandLines, false, autogenComment.c_str()); // Create autogen generator target localGen->AddGeneratorTarget( new cmGeneratorTarget(autogenTarget, localGen)); diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h index 405ff6b12..e6a7ae6ca 100644 --- a/Source/cmServerDictionary.h +++ b/Source/cmServerDictionary.h @@ -89,11 +89,6 @@ static const std::string kWARN_UNUSED_KEY = "warnUnused"; static const std::string kWATCHED_DIRECTORIES_KEY = "watchedDirectories"; static const std::string kWATCHED_FILES_KEY = "watchedFiles"; -static const std::string kTARGET_CROSS_REFERENCES_KEY = "crossReferences"; -static const std::string kLINE_NUMBER_KEY = "line"; -static const std::string kBACKTRACE_KEY = "backtrace"; -static const std::string kRELATED_STATEMENTS_KEY = "relatedStatements"; - static const std::string kSTART_MAGIC = "[== \"CMake Server\" ==["; static const std::string kEND_MAGIC = "]== \"CMake Server\" ==]"; diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index e835b7a2c..13b18c24c 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -9,7 +9,6 @@ #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" #include "cmLinkLineComputer.h" -#include "cmListFileCache.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmServer.h" @@ -20,7 +19,6 @@ #include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" -#include "cmTarget.h" #include "cm_uv.h" #include "cmake.h" @@ -732,37 +730,6 @@ static Json::Value DumpSourceFilesList( return result; } -static Json::Value DumpBacktrace(const cmListFileBacktrace& backtrace) -{ - Json::Value result = Json::arrayValue; - - cmListFileBacktrace backtraceCopy = backtrace; - while (!backtraceCopy.Top().FilePath.empty()) { - Json::Value entry = Json::objectValue; - entry[kPATH_KEY] = backtraceCopy.Top().FilePath; - if (backtraceCopy.Top().Line) { - entry[kLINE_NUMBER_KEY] = static_cast(backtraceCopy.Top().Line); - } - if (!backtraceCopy.Top().Name.empty()) { - entry[kNAME_KEY] = backtraceCopy.Top().Name; - } - result.append(entry); - backtraceCopy = backtraceCopy.Pop(); - } - return result; -} - -static void DumpBacktraceRange(Json::Value& result, const std::string& type, - cmBacktraceRange range) -{ - for (auto const& bt : range) { - Json::Value obj = Json::objectValue; - obj[kTYPE_KEY] = type; - obj[kBACKTRACE_KEY] = DumpBacktrace(bt); - result.append(obj); - } -} - static Json::Value DumpTarget(cmGeneratorTarget* target, const std::string& config) { @@ -797,22 +764,6 @@ static Json::Value DumpTarget(cmGeneratorTarget* target, result[kFULL_NAME_KEY] = target->GetFullName(config); - Json::Value crossRefs = Json::objectValue; - crossRefs[kBACKTRACE_KEY] = DumpBacktrace(target->Target->GetBacktrace()); - - Json::Value statements = Json::arrayValue; - DumpBacktraceRange(statements, "target_compile_definitions", - target->Target->GetCompileDefinitionsBacktraces()); - DumpBacktraceRange(statements, "target_include_directories", - target->Target->GetIncludeDirectoriesBacktraces()); - DumpBacktraceRange(statements, "target_compile_options", - target->Target->GetCompileOptionsBacktraces()); - DumpBacktraceRange(statements, "target_link_libraries", - target->Target->GetLinkImplementationBacktraces()); - - crossRefs[kRELATED_STATEMENTS_KEY] = std::move(statements); - result[kTARGET_CROSS_REFERENCES_KEY] = std::move(crossRefs); - if (target->HaveWellDefinedOutputFiles()) { Json::Value artifacts = Json::arrayValue; artifacts.append( diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 32c2950cb..dff9d0c66 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -214,6 +214,12 @@ add_subdirectory(uicInclude) # OBJECT libraries add_subdirectory(objectLibrary) +# -- Test +# MacOS Framework +if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) + add_subdirectory(macosFW) +endif() + # -- Test # Source files with the same basename in different subdirectories add_subdirectory(sameName) diff --git a/Tests/QtAutogen/macosFW/CMakeLists.txt b/Tests/QtAutogen/macosFW/CMakeLists.txt new file mode 100644 index 000000000..114d9bac0 --- /dev/null +++ b/Tests/QtAutogen/macosFW/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.8) +project(macos-fw-test) + +find_package(Qt5Test REQUIRED) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/lib) +set(CMAKE_INSTALL_NAME_DIR ${CMAKE_BINARY_DIR}/output/lib) + +if(POLICY CMP0042) # in CMake 3.0.0+ + set (CMAKE_MACOSX_RPATH OFF) # otherwise ON by default +endif(POLICY CMP0042) + +if(POLICY CMP0068) # in CMake 3.9+ + cmake_policy(SET CMP0068 NEW) +endif(POLICY CMP0068) + +add_subdirectory(src) +add_subdirectory(test) diff --git a/Tests/QtAutogen/macosFW/src/CMakeLists.txt b/Tests/QtAutogen/macosFW/src/CMakeLists.txt new file mode 100644 index 000000000..a02be00c5 --- /dev/null +++ b/Tests/QtAutogen/macosFW/src/CMakeLists.txt @@ -0,0 +1,33 @@ +set(MACOS_FW_LIB_VERSION "0.1") +set(MACOS_FW_LIB_SRCS + macos_fw_lib.cpp +) +set(MACOS_FW_LIB_HDRS + macos_fw_lib.h +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${Qt5Core_INCLUDE_DIRS} +) + +add_library(macos_fw_lib SHARED + ${MACOS_FW_LIB_SRCS} + ${MACOS_FW_LIB_HDRS} +) +set_target_properties(macos_fw_lib PROPERTIES AUTOMOC TRUE) +set_target_properties(macos_fw_lib PROPERTIES + CLEAN_DIRECT_OUTPUT 1 + FRAMEWORK 1 + FRAMEWORK_VERSION ${MACOS_FW_LIB_VERSION} + VERSION ${MACOS_FW_LIB_VERSION} + SOVERSION ${MACOS_FW_LIB_VERSION} + MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${MACOS_FW_LIB_VERSION} + MACOSX_FRAMEWORK_IDENTIFIER org.macos.fw_lib + POSITION_INDEPENDENT_CODE ON + PUBLIC_HEADER "${MACOS_FW_LIB_HDRS}" +) +target_link_libraries(macos_fw_lib + Qt5::Core +) diff --git a/Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp b/Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp new file mode 100644 index 000000000..881a8c9b6 --- /dev/null +++ b/Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp @@ -0,0 +1,17 @@ +#include "macos_fw_lib.h" + +#include +#include + +MacosFWLib::MacosFWLib() +{ +} + +MacosFWLib::~MacosFWLib() +{ +} + +QString MacosFWLib::qtVersionString() const +{ + return QString(qVersion()); +} diff --git a/Tests/QtAutogen/macosFW/src/macos_fw_lib.h b/Tests/QtAutogen/macosFW/src/macos_fw_lib.h new file mode 100644 index 000000000..e66e0ea6c --- /dev/null +++ b/Tests/QtAutogen/macosFW/src/macos_fw_lib.h @@ -0,0 +1,18 @@ +#ifndef MACOSFWLIB_H +#define MACOSFWLIB_H + +#include +#include + +class __attribute__((visibility("default"))) MacosFWLib : public QObject +{ + Q_OBJECT + +public: + explicit MacosFWLib(); + ~MacosFWLib(); + + QString qtVersionString() const; +}; + +#endif // MACOSFWLIB_H diff --git a/Tests/QtAutogen/macosFW/test/CMakeLists.txt b/Tests/QtAutogen/macosFW/test/CMakeLists.txt new file mode 100644 index 000000000..521c18450 --- /dev/null +++ b/Tests/QtAutogen/macosFW/test/CMakeLists.txt @@ -0,0 +1,19 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src +) +include_directories(SYSTEM + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} +) + +set(testname AutomocMacosFWLib) +add_executable(${testname} testMacosFWLib.cpp) +set_target_properties(${testname} PROPERTIES AUTOMOC TRUE) +target_link_libraries(${testname} + Qt5::Core + Qt5::Widgets + Qt5::Test + macos_fw_lib +) diff --git a/Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp b/Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp new file mode 100644 index 000000000..3476d6176 --- /dev/null +++ b/Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp @@ -0,0 +1,42 @@ +#include +#include + +#include "macos_fw_lib.h" +#include "testMacosFWLib.h" + +class TestMacosFWLib : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void cleanupTestCase(); + void init() {} + void cleanup() {} + + void testQtVersion(); +}; + +void TestMacosFWLib::initTestCase() +{ +} + +void TestMacosFWLib::cleanupTestCase() +{ +} + +void TestMacosFWLib::testQtVersion() +{ + MacosFWLib* testLib = new MacosFWLib(); + QVERIFY(testLib->qtVersionString().contains("5.")); + testLib->deleteLater(); +} + +int main(int argc, char* argv[]) +{ + QApplication app(argc, argv, false); + MacosFWLib testObject; + return QTest::qExec(&testObject, argc, argv); +} + +#include "testMacosFWLib.moc" diff --git a/Tests/QtAutogen/macosFW/test/testMacosFWLib.h b/Tests/QtAutogen/macosFW/test/testMacosFWLib.h new file mode 100644 index 000000000..1fe8dae65 --- /dev/null +++ b/Tests/QtAutogen/macosFW/test/testMacosFWLib.h @@ -0,0 +1,7 @@ +#ifndef TESTMACOSFWLIB_H +#define TESTMACOSFWLIB_H + +#include "qapplication.h" +#include + +#endif // TESTMACOSFWLIB_H diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt new file mode 100644 index 000000000..d197c913c --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt new file mode 100644 index 000000000..55a4a7aa4 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt @@ -0,0 +1,2 @@ +Unable to find executable: timeout_test_NOT_BUILT +Errors while running CTest diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test-stdout.txt deleted file mode 100644 index 5f7753dba..000000000 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test-stdout.txt +++ /dev/null @@ -1,25 +0,0 @@ -Test project .* - Start 1: TEST:basic\.case_foo!1 -1/8 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec - Start 2: TEST:basic\.case_bar!1 -2/8 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec - Start 3: TEST:basic\.disabled_case!1 -3/8 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 4: TEST:disabled\.case!1 -4/8 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 5: TEST:typed/short\.case!1 -5/8 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec - Start 6: TEST:typed/float\.case!1 -6/8 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec - Start 7: TEST:value/test\.case/1!1 -7/8 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec - Start 8: TEST:value/test\.case/"foo"!1 -8/8 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec - -100% tests passed, 0 tests failed out of 6 - -Total Test time \(real\) = +[0-9.]+ sec - -The following tests did not run: -.*3 - TEST:basic\.disabled_case!1 \(Disabled\) -.*4 - TEST:disabled\.case!1 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt new file mode 100644 index 000000000..5f7753dba --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt @@ -0,0 +1,25 @@ +Test project .* + Start 1: TEST:basic\.case_foo!1 +1/8 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec + Start 2: TEST:basic\.case_bar!1 +2/8 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec + Start 3: TEST:basic\.disabled_case!1 +3/8 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 4: TEST:disabled\.case!1 +4/8 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 5: TEST:typed/short\.case!1 +5/8 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec + Start 6: TEST:typed/float\.case!1 +6/8 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec + Start 7: TEST:value/test\.case/1!1 +7/8 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec + Start 8: TEST:value/test\.case/"foo"!1 +8/8 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec + +100% tests passed, 0 tests failed out of 6 + +Total Test time \(real\) = +[0-9.]+ sec + +The following tests did not run: +.*3 - TEST:basic\.disabled_case!1 \(Disabled\) +.*4 - TEST:disabled\.case!1 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt new file mode 100644 index 000000000..960c0b9cf --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt @@ -0,0 +1,25 @@ +Test project .* + Start 9: TEST:basic\.case_foo!2 +1/8 Test #9: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec + Start 10: TEST:basic\.case_bar!2 +2/8 Test #10: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec + Start 11: TEST:basic\.disabled_case!2 +3/8 Test #11: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 12: TEST:disabled\.case!2 +4/8 Test #12: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 13: TEST:typed/short\.case!2 +5/8 Test #13: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec + Start 14: TEST:typed/float\.case!2 +6/8 Test #14: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec + Start 15: TEST:value/test\.case/1!2 +7/8 Test #15: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec + Start 16: TEST:value/test\.case/"foo"!2 +8/8 Test #16: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + +100% tests passed, 0 tests failed out of 6 + +Total Test time \(real\) = +[0-9.]+ sec + +The following tests did not run: +.*11 - TEST:basic\.disabled_case!2 \(Disabled\) +.*12 - TEST:disabled\.case!2 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt new file mode 100644 index 000000000..d197c913c --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt new file mode 100644 index 000000000..8464c8034 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt @@ -0,0 +1,7 @@ +( *|[0-9]+>)CMake Error at .*GoogleTestAddTests.cmake:[0-9]+ \(message\): +( *|[0-9]+>) Error running test executable. +?( *|[0-9]+>) +( *|[0-9]+>) Path: '.*timeout_test(\.exe)?' +( *|[0-9]+>) Result: Process terminated due to timeout +( *|[0-9]+>) Output: +( *|[0-9]+>) + diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake index 9a3677fae..5e4b8ef06 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest.cmake +++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake @@ -11,5 +11,19 @@ gtest_discover_tests( TEST_PREFIX TEST: TEST_SUFFIX !1 EXTRA_ARGS how now "\"brown\" cow" - PROPERTIES LABELS TEST + PROPERTIES LABELS TEST1 +) + +gtest_discover_tests( + fake_gtest + TEST_PREFIX TEST: + TEST_SUFFIX !2 + EXTRA_ARGS how now "\"brown\" cow" + PROPERTIES LABELS TEST2 +) + +add_executable(timeout_test timeout_test.cpp) + +gtest_discover_tests( + timeout_test ) diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake index aec8568d0..73014d143 100644 --- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake @@ -9,16 +9,43 @@ function(run_GoogleTest) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(GoogleTest) + run_cmake_command(GoogleTest-build ${CMAKE_COMMAND} --build . --config Debug + --target fake_gtest + ) + + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(GoogleTest-timeout + ${CMAKE_COMMAND} + --build . + --config Debug + --target timeout_test + ) + set(RunCMake_TEST_OUTPUT_MERGE 0) + + run_cmake_command(GoogleTest-test1 + ${CMAKE_CTEST_COMMAND} + -C Debug + -L TEST1 + --no-label-summary ) - run_cmake_command(GoogleTest-test + + run_cmake_command(GoogleTest-test2 + ${CMAKE_CTEST_COMMAND} + -C Debug + -L TEST2 + --no-label-summary + ) + + run_cmake_command(GoogleTest-test-missing ${CMAKE_CTEST_COMMAND} -C Debug - -L TEST + -R timeout --no-label-summary ) endfunction() diff --git a/Tests/RunCMake/GoogleTest/timeout_test.cpp b/Tests/RunCMake/GoogleTest/timeout_test.cpp new file mode 100644 index 000000000..a8e5c1ce4 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/timeout_test.cpp @@ -0,0 +1,15 @@ +#if defined(_WIN32) +#include +#else +#include +#endif + +int main() +{ +#if defined(_WIN32) + Sleep(10000); +#else + sleep(10); +#endif + return 0; +} diff --git a/bootstrap b/bootstrap index 47f7e769f..6da87e774 100755 --- a/bootstrap +++ b/bootstrap @@ -1056,6 +1056,7 @@ TMPFILE=`cmake_tmp_file` echo ' #include #include +#include #if __cplusplus < 201103L #error "Compiler is not in a mode aware of C++11." -- cgit v1.2.3