summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-03 18:22:09 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-03 18:22:09 +0000
commit5dabcdd94fdb6f56974c4bd5435b473c0fd92eed (patch)
tree7b66080e1de478491fec17d4fca92f192b5c5301 /CMakeLists.txt
parent381ae05de361712ae0c640596591f4ad2d8df397 (diff)
downloadrspamd-5dabcdd94fdb6f56974c4bd5435b473c0fd92eed.tar.gz
rspamd-5dabcdd94fdb6f56974c4bd5435b473c0fd92eed.zip
Fix iconv detection.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt70
1 files changed, 51 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 74eb41377..a876c4d78 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -739,17 +739,51 @@ 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("
+IF(NOT ICONV_ROOT_DIR)
+ FIND_PATH(ICONV_INCLUDE_DIR iconv.h
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ /usr
+ PATH_SUFFIXES include include/libiconv
+ DOC "Path where the libiconv headers can be found")
+ FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ /usr
+ PATH_SUFFIXES lib64 lib
+ DOC "Path where the libiconv library can be found")
+ELSE(NOT ICONV_ROOT_DIR)
+ FIND_PATH(ICONV_INCLUDE_DIR iconv.h
+ PATHS "${ICONV_ROOT_DIR}"
+ PATH_SUFFIXES include include/libiconv
+ DOC "Path where the libiconv headers can be found"
+ NO_DEFAULT_PATH)
+ FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c
+ PATHS "${ICONV_ROOT_DIR}"
+ PATH_SUFFIXES lib64 lib
+ DOC "Path where the libiconv library can be found"
+ NO_DEFAULT_PATH)
+ENDIF(NOT ICONV_ROOT_DIR)
+IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
+ SET(ICONV_FOUND TRUE)
+ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
+INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
+LIST(APPEND RSPAMD_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
+
+IF(ICONV_FOUND)
+ CHECK_C_SOURCE_COMPILES("
#include <iconv.h>
int main(){
iconv_t conv = 0;
@@ -761,15 +795,13 @@ int main(){
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)
+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)
# Check macros
CHECK_SYMBOL_EXISTS(PATH_MAX limits.h HAVE_PATH_MAX)