[evolution-data-server] Bug 792302 - CMake build fails to include iconv-detect.h



commit 6b51d2f605f16eeeebb031d38b3078ad700ad58d
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 18 12:26:59 2018 +0100

    Bug 792302 - CMake build fails to include iconv-detect.h

 CMakeLists.txt |    5 ++++-
 iconv-detect.c |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bcb01e4..be416bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -521,7 +521,10 @@ if(NOT HAVE_ICONV)
 endif(NOT HAVE_ICONV)
 
 set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBS})
-CHECK_C_SOURCE_RUNS("#include \"${CMAKE_SOURCE_DIR}/iconv-detect.c\"" _correct_iconv)
+file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/" _binary_dir_with_separator)
+CHECK_C_SOURCE_RUNS("#define ICONV_DETECT_BUILD_DIR \"${_binary_dir_with_separator}\"
+                    #include \"${CMAKE_SOURCE_DIR}/iconv-detect.c\"" _correct_iconv)
+unset(_binary_dir_with_separator)
 unset(CMAKE_REQUIRED_LIBRARIES)
 
 if(NOT _correct_iconv)
diff --git a/iconv-detect.c b/iconv-detect.c
index bc7d872..e44ad94 100644
--- a/iconv-detect.c
+++ b/iconv-detect.c
@@ -128,7 +128,7 @@ main (int argc,
        if (!test_iconv ())
                return 1;
 
-       fp = fopen ("iconv-detect.h", "w");
+       fp = fopen (ICONV_DETECT_BUILD_DIR "iconv-detect.h", "w");
        if (fp == NULL)
                return 255;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]