diff options
-rw-r--r-- | CMakeLists.txt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c3f13e519..9038f6468 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -737,6 +737,37 @@ int main(int argc, char** argv) { return cmkcheckweak == NULL; }" HAVE_WEAK_SYMBOLS) +IF(NOT ICONV_INCLUDE_DIR OR NOT ICONV_LIBRARIES) + FIND_PATH(ICONV_INCLUDE_DIR iconv.h) + FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c) + IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + SET(ICONV_FOUND TRUE) + ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) + + IF(ICONV_FOUND) + CHECK_C_SOURCE_COMPILES(" +#include <iconv.h> +int main(){ + iconv_t conv = 0; + const char* in = 0; + size_t ilen = 0; + char* out = 0; + size_t olen = 0; + iconv(conv, &in, &ilen, &out, &olen); + return 0; +} +" ICONV_SECOND_ARGUMENT_IS_CONST) + ENDIF(ICONV_FOUND) + + IF(ICONV_FOUND) + MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") + ELSE(ICONV_FOUND) + MESSAGE(FATAL_ERROR "Could not find Iconv") + ENDIF(ICONV_FOUND) +ENDIF(NOT ICONV_INCLUDE_DIR OR NOT ICONV_LIBRARIES) + # Check macros CHECK_SYMBOL_EXISTS(PATH_MAX limits.h HAVE_PATH_MAX) |