From bf1fd997d0e890ca1359ed5f9f4c867bf592a795 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Tue, 15 May 2018 16:37:41 +0200 Subject: [PATCH] Do not require ICU on MinGW and MSVC targets. --- src/openrct2/CMakeLists.txt | 19 ++++++++++++------- test/tests/CMakeLists.txt | 8 +++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/openrct2/CMakeLists.txt b/src/openrct2/CMakeLists.txt index 3de454ae1d..934c0d743a 100644 --- a/src/openrct2/CMakeLists.txt +++ b/src/openrct2/CMakeLists.txt @@ -58,9 +58,6 @@ if (NOT DISABLE_TTF) endif () endif () -# For unicode code page conversion. -find_package(ICU 59.0 REQUIRED COMPONENTS uc) - # Sources file(GLOB_RECURSE OPENRCT2_CORE_SOURCES "${CMAKE_CURRENT_LIST_DIR}/*.cpp" "${CMAKE_CURRENT_LIST_DIR}/*.h" @@ -81,14 +78,12 @@ if (STATIC) target_link_libraries(${PROJECT} ${JANSSON_STATIC_LIBRARIES} ${PNG_STATIC_LIBRARIES} ${ZLIB_STATIC_LIBRARIES} - ${LIBZIP_STATIC_LIBRARIES} - ${ICU_STATIC_LIBRARIES}) + ${LIBZIP_STATIC_LIBRARIES}) else () target_link_libraries(${PROJECT} ${JANSSON_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} - ${LIBZIP_LIBRARIES} - ${ICU_LIBRARIES}) + ${LIBZIP_LIBRARIES}) endif () if (UNIX AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "BSD") @@ -115,6 +110,16 @@ if (NOT DISABLE_NETWORK) endif () endif () +if (NOT MINGW AND NOT MSVC) + # For unicode code page conversion. + find_package(ICU 59.0 REQUIRED COMPONENTS uc) + if (STATIC) + target_link_libraries(${PROJECT} ${ICU_STATIC_LIBRARIES}) + else () + target_link_libraries(${PROJECT} ${ICU_LIBRARIES}) + endif () +endif () + if (NOT APPLE AND NOT MINGW AND NOT MSVC) # This is ugly hack to work around https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1568899. # Once C++17 is enabled (and thus old compilers are no longer supported, this needs to be gone. diff --git a/test/tests/CMakeLists.txt b/test/tests/CMakeLists.txt index 5ec9bd1381..e7cb287a24 100644 --- a/test/tests/CMakeLists.txt +++ b/test/tests/CMakeLists.txt @@ -91,9 +91,11 @@ add_library(test-common STATIC ${COMMON_TEST_SOURCES}) execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_LIST_DIR}/testdata" "${CMAKE_CURRENT_BINARY_DIR}/testdata") install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/openrct2\" \"${CMAKE_CURRENT_BINARY_DIR}/data\")") -# For unicode code page conversion (required for ini and string tests) -find_package(ICU 59.0 REQUIRED COMPONENTS uc) -target_link_libraries(test-common ${ICU_LIBRARIES}) +if (NOT MINGW AND NOT MSVC) + # For unicode code page conversion (required for ini and string tests) + find_package(ICU 59.0 REQUIRED COMPONENTS uc) + target_link_libraries(test-common ${ICU_LIBRARIES}) +endif () # Start of our tests