How to test for gnu extensions

David Faure faure at kde.org
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 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.

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

I tried this:

+set(CMAKE_REQUIRED_FLAGS ${_KDE4_PLATFORM_DEFINITIONS})
+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)

I also tried set(CMAKE_REQUIRED_FLAGS "${_KDE4_PLATFORM_DEFINITIONS}"),
doesn't help.

cmake is from cvs this morning.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).



More information about the Kde-buildsystem mailing list