From 8581cfd5d8ce3a778e25e1f41cf4a6800842dc22 Mon Sep 17 00:00:00 2001 From: Michael Pavlyshko Date: Fri, 11 Jul 2014 00:23:06 +0300 Subject: [PATCH] link with iconv only when iconv is found --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8e3bab83..1f8bec929 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,14 @@ if (WIN32) add_definitions(-DBOOST_THREAD_USE_LIB) add_definitions(-D_WIN32_WINNT=0x0501) set(SYSTEM_LIBS ${SYSTEM_LIBS} ole32 oleaut32 ws2_32 mswsock) - set(SYSTEM_LIBS ${SYSTEM_LIBS} iconv) + + include(CheckLibraryExists) + check_library_exists(iconv libiconv_open "" ICONV_LIB_FOUND) + check_library_exists(iconv iconv_open "" ICONV_FOUND) + if(ICONV_LIB_FOUND OR ICONV_FOUND) + set(SYSTEM_LIBS ${SYSTEM_LIBS} iconv) + endif() + set(CMAKE_SHARED_LIBRARY_PREFIX "") #delete lib prefix for dlls endif()