mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-26 10:03:34 +03:00
cmake: Check whether static linking dependencies found in config files
If they were required when building libxml2 then they will also be required when statically linking against it. Failing to find them will just lead to undefined references later so detect this early.
This commit is contained in:
parent
8617d8aa10
commit
9d53452206
@ -102,6 +102,11 @@ if(LIBXML2_WITH_ICONV)
|
||||
find_dependency(Iconv)
|
||||
list(APPEND LIBXML2_LIBRARIES ${Iconv_LIBRARIES})
|
||||
list(APPEND LIBXML2_INCLUDE_DIRS ${Iconv_INCLUDE_DIRS})
|
||||
if(NOT Iconv_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "Iconv dependency was not found")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT LIBXML2_SHARED)
|
||||
@ -110,21 +115,41 @@ if(NOT LIBXML2_SHARED)
|
||||
if(LIBXML2_WITH_THREADS)
|
||||
find_dependency(Threads)
|
||||
list(APPEND LIBXML2_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
if(NOT Threads_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "Threads dependency was not found")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBXML2_WITH_ICU)
|
||||
find_dependency(ICU COMPONENTS data i18n uc)
|
||||
list(APPEND LIBXML2_LIBRARIES ${ICU_LIBRARIES})
|
||||
if(NOT ICU_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "ICU dependency was not found")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBXML2_WITH_LZMA)
|
||||
find_dependency(LibLZMA)
|
||||
list(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES})
|
||||
if(NOT LibLZMA_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "LibLZMA dependency was not found")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBXML2_WITH_ZLIB)
|
||||
find_dependency(ZLIB)
|
||||
list(APPEND LIBXML2_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
if(NOT ZLIB_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "ZLIB dependency was not found")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
|
@ -55,30 +55,55 @@ if(LIBXML2_WITH_ICONV)
|
||||
list(APPEND LIBXML2_LIBRARIES ${Iconv_LIBRARIES})
|
||||
list(APPEND LIBXML2_INCLUDE_DIRS ${Iconv_INCLUDE_DIRS})
|
||||
list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "Iconv::Iconv")
|
||||
if(NOT Iconv_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "Iconv dependency was not found")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBXML2_WITH_THREADS)
|
||||
find_dependency(Threads)
|
||||
list(APPEND LIBXML2_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Threads::Threads>")
|
||||
if(NOT Threads_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "Threads dependency was not found")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBXML2_WITH_ICU)
|
||||
find_dependency(ICU COMPONENTS data i18n uc)
|
||||
list(APPEND LIBXML2_LIBRARIES ${ICU_LIBRARIES})
|
||||
list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:ICU::data>;\$<LINK_ONLY:ICU::i18n>;\$<LINK_ONLY:ICU::uc>")
|
||||
if(NOT ICU_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "ICU dependency was not found")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBXML2_WITH_LZMA)
|
||||
find_dependency(LibLZMA)
|
||||
list(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES})
|
||||
list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:LibLZMA::LibLZMA>")
|
||||
if(NOT LibLZMA_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "LibLZMA dependency was not found")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBXML2_WITH_ZLIB)
|
||||
find_dependency(ZLIB)
|
||||
list(APPEND LIBXML2_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:ZLIB::ZLIB>")
|
||||
if(NOT ZLIB_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "ZLIB dependency was not found")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
|
Loading…
x
Reference in New Issue
Block a user