From a29af6656f1c33355c4cbfe8587b8f6eae691a21 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 10 Aug 2022 10:57:24 +0200 Subject: [PATCH] CMake: Fix detection of system double-conversion ...if the double-conversion CMake package cannot be loaded. The find_path call must specify the header exactly as it is included. The select_library_configurations call always failed, because the command expects the presence of DOUBLE_CONVERSIONS_LIBRARY_DEBUG, DOUBLE_CONVERSIONS_LIBRARY_RELEASE, or both. Upstream double-conversion's MSVC build system does not specify a naming scheme for the debug build, and there are no debug/release binaries to download that suggest a naming scheme. Therefore we assume the usual 'd' suffix for the debug library like we do everywhere else. Lastly, we need to set DOUBLE_CONVERSION_INCLUDE_DIRS. Fixes: QTBUG-105501 Pick-to: 6.2 6.3 6.4 Change-Id: I71ff5238f353541b8bf5ac6792b86134deba20d1 Reviewed-by: Alexandru Croitor --- cmake/FindWrapSystemDoubleConversion.cmake | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmake/FindWrapSystemDoubleConversion.cmake b/cmake/FindWrapSystemDoubleConversion.cmake index 49600726e6d..cb3a16c2c71 100644 --- a/cmake/FindWrapSystemDoubleConversion.cmake +++ b/cmake/FindWrapSystemDoubleConversion.cmake @@ -31,14 +31,19 @@ if(NOT __double_conversion_found) find_path(DOUBLE_CONVERSION_INCLUDE_DIR NAMES - double-conversion.h - PATH_SUFFIXES - double-conversion + double-conversion/double-conversion.h ) - find_library(DOUBLE_CONVERSION_LIBRARY NAMES double-conversion) + + find_library(DOUBLE_CONVERSION_LIBRARY_RELEASE NAMES double-conversion) + + # We assume a possible debug build of this library to be named with a d suffix. + # Adjust accordingly if a different naming scheme is established. + find_library(DOUBLE_CONVERSION_LIBRARY_DEBUG NAMES double-conversiond) + include(SelectLibraryConfigurations) select_library_configurations(DOUBLE_CONVERSION) mark_as_advanced(DOUBLE_CONVERSION_INCLUDE_DIR DOUBLE_CONVERSION_LIBRARY) + set(DOUBLE_CONVERSION_INCLUDE_DIRS "${DOUBLE_CONVERSION_INCLUDE_DIR}") if(DOUBLE_CONVERSION_LIBRARIES AND DOUBLE_CONVERSION_INCLUDE_DIRS) set(__double_conversion_found TRUE)