Skip to content

Commit

Permalink
cmake: Properly set pkg-config requires when configured with ICU
Browse files Browse the repository at this point in the history
In this case the pkg-config file needs to set icu-cu in the `Required`
field, and needs to add the flag `-DCXXOPTS_USE_UNICODE` to the `Cflags`
field.
  • Loading branch information
dcbaker committed Mar 5, 2024
1 parent 14df2db commit 88624fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmake/cxxopts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ function(cxxopts_install_logic)
set(CPACK_DEBIAN_COMPRESSION_TYPE "xz")

set(PKG_CONFIG_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc")
if(CXXOPTS_USE_UNICODE_HELP)
set(PKG_CONFIG_REQUIRES "icu-cu")
set(PKG_CONFIG_EXTRA_CFLAGS "-DCXXOPTS_USE_UNICODE")
endif()
configure_file("${PackagingTemplatesDir}/pkgconfig.pc.in" "${PKG_CONFIG_FILE_NAME}" @ONLY)
install(FILES "${PKG_CONFIG_FILE_NAME}"
DESTINATION "${CMAKE_INSTALL_LIBDIR_ARCHIND}/pkgconfig"
Expand Down
3 changes: 2 additions & 1 deletion packaging/pkgconfig.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Name: @PROJECT_NAME@
Description: @PROJECT_DESCRIPTION@
URL: @PROJECT_HOMEPAGE_URL@
Version: @PROJECT_VERSION@
Cflags: -I${includedir}
Requires: @PKG_CONFIG_REQUIRES@
Cflags: -I${includedir} @PKG_CONFIG_EXTRA_CFLAGS@

0 comments on commit 88624fb

Please sign in to comment.