summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-02-19 01:11:46 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-02-19 01:11:46 +0100
commit293cab0d3797dc244e9dc0844b4522d05ac844c5 (patch)
treedfa480ccc1eeedef5ae5b36d0ff31758232eacea /cmake
parente43de640e9158ef396c9dc71a13bdcbfef740e7d (diff)
downloadbiboumi-293cab0d3797dc244e9dc0844b4522d05ac844c5.tar.gz
biboumi-293cab0d3797dc244e9dc0844b4522d05ac844c5.tar.bz2
biboumi-293cab0d3797dc244e9dc0844b4522d05ac844c5.tar.xz
biboumi-293cab0d3797dc244e9dc0844b4522d05ac844c5.zip
Fix FindIconv cmake module to correctly compile the c++ test code
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/FindIconv.cmake27
1 files changed, 16 insertions, 11 deletions
diff --git a/cmake/Modules/FindIconv.cmake b/cmake/Modules/FindIconv.cmake
index ac81a2c..d4f8181 100644
--- a/cmake/Modules/FindIconv.cmake
+++ b/cmake/Modules/FindIconv.cmake
@@ -35,17 +35,22 @@ find_package_handle_standard_args(Iconv REQUIRED_VARS ICONV_LIBRARIES ICONV_INCL
# char** outbuf, size_t* outbytesleft);
if(ICONV_FOUND)
include(CheckCXXSourceCompiles)
- check_cxx_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)
+
+ # Set the parameters needed to compile the following code.
+ set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIRS})
+ set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
+
+ check_cxx_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)
# Compatibility for all the ways of writing these variables
set(ICONV_LIBRARY ${ICONV_LIBRARIES})