Browse Source

Add a workaround for mixed iconv versions on OS X

coverity_scan
Daniel Scharrer 13 years ago
parent
commit
1e28ea4f50
  1. 23
      cmake/Findiconv.cmake

23
cmake/Findiconv.cmake

@ -30,13 +30,32 @@
include(UseStaticLibs)
use_static_libs(iconv)
find_path(iconv_INCLUDE_DIR iconv.h DOC "The directory where iconv.h resides")
if(APPLE)
# Prefer local iconv.h location over the system iconv.h location as /opt/local/include
# may be added to the include path by other libraries, resulting in the #include
# statements finding the local copy while we will link agains the system lib.
# This way we always find both include file and library in /opt/local/ if there is one.
find_path(iconv_INCLUDE_DIR iconv.h
PATHS /opt/local/include
DOC "The directory where iconv.h resides"
NO_CMAKE_SYSTEM_PATH
)
endif(APPLE)
find_path(iconv_INCLUDE_DIR iconv.h
PATHS /opt/local/include
DOC "The directory where iconv.h resides"
)
mark_as_advanced(iconv_INCLUDE_DIR)
# Prefer libraries in the same prefix as the include files
string(REGEX REPLACE "(.*)/include/?" "\\1" iconv_BASE_DIR ${iconv_INCLUDE_DIR})
find_library(iconv_LIBRARY iconv libiconv HINTS "${iconv_BASE_DIR}/lib" DOC "The iconv library")
find_library(iconv_LIBRARY iconv libiconv
HINTS "${iconv_BASE_DIR}/lib"
PATHS /opt/local/lib
DOC "The iconv library"
)
mark_as_advanced(iconv_LIBRARY)
use_static_libs_restore()

Loading…
Cancel
Save