From 18ae020a3e3198a1039971d3424872d8780db91b Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 21 Mar 2017 19:45:56 +0100 Subject: [PATCH] Try to link against a static intl and iconv lib --- CMakeLists.txt | 4 ++++ cmake/FindIconv.cmake | 49 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 cmake/FindIconv.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 72ba0e2..db10b0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,9 @@ endif (MINGW) # Dependencies +set (CMAKE_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include) +set (CMAKE_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib) +find_package (Iconv REQUIRED) find_package (Intl REQUIRED) find_package (PkgConfig REQUIRED) @@ -90,6 +93,7 @@ set_property (TARGET SDL_kitchensink PROPERTY IMPORTED_LOCATION ${CMAKE_INSTALL_ ########################### target_link_libraries (planetblupi PUBLIC + ${Iconv_LIBRARIES} ${Intl_LIBRARIES} ${SDL2_STATIC_LIBRARIES} ${SDL2_MIXER_STATIC_LIBRARIES} diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake new file mode 100644 index 0000000..ddbaacd --- /dev/null +++ b/cmake/FindIconv.cmake @@ -0,0 +1,49 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindIconv +# -------- +# +# Find the libiconv headers and libraries. +# +# This module reports information about the libiconv +# installation in several variables. General variables:: +# +# Iconv_FOUND - true if the libiconv headers and libraries were found +# Iconv_INCLUDE_DIRS - the directory containing the libiconv headers +# Iconv_LIBRARIES - libiconv libraries to be linked +# +# The following cache variables may also be set:: +# +# Iconv_INCLUDE_DIR - the directory containing the libiconv headers +# Iconv_LIBRARY - the libiconv library (if any) + + +# Written by Roger Leigh + +# Find include directory +find_path(Iconv_INCLUDE_DIR + NAMES "iconv.h" + DOC "libiconv include directory") +mark_as_advanced(Iconv_INCLUDE_DIR) + +# Find all Iconv libraries +find_library(Iconv_LIBRARY "iconv" + DOC "libiconv libraries)") +mark_as_advanced(Iconv_LIBRARY) + +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Iconv + FOUND_VAR Iconv_FOUND + REQUIRED_VARS Iconv_INCLUDE_DIR + FAIL_MESSAGE "Failed to find libiconv") + +if(Iconv_FOUND) + set(Iconv_INCLUDE_DIRS "${Iconv_INCLUDE_DIR}") + if(Iconv_LIBRARY) + set(Iconv_LIBRARIES "${Iconv_LIBRARY}") + else() + unset(Iconv_LIBRARIES) + endif() +endif()