diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:20:27 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:20:27 +0900 |
commit | f7fbee1ce7e4f73a5a46681cf010a9ac85c3ad87 (patch) | |
tree | a0d779b32b006b5dbbc54a95cce0cd5d0309eebf | |
parent | 50e508f0913d5580aa156327527da3d29a66b90c (diff) | |
download | cmake-f7fbee1ce7e4f73a5a46681cf010a9ac85c3ad87.tar.gz cmake-f7fbee1ce7e4f73a5a46681cf010a9ac85c3ad87.tar.bz2 cmake-f7fbee1ce7e4f73a5a46681cf010a9ac85c3ad87.zip |
Imported Upstream version 3.19.1upstream/3.19.1
60 files changed, 231 insertions, 228 deletions
diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst index be63e9db7..a29dc076e 100644 --- a/Help/release/3.19.rst +++ b/Help/release/3.19.rst @@ -330,3 +330,21 @@ Other Changes * If ``CUDA`` compiler detection fails with user-specified :variable:`CMAKE_CUDA_ARCHITECTURES` or :variable:`CMAKE_CUDA_HOST_COMPILER`, an error is raised. + +Updates +======= + +Changes made since CMake 3.19.0 include the following. + +3.19.1 +------ + +* CMake 3.19.0 compiles source files with the :prop_sf:`LANGUAGE` + property by passing an explicit language flag such as ``-x c``. + This is consistent with the property's documented meaning that + the source file is written in the specified language. However, + it can break projects that were using the property only to + cause the specified language's compiler to be used. This has + been reverted to restore behavior from CMake 3.18 and below. + +* CUDA 11.1 support for Clang. diff --git a/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst b/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst index 84ba12de9..d5893c9f8 100644 --- a/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst +++ b/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_COVERAGE_EXCLUDE ----------------------------- -.. versionadded:: 3.4 - A list of regular expressions which will be used to exclude files by their path from coverage output by the :command:`ctest_coverage` command. diff --git a/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst b/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst index 7191ce4a2..cd65ae327 100644 --- a/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst +++ b/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_ERROR_EXCEPTION ---------------------------- -.. versionadded:: 3.4 - A list of regular expressions which will be used to exclude when detecting error messages in build outputs by the :command:`ctest_test` command. diff --git a/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst b/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst index 5d213f297..558f5e580 100644 --- a/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst +++ b/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_ERROR_MATCH ------------------------ -.. versionadded:: 3.4 - A list of regular expressions which will be used to detect error messages in build outputs by the :command:`ctest_test` command. diff --git a/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst b/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst index 452d060be..614859bc8 100644 --- a/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst +++ b/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_ERROR_POST_CONTEXT ------------------------------- -.. versionadded:: 3.4 - The number of lines to include as context which follow an error message by the :command:`ctest_test` command. The default is 10. diff --git a/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst b/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst index b7717dd47..74dc47ad2 100644 --- a/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst +++ b/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_ERROR_PRE_CONTEXT ------------------------------ -.. versionadded:: 3.4 - The number of lines to include as context which precede an error message by the :command:`ctest_test` command. The default is 10. diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst index 31ba09955..5aeae88a4 100644 --- a/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE -------------------------------------------- -.. versionadded:: 3.4 - When saving a failing test's output, this is the maximum size, in bytes, that will be collected by the :command:`ctest_test` command. Defaults to 307200 (300 KiB). diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst index e5be1ad26..920cb0476 100644 --- a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS ------------------------------------- -.. versionadded:: 3.4 - The maximum number of errors in a single build step which will be detected. After this, the :command:`ctest_test` command will truncate the output. Defaults to 50. diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst index b513a5cfe..a1f1cc14b 100644 --- a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS --------------------------------------- -.. versionadded:: 3.4 - The maximum number of warnings in a single build step which will be detected. After this, the :command:`ctest_test` command will truncate the output. Defaults to 50. diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst index 08762d83b..1fbb8c53f 100644 --- a/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE -------------------------------------------- -.. versionadded:: 3.4 - When saving a passing test's output, this is the maximum size, in bytes, that will be collected by the :command:`ctest_test` command. Defaults to 1024 (1 KiB). diff --git a/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst b/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst index 405fc3346..578576cd6 100644 --- a/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst +++ b/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_MEMCHECK_IGNORE ---------------------------- -.. versionadded:: 3.4 - A list of regular expressions to use to exclude tests during the :command:`ctest_memcheck` command. diff --git a/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst b/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst index 5e488a738..40291febd 100644 --- a/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst +++ b/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_POST_MEMCHECK -------------------------- -.. versionadded:: 3.4 - A list of commands to run at the end of the :command:`ctest_memcheck` command. .. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_POST_TEST.rst b/Help/variable/CTEST_CUSTOM_POST_TEST.rst index 7ec42f7ec..791292cd0 100644 --- a/Help/variable/CTEST_CUSTOM_POST_TEST.rst +++ b/Help/variable/CTEST_CUSTOM_POST_TEST.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_POST_TEST ---------------------- -.. versionadded:: 3.4 - A list of commands to run at the end of the :command:`ctest_test` command. .. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst b/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst index 99e47bdad..00de8aa2b 100644 --- a/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst +++ b/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_PRE_MEMCHECK ------------------------- -.. versionadded:: 3.4 - A list of commands to run at the start of the :command:`ctest_memcheck` command. diff --git a/Help/variable/CTEST_CUSTOM_PRE_TEST.rst b/Help/variable/CTEST_CUSTOM_PRE_TEST.rst index 95c631403..6af7152ef 100644 --- a/Help/variable/CTEST_CUSTOM_PRE_TEST.rst +++ b/Help/variable/CTEST_CUSTOM_PRE_TEST.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_PRE_TEST ---------------------- -.. versionadded:: 3.4 - A list of commands to run at the start of the :command:`ctest_test` command. .. include:: CTEST_CUSTOM_XXX.txt diff --git a/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst b/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst index 27a75d9b1..57222ca1e 100644 --- a/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst +++ b/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_TESTS_IGNORE ------------------------- -.. versionadded:: 3.14 - A list of regular expressions to use to exclude tests during the :command:`ctest_test` command. diff --git a/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst b/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst index 539760b12..a03d47342 100644 --- a/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst +++ b/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_WARNING_EXCEPTION ------------------------------ -.. versionadded:: 3.4 - A list of regular expressions which will be used to exclude when detecting warning messages in build outputs by the :command:`ctest_build` command. diff --git a/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst b/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst index 53e77073e..18aa6b31d 100644 --- a/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst +++ b/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst @@ -1,8 +1,6 @@ CTEST_CUSTOM_WARNING_MATCH -------------------------- -.. versionadded:: 3.4 - A list of regular expressions which will be used to detect warning messages in build outputs by the :command:`ctest_build` command. diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 9220551f3..972adefd1 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -176,13 +176,15 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN) # In a non-scattered installation the following are equivalent to CMAKE_CUDA_COMPILER_TOOLKIT_ROOT. # We first check for a non-scattered installation to prefer it over a scattered installation. - # CMAKE_CUDA_COMPILER_LIBRARY_ROOT contains the device library and version file. - if(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/version.txt") + # CMAKE_CUDA_COMPILER_LIBRARY_ROOT contains the device library. + if(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/nvvm/libdevice") set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}") - elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/version.txt") + elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/nvvm/libdevice") set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT_LINK}/usr/lib/cuda") - elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/cuda/version.txt") + elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/cuda/nvvm/libdevice") set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT}/usr/lib/cuda") + else() + message(FATAL_ERROR "Couldn't find CUDA library root.") endif() # CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT contains the linking stubs necessary for device linking and other low-level library files. diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake index 26a4bbd33..2794f52bb 100644 --- a/Modules/Compiler/AppleClang-C.cmake +++ b/Modules/Compiler/AppleClang-C.cmake @@ -1,8 +1,6 @@ include(Compiler/Clang) __compiler_clang(C) -set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) - if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index 611c67457..15edc21e9 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -1,8 +1,6 @@ include(Compiler/Clang) __compiler_clang(CXX) -set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) - if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index fb6ffa7b0..7c4a263f6 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -8,8 +8,6 @@ endif() if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC") set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl") -elseif("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") - set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) endif() if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 311d2b07f..789e99159 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -2,9 +2,7 @@ include(Compiler/Clang) __compiler_clang(CXX) __compiler_clang_cxx_standards(CXX) - if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") - set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") endif() diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index 8105a77f6..ca286b397 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -1,8 +1,6 @@ include(Compiler/GNU) __compiler_gnu(C) -set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index 59ec05691..fcaaeab43 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -1,8 +1,6 @@ include(Compiler/GNU) __compiler_gnu(CXX) -set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) - if (WIN32) if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fno-keep-inline-dllexport") diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 322f63d0d..ec3bfd88f 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -28,8 +28,6 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") else() - set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 42adfd10c..b71b946e9 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -42,8 +42,6 @@ if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") else() - set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0) set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20") diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake index 78c44d5d7..2077bdabd 100644 --- a/Modules/Compiler/XL-C.cmake +++ b/Modules/Compiler/XL-C.cmake @@ -6,8 +6,6 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG") # -qthreaded = Ensures that all optimizations will be thread-safe string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded") -set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -qsourcetype=c) - if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89") diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 3b911f3d6..41e3e1119 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -6,8 +6,6 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG") # -qthreaded = Ensures that all optimizations will be thread-safe string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded") -set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -+) - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) if(CMAKE_SYSTEM MATCHES "Linux") set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") @@ -34,3 +32,6 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) endif () __compiler_check_default_language_standard(CXX 10.1 98) + +set(CMAKE_CXX_COMPILE_OBJECT + "<CMAKE_CXX_COMPILER> -+ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") diff --git a/Modules/Compiler/XLClang-C.cmake b/Modules/Compiler/XLClang-C.cmake index 1668a4d0f..54c18a668 100644 --- a/Modules/Compiler/XLClang-C.cmake +++ b/Modules/Compiler/XLClang-C.cmake @@ -1,8 +1,6 @@ include(Compiler/XLClang) __compiler_xlclang(C) -set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) - if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake index 02638c791..9ea3d7cac 100644 --- a/Modules/Compiler/XLClang-CXX.cmake +++ b/Modules/Compiler/XLClang-CXX.cmake @@ -1,8 +1,6 @@ include(Compiler/XLClang) __compiler_xlclang(CXX) -set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index 10e31b29f..53cab1a76 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -96,27 +96,6 @@ function(__gtest_find_library _name) mark_as_advanced(${_name}) endfunction() -function(__gtest_find_library_configuration _name _lib _cfg_suffix) - set(_libs ${_lib}) - if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD") - # The provided /MD project files for Google Test add -md suffixes to the - # library names. - list(INSERT _libs 0 ${_lib}-md) - endif() - list(TRANSFORM _libs APPEND "${_cfg_suffix}") - - __gtest_find_library(${_name} ${_libs}) -endfunction() - -include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) -function(__gtest_find_and_select_library_configurations _basename _lib) - __gtest_find_library_configuration(${_basename}_LIBRARY_RELEASE ${_lib} "") - __gtest_find_library_configuration(${_basename}_LIBRARY_DEBUG ${_lib} "d") - - select_library_configurations(${_basename}) - set(${_basename}_LIBRARY ${${_basename}_LIBRARY} PARENT_SCOPE) -endfunction() - macro(__gtest_determine_windows_library_type _var) if(EXISTS "${${_var}}") file(TO_NATIVE_PATH "${${_var}}" _lib_path) @@ -208,13 +187,18 @@ find_path(GTEST_INCLUDE_DIR gtest/gtest.h ) mark_as_advanced(GTEST_INCLUDE_DIR) -# Allow GTEST_LIBRARY and GTEST_MAIN_LIBRARY to be set manually, as the -# locations of the gtest and gtest_main libraries, respectively. -if(NOT GTEST_LIBRARY) - __gtest_find_and_select_library_configurations(GTEST gtest) -endif() -if(NOT GTEST_MAIN_LIBRARY) - __gtest_find_and_select_library_configurations(GTEST_MAIN gtest_main) +if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD") + # The provided /MD project files for Google Test add -md suffixes to the + # library names. + __gtest_find_library(GTEST_LIBRARY gtest-md gtest) + __gtest_find_library(GTEST_LIBRARY_DEBUG gtest-mdd gtestd) + __gtest_find_library(GTEST_MAIN_LIBRARY gtest_main-md gtest_main) + __gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind) +else() + __gtest_find_library(GTEST_LIBRARY gtest) + __gtest_find_library(GTEST_LIBRARY_DEBUG gtestd) + __gtest_find_library(GTEST_MAIN_LIBRARY gtest_main) + __gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind) endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 022b80ffb..676c6f1e9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 19) -set(CMake_VERSION_PATCH 0) +set(CMake_VERSION_PATCH 1) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) @@ -21,7 +21,7 @@ endif() if(NOT CMake_VERSION_NO_GIT) # If this source was exported by 'git archive', use its commit info. - set(git_info [==[222bf361e4 CMake 3.19.0]==]) + set(git_info [==[64fb825438 CMake 3.19.1]==]) # Otherwise, try to identify the current development source version. if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* " diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 1c7e4b168..7c3614435 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -349,13 +349,6 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject( if (language.empty()) { language = "C"; } - - // explicitly add the explicit language flag before any other flag - // this way backwards compatibility with user flags is maintained - if (source->GetProperty("LANGUAGE")) { - lg->AppendFeatureOptions(flags, language, "EXPLICIT_LANGUAGE"); - } - std::string const& config = lg->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); diff --git a/Source/cmFileTime.cxx b/Source/cmFileTime.cxx index 96c70fef6..0606baf71 100644 --- a/Source/cmFileTime.cxx +++ b/Source/cmFileTime.cxx @@ -24,13 +24,13 @@ bool cmFileTime::Load(std::string const& fileName) } # if CMake_STAT_HAS_ST_MTIM // Nanosecond resolution - this->NS = fst.st_mtim.tv_sec * NsPerS + fst.st_mtim.tv_nsec; + this->Time = fst.st_mtim.tv_sec * UtPerS + fst.st_mtim.tv_nsec; # elif CMake_STAT_HAS_ST_MTIMESPEC // Nanosecond resolution - this->NS = fst.st_mtimespec.tv_sec * NsPerS + fst.st_mtimespec.tv_nsec; + this->Time = fst.st_mtimespec.tv_sec * UtPerS + fst.st_mtimespec.tv_nsec; # else // Second resolution - this->NS = fst.st_mtime * NsPerS; + this->Time = fst.st_mtime * UtPerS; # endif #else // Windows version. Get the modification time from extended file attributes. @@ -41,10 +41,11 @@ bool cmFileTime::Load(std::string const& fileName) } // Copy the file time to the output location. - this->NS = (static_cast<NSC>(fdata.ftLastWriteTime.dwHighDateTime) << 32) | - static_cast<NSC>(fdata.ftLastWriteTime.dwLowDateTime); - // The file time resolution is 100 ns. - this->NS *= 100; + using uint64 = unsigned long long; + + this->Time = static_cast<TimeType>( + (uint64(fdata.ftLastWriteTime.dwHighDateTime) << 32) + + fdata.ftLastWriteTime.dwLowDateTime); #endif return true; } diff --git a/Source/cmFileTime.h b/Source/cmFileTime.h index f496cdc82..441988065 100644 --- a/Source/cmFileTime.h +++ b/Source/cmFileTime.h @@ -13,9 +13,15 @@ class cmFileTime { public: - using NSC = long long; - static constexpr NSC NsPerS = 1000000000; - + using TimeType = long long; + // unit time per second +#if !defined(_WIN32) || defined(__CYGWIN__) + // unit time is one nanosecond + static constexpr TimeType UtPerS = 1000000000; +#else + // unit time is 100 nanosecond + static constexpr TimeType UtPerS = 10000000; +#endif cmFileTime() = default; ~cmFileTime() = default; @@ -28,22 +34,28 @@ public: /** * @brief Return true if this is older than ftm */ - bool Older(cmFileTime const& ftm) const { return (this->NS - ftm.NS) < 0; } + bool Older(cmFileTime const& ftm) const + { + return (this->Time - ftm.Time) < 0; + } /** * @brief Return true if this is newer than ftm */ - bool Newer(cmFileTime const& ftm) const { return (ftm.NS - this->NS) < 0; } + bool Newer(cmFileTime const& ftm) const + { + return (ftm.Time - this->Time) < 0; + } /** * @brief Return true if this is the same as ftm */ - bool Equal(cmFileTime const& ftm) const { return this->NS == ftm.NS; } + bool Equal(cmFileTime const& ftm) const { return this->Time == ftm.Time; } /** * @brief Return true if this is not the same as ftm */ - bool Differ(cmFileTime const& ftm) const { return this->NS != ftm.NS; } + bool Differ(cmFileTime const& ftm) const { return this->Time != ftm.Time; } /** * @brief Compare file modification times. @@ -51,7 +63,7 @@ public: */ int Compare(cmFileTime const& ftm) const { - NSC const diff = this->NS - ftm.NS; + TimeType const diff = this->Time - ftm.Time; if (diff == 0) { return 0; } @@ -65,7 +77,7 @@ public: */ bool OlderS(cmFileTime const& ftm) const { - return (ftm.NS - this->NS) >= cmFileTime::NsPerS; + return (ftm.Time - this->Time) >= cmFileTime::UtPerS; } /** @@ -73,7 +85,7 @@ public: */ bool NewerS(cmFileTime const& ftm) const { - return (this->NS - ftm.NS) >= cmFileTime::NsPerS; + return (this->Time - ftm.Time) >= cmFileTime::UtPerS; } /** @@ -81,11 +93,11 @@ public: */ bool EqualS(cmFileTime const& ftm) const { - NSC diff = this->NS - ftm.NS; + TimeType diff = this->Time - ftm.Time; if (diff < 0) { diff = -diff; } - return (diff < cmFileTime::NsPerS); + return (diff < cmFileTime::UtPerS); } /** @@ -93,11 +105,11 @@ public: */ bool DifferS(cmFileTime const& ftm) const { - NSC diff = this->NS - ftm.NS; + TimeType diff = this->Time - ftm.Time; if (diff < 0) { diff = -diff; } - return (diff >= cmFileTime::NsPerS); + return (diff >= cmFileTime::UtPerS); } /** @@ -107,21 +119,21 @@ public: */ int CompareS(cmFileTime const& ftm) const { - NSC const diff = this->NS - ftm.NS; - if (diff <= -cmFileTime::NsPerS) { + TimeType const diff = this->Time - ftm.Time; + if (diff <= -cmFileTime::UtPerS) { return -1; } - if (diff >= cmFileTime::NsPerS) { + if (diff >= cmFileTime::UtPerS) { return 1; } return 0; } /** - * @brief The file modification time in nanoseconds + * @brief The file modification time in unit time per second */ - NSC GetNS() const { return this->NS; } + TimeType GetTime() const { return this->Time; } private: - NSC NS = 0; + TimeType Time = 0; }; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1197db6dd..fc40d63b3 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -584,7 +584,8 @@ void cmGlobalGenerator::EnableLanguage( // Find the native build tool for this generator. // This has to be done early so that MSBuild can be used to examine the // cross-compilation environment. - if (!this->FindMakeProgram(mf)) { + if (this->GetFindMakeProgramStage() == FindMakeProgramStage::Early && + !this->FindMakeProgram(mf)) { return; } } @@ -660,6 +661,12 @@ void cmGlobalGenerator::EnableLanguage( cmSystemTools::SetFatalErrorOccured(); return; } + + // Find the native build tool for this generator. + if (this->GetFindMakeProgramStage() == FindMakeProgramStage::Late && + !this->FindMakeProgram(mf)) { + return; + } } // Check that the languages are supported by the generator and its diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index b532a439c..c106258ad 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -597,6 +597,17 @@ protected: std::string GetPredefinedTargetsFolder(); + enum class FindMakeProgramStage + { + Early, + Late, + }; + + virtual FindMakeProgramStage GetFindMakeProgramStage() const + { + return FindMakeProgramStage::Late; + } + private: using TargetMap = std::unordered_map<std::string, cmTarget*>; using GeneratorTargetMap = diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 3c464083c..3bfcbd04d 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -166,6 +166,11 @@ protected: void WriteSLNHeader(std::ostream& fout); + FindMakeProgramStage GetFindMakeProgramStage() const override + { + return FindMakeProgramStage::Early; + } + bool ComputeTargetDepends() override; class VSDependSet : public std::set<std::string> { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 766ae7224..7ee94b294 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -937,14 +937,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( default: break; } - - // explicitly add the explicit language flag before any other flag - // this way backwards compatibility with user flags is maintained - if (sf->GetProperty("LANGUAGE")) { - this->CurrentLocalGenerator->AppendFeatureOptions(flags, lang, - "EXPLICIT_LANGUAGE"); - } - const std::string COMPILE_FLAGS("COMPILE_FLAGS"); if (cmProp cflags = sf->GetProperty(COMPILE_FLAGS)) { lg->AppendFlags(flags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS)); @@ -1973,6 +1965,15 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateRunScriptBuildPhase( return buildPhase; } +namespace { +void ReplaceScriptVars(std::string& cmd) +{ + cmSystemTools::ReplaceString(cmd, "$(CONFIGURATION)", "$CONFIGURATION"); + cmSystemTools::ReplaceString(cmd, "$(EFFECTIVE_PLATFORM_NAME)", + "$EFFECTIVE_PLATFORM_NAME"); +} +} + std::string cmGlobalXCodeGenerator::ConstructScript( cmCustomCommandGenerator const& ccg) { @@ -1983,6 +1984,7 @@ std::string cmGlobalXCodeGenerator::ConstructScript( wd = lg->GetCurrentBinaryDirectory(); } wd = lg->ConvertToOutputFormat(wd, cmOutputConverter::SHELL); + ReplaceScriptVars(wd); script = cmStrCat(script, " cd ", wd, "\n"); for (unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) { std::string cmd = ccg.GetCommand(c); @@ -1992,9 +1994,7 @@ std::string cmGlobalXCodeGenerator::ConstructScript( cmSystemTools::ReplaceString(cmd, "/./", "/"); cmd = lg->ConvertToOutputFormat(cmd, cmOutputConverter::SHELL); ccg.AppendArguments(c, cmd); - cmSystemTools::ReplaceString(cmd, "$(CONFIGURATION)", "$CONFIGURATION"); - cmSystemTools::ReplaceString(cmd, "$(EFFECTIVE_PLATFORM_NAME)", - "$EFFECTIVE_PLATFORM_NAME"); + ReplaceScriptVars(cmd); script = cmStrCat(script, " ", cmd, '\n'); } return script; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 5b052143a..ab5eeb2dd 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -124,6 +124,11 @@ protected: void AddExtraIDETargets() override; void Generate() override; + FindMakeProgramStage GetFindMakeProgramStage() const override + { + return FindMakeProgramStage::Early; + } + private: bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf); bool ProcessGeneratorToolsetField(std::string const& key, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 5f97d868f..3776fecc7 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -573,13 +573,6 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( // Build the set of compiler flags. std::string flags; - // explicitly add the explicit language flag before any other flag - // this way backwards compatibility with user flags is maintained - if (source.GetProperty("LANGUAGE")) { - this->LocalGenerator->AppendFeatureOptions(flags, lang, - "EXPLICIT_LANGUAGE"); - } - // Add language-specific flags. std::string langFlags = cmStrCat("$(", lang, "_FLAGS", filterArch, ")"); this->LocalGenerator->AppendFlags(flags, langFlags); @@ -838,13 +831,17 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( compileCommand.replace(compileCommand.find(langFlags), langFlags.size(), this->GetFlags(lang, this->GetConfigName())); std::string langDefines = std::string("$(") + lang + "_DEFINES)"; - compileCommand.replace(compileCommand.find(langDefines), - langDefines.size(), - this->GetDefines(lang, this->GetConfigName())); + std::string::size_type ldPos = compileCommand.find(langDefines); + if (ldPos != std::string::npos) { + compileCommand.replace(ldPos, langDefines.size(), + this->GetDefines(lang, this->GetConfigName())); + } std::string langIncludes = std::string("$(") + lang + "_INCLUDES)"; - compileCommand.replace(compileCommand.find(langIncludes), - langIncludes.size(), - this->GetIncludes(lang, this->GetConfigName())); + std::string::size_type liPos = compileCommand.find(langIncludes); + if (liPos != std::string::npos) { + compileCommand.replace(liPos, langIncludes.size(), + this->GetIncludes(lang, this->GetConfigName())); + } cmProp eliminate[] = { this->Makefile->GetDefinition("CMAKE_START_TEMP_FILE"), diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 04d84a089..76df9f231 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -190,16 +190,7 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject( } } - std::string flags; - // explicitly add the explicit language flag before any other flag - // this way backwards compatibility with user flags is maintained - if (source->GetProperty("LANGUAGE")) { - this->LocalGenerator->AppendFeatureOptions(flags, language, - "EXPLICIT_LANGUAGE"); - flags += " "; - } - - flags += this->GetFlags(language, config, filterArch); + std::string flags = this->GetFlags(language, config, filterArch); // Add Fortran format flags. if (language == "Fortran") { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e076d1e39..d26de9cd4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2045,35 +2045,37 @@ std::string cmTarget::ImportedGetFullPath( } if (result.empty()) { - auto message = [&]() -> std::string { - std::string unset; - std::string configuration; - - if (artifact == cmStateEnums::RuntimeBinaryArtifact) { - unset = "IMPORTED_LOCATION"; - } else if (artifact == cmStateEnums::ImportLibraryArtifact) { - unset = "IMPORTED_IMPLIB"; - } - - if (!config.empty()) { - configuration = cmStrCat(" configuration \"", config, "\""); - } + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) { + auto message = [&]() -> std::string { + std::string unset; + std::string configuration; + + if (artifact == cmStateEnums::RuntimeBinaryArtifact) { + unset = "IMPORTED_LOCATION"; + } else if (artifact == cmStateEnums::ImportLibraryArtifact) { + unset = "IMPORTED_IMPLIB"; + } - return cmStrCat(unset, " not set for imported target \"", - this->GetName(), "\"", configuration, "."); - }; + if (!config.empty()) { + configuration = cmStrCat(" configuration \"", config, "\""); + } - switch (this->GetPolicyStatus(cmPolicies::CMP0111)) { - case cmPolicies::WARN: - impl->Makefile->IssueMessage( - MessageType::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(cmPolicies::CMP0111) + "\n" + - message()); - CM_FALLTHROUGH; - case cmPolicies::OLD: - break; - default: - impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, message()); + return cmStrCat(unset, " not set for imported target \"", + this->GetName(), "\"", configuration, "."); + }; + + switch (this->GetPolicyStatus(cmPolicies::CMP0111)) { + case cmPolicies::WARN: + impl->Makefile->IssueMessage( + MessageType::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0111) + "\n" + + message()); + CM_FALLTHROUGH; + case cmPolicies::OLD: + break; + default: + impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, message()); + } } result = cmStrCat(this->GetName(), "-NOTFOUND"); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index a482ed686..4eb3b7f8f 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3944,7 +3944,8 @@ void cmVisualStudio10TargetGenerator::AddLibraries( if (managedType != cmGeneratorTarget::ManagedType::Native && this->GeneratorTarget->GetManagedType(config) != cmGeneratorTarget::ManagedType::Native && - l.Target->IsImported()) { + l.Target->IsImported() && + l.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { auto location = l.Target->GetFullPath(config); if (!location.empty()) { ConvertToWindowsSlash(location); diff --git a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake index 564169d80..c31e4ba03 100644 --- a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake +++ b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake @@ -4,6 +4,7 @@ set(CMAKE_IMPORT_LIBRARY_SUFFIX "placeholder") add_library(unknown_lib UNKNOWN IMPORTED) add_library(static_lib STATIC IMPORTED) add_library(shared_lib SHARED IMPORTED) +add_library(interface_lib INTERFACE IMPORTED) -add_executable(executable main.cpp) -target_link_libraries(executable unknown_lib static_lib shared_lib) +add_library(module MODULE module.cpp) +target_link_libraries(module unknown_lib static_lib shared_lib interface_lib) diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt index ba5d9369f..91a90e57a 100644 --- a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt @@ -1,7 +1,17 @@ +^CMake Error in CMakeLists.txt: + IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration + "[^"]+")?. ++ CMake Error in CMakeLists.txt: IMPORTED_LOCATION not set for imported target "static_lib"( configuration - ".+")?. + "[^"]+")?. + CMake Error in CMakeLists.txt: IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration - ".+")?. + "[^"]+")?.( ++ +CMake Error in CMakeLists.txt: + IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration + "[^"]+")?.)* ++ +CMake Generate step failed. Build files cannot be regenerated correctly.$ diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt index 3abca0ab0..27af91108 100644 --- a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt @@ -1,11 +1,11 @@ -CMake Warning \(dev\) in CMakeLists.txt: +^CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0111 is not set: An imported target missing its location property fails during generation. Run "cmake --help-policy CMP0111" for policy details. Use the cmake_policy command to set the policy and suppress this warning. IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration - ".+")?. + "[^"]+")?. This warning is for project developers. Use -Wno-dev to suppress it. + CMake Warning \(dev\) in CMakeLists.txt: @@ -15,7 +15,7 @@ CMake Warning \(dev\) in CMakeLists.txt: warning. IMPORTED_LOCATION not set for imported target "static_lib"( configuration - ".+")?. + "[^"]+")?. This warning is for project developers. Use -Wno-dev to suppress it. + CMake Warning \(dev\) in CMakeLists.txt: @@ -25,5 +25,15 @@ CMake Warning \(dev\) in CMakeLists.txt: warning. IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration - ".+")?. -This warning is for project developers. Use -Wno-dev to suppress it. + "[^"]+")?. +This warning is for project developers. Use -Wno-dev to suppress it.( ++ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0111 is not set: An imported target missing its location property + fails during generation. Run "cmake --help-policy CMP0111" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration + "[^"]+")?. +This warning is for project developers. Use -Wno-dev to suppress it.)*$ diff --git a/Tests/RunCMake/CMP0111/main.cpp b/Tests/RunCMake/CMP0111/main.cpp deleted file mode 100644 index 5047a34e3..000000000 --- a/Tests/RunCMake/CMP0111/main.cpp +++ /dev/null @@ -1,3 +0,0 @@ -int main() -{ -} diff --git a/Tests/RunCMake/CMP0111/module.cpp b/Tests/RunCMake/CMP0111/module.cpp new file mode 100644 index 000000000..b82bb3121 --- /dev/null +++ b/Tests/RunCMake/CMP0111/module.cpp @@ -0,0 +1,4 @@ +int module() +{ + return 0; +} diff --git a/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake b/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake new file mode 100644 index 000000000..12368a29b --- /dev/null +++ b/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake @@ -0,0 +1,5 @@ +enable_language(C) +add_library(empty STATIC empty.c) +string(REPLACE "<DEFINES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}") +string(REPLACE "<INCLUDES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}") +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake index b540a0450..9e7e73219 100644 --- a/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake @@ -1,3 +1,4 @@ include(RunCMake) run_cmake_with_options(BeforeProject -DCMAKE_PROJECT_INCLUDE_BEFORE=BeforeProjectBEFORE.cmake) +run_cmake(CustomCompileRule) diff --git a/Tests/RunCMake/add_custom_command/PrintDir.cmake b/Tests/RunCMake/add_custom_command/PrintDir.cmake new file mode 100644 index 000000000..0a7b64607 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/PrintDir.cmake @@ -0,0 +1 @@ +message(STATUS "WorkingDir='${CMAKE_CURRENT_BINARY_DIR}'") diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake index 96642faf1..aac085dc1 100644 --- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake @@ -27,3 +27,18 @@ set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(AssigningMultipleTargets-build ${CMAKE_COMMAND} --build .) unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) + +if(NOT RunCMake_GENERATOR STREQUAL "Ninja Multi-Config") + run_cmake(WorkingDirectory) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/WorkingDirectory-build) + set(RunCMake_TEST_NO_CLEAN 1) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake-stdout-file WorkingDirectory-build-multi-config-stdout.txt) + else() + set(RunCMake-stdout-file WorkingDirectory-build-single-config-stdout.txt) + endif() + run_cmake_command(WorkingDirectory-build ${CMAKE_COMMAND} --build . --config Debug) + unset(RunCMake-stdout-file) + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endif() diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt new file mode 100644 index 000000000..95ecf424f --- /dev/null +++ b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt @@ -0,0 +1 @@ +-- WorkingDir='[^']*/Tests/RunCMake/add_custom_command/WorkingDirectory-build/Debug' diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt new file mode 100644 index 000000000..1db56ae25 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt @@ -0,0 +1 @@ +-- WorkingDir='[^']*/Tests/RunCMake/add_custom_command/WorkingDirectory-build' diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake b/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake new file mode 100644 index 000000000..65b72506e --- /dev/null +++ b/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake @@ -0,0 +1,9 @@ +add_custom_target(mkdir COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>") +add_custom_command( + OUTPUT out.txt + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/PrintDir.cmake + WORKING_DIRECTORY ${CMAKE_CFG_INTDIR} + ) +set_property(SOURCE out.txt PROPERTY SYMBOLIC 1) +add_custom_target(drive ALL DEPENDS out.txt) +add_dependencies(drive mkdir) diff --git a/Tests/SetLang/CMakeLists.txt b/Tests/SetLang/CMakeLists.txt index 616421ed5..9de4fc61d 100644 --- a/Tests/SetLang/CMakeLists.txt +++ b/Tests/SetLang/CMakeLists.txt @@ -15,10 +15,3 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio" AND "x${CMAKE_C_COMPILER_ID}" STREQU add_library(stay stay_c.c stay_cxx.cxx) set_property(TARGET stay PROPERTY COMPILE_OPTIONS "-TP") endif() - -if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)")) - add_library(zoom zoom.zzz) - set_source_files_properties(zoom.zzz PROPERTIES LANGUAGE CXX) - target_link_libraries(SetLang zoom) - target_compile_definitions(SetLang PRIVATE WITH_ZOOM) -endif() diff --git a/Tests/SetLang/bar.c b/Tests/SetLang/bar.c index 515e8c233..b934356fa 100644 --- a/Tests/SetLang/bar.c +++ b/Tests/SetLang/bar.c @@ -1,22 +1,10 @@ #include <stdio.h> int foo(); - -#ifdef WITH_ZOOM -int zoom(); -#endif - class A { public: - A() - { - this->i = foo(); -#ifdef WITH_ZOOM - i += zoom(); - i -= zoom(); -#endif - } + A() { this->i = foo(); } int i; }; diff --git a/Tests/SetLang/zoom.zzz b/Tests/SetLang/zoom.zzz deleted file mode 100644 index a0c8899b6..000000000 --- a/Tests/SetLang/zoom.zzz +++ /dev/null @@ -1,7 +0,0 @@ -int zoom() -{ - int r = 10; - r++; - int ret = r + 10; - return ret; -} |