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
Change-Id: I71ff5238f353541b8bf5ac6792b86134deba20d1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a29af6656f1c33355c4cbfe8587b8f6eae691a21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Joerg Bornemann 2022-08-10 10:57:24 +02:00 committed by Qt Cherry-pick Bot
parent db169494bd
commit 25ba921d50

View File

@ -28,14 +28,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)