From 48b6c98d31c176134a72fe59ff596afa1eef0d11 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 10 Oct 2016 17:35:23 +0000 Subject: build: libc may not provide iconv() on Unix /usr/bin/ld: ../common/libcommon.a(string_util.cpp.o): undefined reference to symbol 'libiconv_open' --- CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df7fe0cba..7e3f2ab8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,14 +169,13 @@ endif() IF (APPLE) FIND_LIBRARY(COCOA_LIBRARY Cocoa) # Umbrella framework for everything GUI-related - set(PLATFORM_LIBRARIES iconv ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY}) + set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") ELSEIF(MINGW) - # GCC does not support codecvt, so use iconv instead # PSAPI is the Process Status API - set(PLATFORM_LIBRARIES winmm ws2_32 psapi iconv) + set(PLATFORM_LIBRARIES winmm ws2_32 psapi) # WSAPoll functionality doesn't exist before WinNT 6.x (Vista and up) add_definitions(-D_WIN32_WINNT=0x0600) @@ -186,6 +185,14 @@ ELSE() set(PLATFORM_LIBRARIES rt) ENDIF (APPLE) +# MINGW: GCC does not support codecvt, so use iconv instead +if (UNIX OR MINGW) + find_library(ICONV_LIBRARY NAMES iconv) + if (ICONV_LIBRARY) + list(APPEND PLATFORM_LIBRARIES ${ICONV_LIBRARY}) + endif() +endif() + if (ENABLE_QT) if (CITRA_USE_BUNDLED_QT) if (MSVC14 AND ARCHITECTURE_x86_64) -- cgit v1.2.3