How to test for gnu extensions

David Faure faure at
Fri Feb 10 00:22:57 CET 2006

On Thursday 09 February 2006 23:03, Brad King wrote:
> 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 to define _GNU_SOURCE, which gives something like:
> This line is probably needed in ConfigureChecks.cmake:
> 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.

Thanks. That makes sense ... and it almost works :) The quoting seems to go wrong.

I tried this:

+MESSAGE("from ConfigureChecks.cmake : ${CMAKE_REQUIRED_FLAGS}")

And I get this:

from ConfigureChecks.cmake : -D_XOPEN_SOURCE=500;-D_BSD_SOURCE;-D_GNU_SOURCE
-- Looking for include files HAVE_STDIO_H
Parse error in command line argument: -D_BSD_SOURCE
Should be: VAR:type=value
CMake Error: No cmake scrpt provided.
CMake Error: Internal CMake error, TryCompile configure of cmake failed

(typo? scrpt -> script)

doesn't help.

cmake is from cvs this morning.

David Faure, faure at, sponsored by Trolltech to work on KDE,
Konqueror (, and KOffice (

More information about the Kde-buildsystem mailing list