cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH v2 1/2] CMake: Restore order-dependent header checks

From: Brad King <brad.king_at_kitware.com>
Date: Mon, 10 Nov 2014 13:56:09 -0500

Revert commit 1269df2e3b (Cmake: Don't check for all headers each
time, 2014-08-15) and add a comment explaining the purpose of the
original code.

The check_include_file_concat macro is intended to be called multiple
times on a sequence of possibly dependent headers. Later headers
may depend on earlier headers to provide declarations. They cannot
be safely included independently on some platforms.

For example, many POSIX APIs document including sys/types.h before some
other headers. Also on some OS X versions sys/socket.h must be included
before net/if.h or the check for the latter will fail.

Signed-off-by: Brad King <brad.king_at_kitware.com>

---
 CMake/Macros.cmake | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/CMake/Macros.cmake b/CMake/Macros.cmake
index b07afc6..9b9338e 100644
--- a/CMake/Macros.cmake
+++ b/CMake/Macros.cmake
@@ -11,8 +11,11 @@ macro(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE)
 endmacro(CHECK_LIBRARY_EXISTS_CONCAT)
 
 # Check if header file exists and add it to the list.
+# This macro is intended to be called multiple times with a sequence of
+# possibly dependent header files.  Some headers depend on others to be
+# compiled correctly.
 macro(CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
-  check_include_file("${FILE}" ${VARIABLE})
+  check_include_files("${CURL_INCLUDES};${FILE}" ${VARIABLE})
   if(${VARIABLE})
     set(CURL_INCLUDES ${CURL_INCLUDES} ${FILE})
     set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${VARIABLE}")
-- 
2.1.1
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-11-10