diff options
-rw-r--r-- | Modules/CMakeDetermineCUDACompiler.cmake | 39 | ||||
-rw-r--r-- | Modules/FindOpenSSL.cmake | 9 | ||||
-rw-r--r-- | Modules/Internal/CPack/CPackDeb.cmake | 10 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake | 12 |
6 files changed, 55 insertions, 19 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 4a8a268..ed37d28 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -80,12 +80,23 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN) set(clang_test_flags) endif() + # First try with the user-specified architectures. + if(CMAKE_CUDA_ARCHITECTURES) + set(clang_archs "${clang_test_flags}") + + foreach(arch ${CMAKE_CUDA_ARCHITECTURES}) + # Strip specifiers as PTX vs binary doesn't matter. + string(REGEX MATCH "[0-9]+" arch_name "${arch}") + string(APPEND clang_archs " --cuda-gpu-arch=sm_${arch_name}") + endforeach() + + list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_archs}") + endif() + # Clang doesn't automatically select an architecture supported by the SDK. # Try in reverse order of deprecation with the most recent at front (i.e. the most likely to work for new setups). - foreach(arch ${CMAKE_CUDA_ARCHITECTURES} "20" "30" "52") - # Strip specifiers. - string(REGEX MATCH "[0-9]+" arch_name "${arch}") - list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags} --cuda-gpu-arch=sm_${arch_name}") + foreach(arch "20" "30" "52") + list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags} --cuda-gpu-arch=sm_${arch}") endforeach() # Finally also try the default. @@ -127,13 +138,29 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio") set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")") elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") - # Parse default CUDA architecture. if(NOT CMAKE_CUDA_ARCHITECTURES) + # Find the architecture that we successfully compiled using and set it as the default. string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}") set(CMAKE_CUDA_ARCHITECTURES "${CMAKE_MATCH_1}" CACHE STRING "CUDA architectures") if(NOT CMAKE_CUDA_ARCHITECTURES) - message(FATAL_ERROR "Failed to find default CUDA architecture.") + message(FATAL_ERROR "Failed to find a working CUDA architecture.") + endif() + else() + string(REGEX MATCHALL "-target-cpu sm_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}") + + foreach(cpu ${target_cpus}) + string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${cpu}") + list(APPEND architectures "${CMAKE_MATCH_1}") + endforeach() + + if(NOT "${architectures}" STREQUAL "${CMAKE_CUDA_ARCHITECTURES}") + message(FATAL_ERROR + "The CMAKE_CUDA_ARCHITECTURES:\n" + " ${CMAKE_CUDA_ARCHITECTURES}\n" + "do not all work with this compiler. Try:\n" + " ${architectures}\n" + "instead.") endif() endif() diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index a813ab5..8ddd78e 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -440,6 +440,15 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") endif () set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}") + else () + # Since OpenSSL 3.0.0, the new version format is MAJOR.MINOR.PATCH and + # a new OPENSSL_VERSION_STR macro contains exactly that + file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" OPENSSL_VERSION_STR + REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_STR[\t ]+\"([0-9])+\.([0-9])+\.([0-9])+\".*") + string(REGEX REPLACE "^.*OPENSSL_VERSION_STR[\t ]+\"([0-9]+\.[0-9]+\.[0-9]+)\".*$" + "\\1" OPENSSL_VERSION_STR "${OPENSSL_VERSION_STR}") + + set(OPENSSL_VERSION "${OPENSSL_VERSION_STR}") endif () endif () diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index 14bb104..db35e3a 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -83,6 +83,16 @@ function(cpack_deb_format_package_description TEXT OUTPUT_VAR) string(REPLACE "\n" ";" _lines "${_text}") list(POP_FRONT _lines _summary) + # If the description ends with a newline (e.g. typically if it was read + # from a file) the last line will be empty. We drop it here, otherwise + # it would be replaced by a `.` which would lead to the package violating + # the extended-description-contains-empty-paragraph debian policy + list(POP_BACK _lines _last_line) + string(STRIP "${_last_line}" _last_line_strip) + if(_last_line_strip) + list(APPEND _lines "${_last_line_strip}") + endif() + # Check if reformatting required cpack_deb_check_description("${_summary}" "${_lines}" _result) if(_result) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 60846d4..d343276 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 17) -set(CMake_VERSION_PATCH 20200527) +set(CMake_VERSION_PATCH 20200528) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in index 67b108b..fb973ad 100644 --- a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in +++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in @@ -16,7 +16,7 @@ set(CPACK_COMPONENTS_IGNORE_GROUPS 1) # overriding previous descriptions set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description") # This become a summary line (the first one) of all descriptions -set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "applications_description") +set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "applications_description\n") set(CPACK_COMPONENT_HEADERS_DESCRIPTION "headers_description") # libraries does not have any description and should inherit from CPACK_PACKAGE_DESCRIPTION_SUMMARY # plus content of the `CPACK_PACKAGE_DESCRIPTION_FILE`. diff --git a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake index bfe2059..70ad48b 100644 --- a/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/DEB_DESCRIPTION/VerifyResult.cmake @@ -46,17 +46,7 @@ set(_expected_description [[ Description: This is the summary line . See also: https://www.debian.org/doc/debian-policy/ch-controlfields.html#description]]) -# ATTENTION The code in `cmCPackGenerator.cxx` to read `CPACK_PACKAGE_DESCRIPTION_FILE` -# has a BUG: it appends the `\n` character to every line of the -# input, even if there was no EOL (e.g. at the last line of the file). -# That is WHY for this sub-test the one more pre-formatted "empty" -# line required! -# NOTE For component based installers content of the file gonna read by -# `CPackDeb` module and the `file(READ...)` command so no the mentioned -# workaround required! -if(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_PACKAGE_DESCRIPTION_FILE" AND PACKAGING_TYPE STREQUAL "MONOLITHIC") - string(APPEND _expected_description "\n ." ) -elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_NO_PACKAGE_DESCRIPTION") +if(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_NO_PACKAGE_DESCRIPTION") set(_expected_description [[ Description: This is the summary line]]) elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "CPACK_COMPONENT_COMP_DESCRIPTION") set(_expected_description [[ Description: One line description]]) |