FindICU: CMP0074 breaks 64 bit builds on Windows
When compiling ICU from source using the official VS project files, both a 32-bit version (bin
, lib
) and a 64-bit version (bin64
, lib64
) are created. FindICU.cmake
then uses find_library
with PATH_SUFFIXES lib64 lib
(for 64-bit builds) to select the correct library files.
Starting with CMake 3.12 (CMP0074), precedence to the lib
folder is given. As a result, 64-bit builds fail.
One possible solution might be to use NO_PACKAGE_ROOT_PATH
for all find_library
and find_program
calls on Windows. Since FindICU.cmake
uses ${ICU_ROOT}
or $ENV{ICU_ROOT}
consistently as HINTS
, this should not break anything (as far as I can tell).
Simple test CMakeLists.txt
(provide ICU_ROOT
on the command line):
cmake_minimum_required(VERSION 3.12)
project(icu_lib64_test)
find_package(ICU REQUIRED COMPONENTS uc)
# Equivalent to the call in FindICU.cmake
find_library(MY_FIND_LIB icuuc
HINTS ${ICU_ROOT}
PATH_SUFFIXES lib64 lib)
message("${ICU_UC_LIBRARY_RELEASE}") # ICU_ROOT/lib/icuuc.lib
message("${MY_FIND_LIB }") # ICU_ROOT/lib64/icuuc.lib
message("sizeof(void*) == ${CMAKE_SIZEOF_VOID_P}") # sizeof(void*) == 8