[nana] Fix fontconfig dependency (#15595)

* [nana] Fix fontconfig dependency

* Update link library

* Update find_package() as find_dependency() in config.cmake.in

* Remove keyword REQUIRED from find_dependency()
This commit is contained in:
NancyLi1013 2021-01-13 12:14:04 +08:00 committed by GitHub
parent 0fe5f85e7b
commit a904f297e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View File

@ -47,8 +47,8 @@ if(UNIX)
target_include_directories(nana PUBLIC ${X11_INCLUDE_DIR}) target_include_directories(nana PUBLIC ${X11_INCLUDE_DIR})
target_link_libraries(nana PUBLIC ${X11_LIBRARIES} ${X11_Xft_LIB}) target_link_libraries(nana PUBLIC ${X11_LIBRARIES} ${X11_Xft_LIB})
find_library(FONTCONFIG_LIB NAMES fontconfig) find_package(Fontconfig REQUIRED)
target_link_libraries(nana PUBLIC ${FONTCONFIG_LIB}) target_link_libraries(nana PUBLIC Fontconfig::Fontconfig)
endif() endif()
if(NANA_ENABLE_PNG) if(NANA_ENABLE_PNG)

View File

@ -1,5 +1,6 @@
Source: nana Source: nana
Version: 1.7.4 Version: 1.7.4
Port-Version: 1
Homepage: https://github.com/cnjinhao/nana Homepage: https://github.com/cnjinhao/nana
Description: Cross-platform library for GUI programming in modern C++ style. Description: Cross-platform library for GUI programming in modern C++ style.
Build-Depends: libpng, libjpeg-turbo, freetype (!uwp&&!windows), fontconfig (!uwp&&!windows) Build-Depends: libpng, libjpeg-turbo, freetype (!uwp&&!windows), fontconfig (!uwp&&!windows)

View File

@ -1,27 +1,28 @@
@PACKAGE_INIT@ @PACKAGE_INIT@
include(CMakeFindDependencyMacro)
if(UNIX) if(UNIX)
find_package(Threads REQUIRED) find_dependency(Threads)
find_package(Freetype REQUIRED) find_dependency(Freetype)
find_package(X11 REQUIRED) find_dependency(X11)
find_library(FONTCONFIG_LIB NAMES fontconfig) find_dependency(Fontconfig)
endif() endif()
option(NANA_ENABLE_PNG "Enable PNG support" @NANA_ENABLE_PNG@) option(NANA_ENABLE_PNG "Enable PNG support" @NANA_ENABLE_PNG@)
option(NANA_ENABLE_JPEG "Enable JPEG support" @NANA_ENABLE_JPEG@) option(NANA_ENABLE_JPEG "Enable JPEG support" @NANA_ENABLE_JPEG@)
if(NANA_ENABLE_PNG) if(NANA_ENABLE_PNG)
find_package(PNG REQUIRED) find_dependency(PNG)
endif() endif()
if(NANA_ENABLE_JPEG) if(NANA_ENABLE_JPEG)
find_package(JPEG REQUIRED) find_dependency(JPEG)
endif() endif()
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-nana-targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/unofficial-nana-targets.cmake")
if(UNIX) if(UNIX)
target_link_libraries(unofficial::nana::nana INTERFACE ${FONTCONFIG_LIB} ${X11_LIBRARIES} ${X11_Xft_LIB}) target_link_libraries(unofficial::nana::nana INTERFACE Fontconfig::Fontconfig ${X11_LIBRARIES} ${X11_Xft_LIB})
endif() endif()
if(NANA_ENABLE_JPEG) if(NANA_ENABLE_JPEG)