How to test for gnu extensions

Brad King brad.king at kitware.com
Thu Feb 9 23:03:30 CET 2006


David Faure wrote:
> Currently kdelibs fails to compile for me with cmake because S_ISSOCK isn't detected
> (so the config.h defines it, and it clashes with the one from sys/stat.h during compilation).
> Anyway - the reason is that _GNU_SOURCE isn't defined, so sys/stat.h doesn't define S_ISSOCK.
> 
> I tried porting the check from acinclude.m4.in to define _GNU_SOURCE, which gives something like:

This line is probably needed in ConfigureChecks.cmake:

set(CMAKE_REQUIRED_FLAGS ${_KDE4_PLATFORM_DEFINITIONS})

The FindKDE4.cmake module sets _KDE4_PLATFORM_DEFINITIONS with 
definitions like _GNU_SOURCE that are needed on each platform.  These 
definitions should be included during the try-compiles.  Setting this 
variable should cause the check_* macros to include the definitions in 
the build.

-Brad


More information about the Kde-buildsystem mailing list