summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2021-11-07 11:56:57 -0500
committerAllen Winter <allen.winter@kdab.com>2021-11-07 12:02:18 -0500
commit82c4ad85bf9e619c3650293706b76d41d3d6d45d (patch)
tree04dab7a07eec793a4ecf0a4c8b6abfb5b7cb61d0 /CMakeLists.txt
parent63a0c128467765a00b4ad33a3540db9a50119c95 (diff)
downloadlibical-git-82c4ad85bf9e619c3650293706b76d41d3d6d45d.tar.gz
Copy in and Use the Kitware FindICU.cmake from CMake 3.21
Rather than increase the CMake version requirement to 3.7, in order to upgrade from our less-than-perfect home-grown FindICU we copy in the official CMake version and use that. This seems to fix static linking problems with ICU on Windows. It may also fix static linking on other platforms.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt31
1 files changed, 25 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3568ffc9..151e54ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,8 +90,12 @@ endif()
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
+if(POLICY CMP0074)
+ cmake_policy(SET CMP0074 NEW) #don't warn about ICU_ROOT envvar
+endif()
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Kitware/modules")
#Include CMake capabilities
include(FeatureSummary)
@@ -192,7 +196,10 @@ endif()
# libicu is highly recommended for RSCALE support
# libicu can be found at http://www.icu-project.org
# RSCALE info at https://tools.ietf.org/html/rfc7529
-find_package(ICU)
+if(NOT "$ENV{ICU_BASE}" STREQUAL "") #support the old ICU_BASE env
+ set(ICU_ROOT $ENV{ICU_BASE})
+endif()
+find_package(ICU COMPONENTS uc i18n)
set_package_properties(ICU PROPERTIES
TYPE RECOMMENDED
PURPOSE "For RSCALE (RFC7529) support"
@@ -205,14 +212,26 @@ add_feature_info(
if(ICU_FOUND)
set(REQUIRES_PRIVATE_ICU "Requires.private: icu-i18n") #for libical.pc
set(HAVE_LIBICU 1)
- if(ICU_MAJOR_VERSION VERSION_GREATER 50)
+ if(ICU_VERSION VERSION_GREATER 50)
set(HAVE_ICU_DANGI TRUE)
else()
set(HAVE_ICU_DANGI FALSE)
endif()
-endif()
-if(ICU_I18N_FOUND)
- set(HAVE_LIBICU_I18N 1)
+ if(ICU_GENCCODE_EXECUTABLE)
+ get_filename_component(ICU_EXEC ${ICU_GENCCODE_EXECUTABLE} DIRECTORY)
+ elseif(ICU_UCONV_EXECUTABLE)
+ get_filename_component(ICU_EXEC ${ICU_UCONV_EXECUTABLE} DIRECTORY)
+ elseif(ICU_ICUINFO_EXECUTABLE)
+ get_filename_component(ICU_EXEC ${ICU_ICUINFO_EXECUTABLE} DIRECTORY)
+ elseif(ICU_ICU-CONFIG_EXECUTABLE)
+ get_filename_component(ICU_EXEC ${ICU_ICU-CONFIG_EXECUTABLE} DIRECTORY)
+ elseif(ICU_MAKECONV_EXECUTABLE)
+ get_filename_component(ICU_EXEC ${ICU_MAKECONV_EXECUTABLE} DIRECTORY)
+ else()
+ message(FATAL_ERROR
+ "Unable locate the ICU runtime path. Is your ICU installation broken?")
+ endif()
+ set(ICU_BINARY_DIR ${ICU_EXEC} CACHE STRING DOC "Runtime binaries directory for the ICU library")
endif()
# compile in Berkeley DB support