qt5base-lts/cmake/Finddouble-conversion.cmake
Albert Astals Cid b6306cb066 cmake: Only use the doubleconversion cmake config if "valid"
And by "valid" i mean if it returns the double-conversion::double-conversion
target that we are going to use later. Fedora rawhide has a
doubleconversion cmake config file but it doesn't define any target

Change-Id: Ib0360bc9fdf593a14510c9a2d59b47b32bc4b356
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-01 12:26:43 +00:00

33 lines
1.1 KiB
CMake

# Fallback find module for double-conversion
# if double-conversion is built with CMake it'll install a config module, which we prefer
# if it's built with Scons (their default), we search ourselves
find_package(double-conversion CONFIG)
if (double-conversion_FOUND)
if(TARGET double-conversion::double-conversion)
return()
endif()
endif()
find_path(DOUBLE_CONVERSION_INCLUDE_DIR
NAMES
double-conversion.h
PATH_SUFFIXES
double-conversion
)
find_library(DOUBLE_CONVERSION_LIBRARY NAMES double-conversion)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
double-conversion DEFAULT_MSG
DOUBLE_CONVERSION_LIBRARY DOUBLE_CONVERSION_INCLUDE_DIR)
if(double-conversion_FOUND AND NOT TARGET double-conversion::double-conversion)
add_library(double-conversion::double-conversion UNKNOWN IMPORTED)
set_target_properties(double-conversion::double-conversion PROPERTIES
IMPORTED_LOCATION "${DOUBLE_CONVERSION_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${DOUBLE_CONVERSION_INCLUDE_DIR}")
endif()
mark_as_advanced(DOUBLE_CONVERSION_INCLUDE_DIR DOUBLE_CONVERSION_LIBRARY)