[CMake] Check symbol in header files with dependencies

Alexander Koeppe format_c at online.de
Sat Feb 7 06:17:00 EST 2015


Am 05.02.2015 um 21:58 schrieb Rolf Eike Beer:
>
> set(CMAKE_REQUIRED_INCLUDES some_header.h other/header.h)
> check_symbol_exists(...)
>
> Eike
>

Thanks Eike,

unfortunately it didn't bring the effect it should have.
Setting the CMAKE_REQUIRED_INCLUDES variable made setting the -I
parameter of the compiler. That ended up in a test compiler call of

/usr/bin/cc   -DHAVE_IP6T_SO_ORIGINAL_DST
-I/build/CMakeFiles/CMakeTmp/stdio.h
-I/build/CMakeFiles/CMakeTmp/netinet/in.h -o
CMakeFiles/cmTryCompileExec2968261629.dir/src.c.o -c /build/CMakeFiles
/CMakeTmp/src.c

But the test source file still contains only the #include specified in
CHECK_SYMBOL_EXISTS().

Hence the compilation fails with the same "unknown type" errors.

Any more tips are welcome.

Cheers Alex




More information about the CMake mailing list