Skip to content

Commit

Permalink
[nana] Fix fontconfig dependency (#15595)
Browse files Browse the repository at this point in the history
* [nana] Fix fontconfig dependency

* Update link library

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

* Remove keyword REQUIRED from find_dependency()
  • Loading branch information
NancyLi1013 authored Jan 13, 2021
1 parent 0fe5f85 commit a904f29
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions ports/nana/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ if(UNIX)
target_include_directories(nana PUBLIC ${X11_INCLUDE_DIR})
target_link_libraries(nana PUBLIC ${X11_LIBRARIES} ${X11_Xft_LIB})

find_library(FONTCONFIG_LIB NAMES fontconfig)
target_link_libraries(nana PUBLIC ${FONTCONFIG_LIB})
find_package(Fontconfig REQUIRED)
target_link_libraries(nana PUBLIC Fontconfig::Fontconfig)
endif()

if(NANA_ENABLE_PNG)
Expand Down
1 change: 1 addition & 0 deletions ports/nana/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Source: nana
Version: 1.7.4
Port-Version: 1
Homepage: https://github.com/cnjinhao/nana
Description: Cross-platform library for GUI programming in modern C++ style.
Build-Depends: libpng, libjpeg-turbo, freetype (!uwp&&!windows), fontconfig (!uwp&&!windows)
15 changes: 8 additions & 7 deletions ports/nana/config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)

if(UNIX)
find_package(Threads REQUIRED)
find_package(Freetype REQUIRED)
find_package(X11 REQUIRED)
find_library(FONTCONFIG_LIB NAMES fontconfig)
find_dependency(Threads)
find_dependency(Freetype)
find_dependency(X11)
find_dependency(Fontconfig)
endif()

option(NANA_ENABLE_PNG "Enable PNG support" @NANA_ENABLE_PNG@)
option(NANA_ENABLE_JPEG "Enable JPEG support" @NANA_ENABLE_JPEG@)

if(NANA_ENABLE_PNG)
find_package(PNG REQUIRED)
find_dependency(PNG)
endif()

if(NANA_ENABLE_JPEG)
find_package(JPEG REQUIRED)
find_dependency(JPEG)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/unofficial-nana-targets.cmake")

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()

if(NANA_ENABLE_JPEG)
Expand Down

0 comments on commit a904f29

Please sign in to comment.