summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindLibIconv.cmake
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2007-03-03 14:32:17 +0000
committerRalf Habacker <ralf.habacker@freenet.de>2007-03-03 14:32:17 +0000
commit36ebfd411b358fb4797d31d23f945e8f6844d15a (patch)
tree9c8982d1da82fdffea8d2a741dba82e927874869 /cmake/modules/FindLibIconv.cmake
parent4ceb86d29a68ebe52b20c8c090bc90c68a58f8c8 (diff)
* cmake: new directory, contains cmake build support.
See http://www.cmake.org for more informations. Currently only unix will be buildable because some win32 required files are still missing.
Diffstat (limited to 'cmake/modules/FindLibIconv.cmake')
-rw-r--r--cmake/modules/FindLibIconv.cmake52
1 files changed, 52 insertions, 0 deletions
diff --git a/cmake/modules/FindLibIconv.cmake b/cmake/modules/FindLibIconv.cmake
new file mode 100644
index 00000000..dac63449
--- /dev/null
+++ b/cmake/modules/FindLibIconv.cmake
@@ -0,0 +1,52 @@
+# - Try to find LibIconv
+# Once done this will define
+#
+# LIBICONV_FOUND - system has LibIconv
+# LIBICONV_INCLUDE_DIR - the LibIconv include directory
+# LIBICONV_LIBRARIES - the libraries needed to use LibIconv
+# LIBICONV_DEFINITIONS - Compiler switches required for using LibIconv
+
+if (LIBICONV_INCLUDE_DIR AND LIBICONV_LIBRARIES)
+
+ # in cache already
+ SET(LIBICONV_FOUND TRUE)
+
+else (LIBICONV_INCLUDE_DIR AND LIBICONV_LIBRARIES)
+
+ IF (NOT WIN32)
+ MESSAGE(FATAL_ERROR "Please set this to the correct values!")
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ INCLUDE(UsePkgConfig)
+ PKGCONFIG(libiconv-1.9 _LibIconvIncDir _LibIconvLinkDir _LibIconvLinkFlags _LiIconvCflags)
+ SET(LIBICONV_DEFINITIONS ${_LibIconvCflags})
+ ENDIF (NOT WIN32)
+
+ FIND_PATH(LIBICONV_INCLUDE_DIR iconv.h
+ PATHS
+ ${_LibIconvIncDir}
+ PATH_SUFFIXES libiconv
+ )
+
+ FIND_LIBRARY(LIBICONV_LIBRARIES NAMES iconv libiconv
+ PATHS
+ ${_LibIconvLinkDir}
+ )
+
+ if (LIBICONV_INCLUDE_DIR AND LIBICONV_LIBRARIES)
+ set(LIBICONV_FOUND TRUE)
+ endif (LIBICONV_INCLUDE_DIR AND LIBICONV_LIBRARIES)
+
+ if (LIBICONV_FOUND)
+ if (NOT LibIconv_FIND_QUIETLY)
+ message(STATUS "Found LibIconv: ${LIBICONV_LIBRARIES}")
+ endif (NOT LibIconv_FIND_QUIETLY)
+ else (LIBICONV_FOUND)
+ if (LibIconv_FIND_REQUIRED)
+ message(SEND_ERROR "Could NOT find LibIconv")
+ endif (LibIconv_FIND_REQUIRED)
+ endif (LIBICONV_FOUND)
+
+ MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARIES)
+
+endif (LIBICONV_INCLUDE_DIR AND LIBICONV_LIBRARIES)