Hi Cmake user list,

I have a problem that I need to check the presence of a certain symbol
in a header file using CHECK_SYMBOL_EXISTS which has several dependencies.

The check fails because the header file also contains data types that
require an additional header file to be included by the test program. It
looks like CHECK_SYMBOL_EXISTS is not capable doing that.

To be more precise I want to check the presence if IP6T_SO_ORIGINAL_DST
is defined in linux/netfilter_ipv6/ip6_tables.h.

But the CMakeError.log shows why the check fails:
---
   Determining if the IP6T_SO_ORIGINAL_DST exist failed with the
following output:
[...]
   In file included from /usr/include/linux/netfilter.h:6:0,
                    from /usr/include/linux/netfilter_ipv6.h:11,
                    from /usr/include/linux/netfilter_ipv6/ip6_tables.h:20,
                    from /build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:
   /usr/include/linux/sysctl.h:40:2: error: unknown type name ‘size_t’
     size_t *oldlenp;
     ^
   /usr/include/linux/sysctl.h:42:2: error: unknown type name ‘size_t’
     size_t newlen;
     ^
   In file included from /usr/include/linux/netfilter_ipv6.h:11:0,
                    from /usr/include/linux/netfilter_ipv6/ip6_tables.h:20,
                    from /build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:
   /usr/include/linux/netfilter.h:67:17: error: field ‘in’ has
incomplete type
     struct in_addr in;
                    ^
   /usr/include/linux/netfilter.h:68:18: error: field ‘in6’ has
incomplete type
     struct in6_addr in6;
                     ^
[...]
   File /build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
   /* */
   #include <linux/netfilter_ipv6/ip6_tables.h>

   int main(int argc, char** argv)
   {
     (void)argv;
   #ifndef IP6T_SO_ORIGINAL_DST
     return ((int*)(&IP6T_SO_ORIGINAL_DST))[argc];
   #else
     (void)argc;
     return 0;
   #endif
   }
---

Does somebody have an advice how to overcome this issue? Maybe I have
missed a function or macro that does the trick?

Any help on that is much appreciated.
Cheers Alex

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to