Skip to content

Commit

Permalink
Update cmake install target to support Windows ICU
Browse files Browse the repository at this point in the history
  • Loading branch information
rmisev committed Jul 8, 2024
1 parent 4fe0204 commit b71aca6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ project(upa_url VERSION ${UPA_URL_VERSION} LANGUAGES CXX)
# ${upa_lib_name}-config.cmake
# It also must be used as the package name argument to find_package
set(upa_lib_name upa)
set(upa_lib_name_in upa-icu)
# Exported name for library target files; also used to create an alias
# target: upa::${upa_lib_export}
set(upa_lib_export url)
Expand Down Expand Up @@ -143,6 +144,7 @@ if (UPA_BUILD_TESTS OR UPA_BUILD_BENCH OR UPA_BUILD_FUZZER OR UPA_BUILD_EXAMPLES
EXPORT_NAME ${upa_lib_export})
if (UPA_USE_WINDOWS_ICU)
target_compile_definitions(${upa_lib_target} PRIVATE UPA_USE_WINDOWS_ICU=1)
set(upa_lib_name_in ${upa_lib_name})
else()
target_include_directories(${upa_lib_target} PRIVATE ${ICU_INCLUDE_DIR})
target_link_libraries(${upa_lib_target} INTERFACE ICU::i18n ICU::uc)
Expand Down Expand Up @@ -271,7 +273,7 @@ if (UPA_INSTALL AND NOT UPA_AMALGAMATED)

# generate the config file that includes the exports
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/${upa_lib_name}-config.cmake.in
${CMAKE_CURRENT_SOURCE_DIR}/cmake/${upa_lib_name_in}-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${upa_lib_name}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${upa_lib_name}
NO_SET_AND_CHECK_MACRO
Expand Down
3 changes: 0 additions & 3 deletions cmake/upa-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(ICU REQUIRED COMPONENTS i18n uc)

include("${CMAKE_CURRENT_LIST_DIR}/upa-targets.cmake")
6 changes: 6 additions & 0 deletions cmake/upa-icu-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(ICU REQUIRED COMPONENTS i18n uc)

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

0 comments on commit b71aca6

Please sign in to comment.