[CMake] cmake 2.6.0, breakages

Dmitry Marakasov amdmi3 at amdmi3.ru
Mon May 19 09:40:13 EDT 2008


* Andreas Pakulat (apaku at gmx.de) wrote:

> > sdl-config --libs:
> > -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL -pthread
> > sdl-config --cflags:
> > -I/usr/local/include/SDL -I/usr/local/include -D_GNU_SOURCE=1 -D_REENTRANT
> > 
> > So I thought it would be safer to use sdl-config and let user specify
> > path to in if it's not in $PATH.
> Not really, because you're basically just using CMake as "another" way
> of passing arguments to the compiler.
True, but it's often convinient to use CMake this way. While I
understand that CMake's goal is to be cross-platform build tool, 
support for just passing whatever (`foobar --args`, -Wl etc.) to
compiler/linker is still nice for local usage. I'm not aware on
official cmake team politics here though, as not permitting to do
this stuff also has it's beneits (i.e. to avoid breakages as in my
case).

> You can do this stuff much more easily with a plain Makefile.
Not quite. CMake lets me write those 16 lines of CMakeLists once,
and `cmake . && make' will work on most *nix systems not requiring
any changes even if source files are renamed/added/deleted.

> Actually I'm astonished that CMake accepts that input to its
> TARGET_LINK_LIBRARIES at all (the -Wl stuff mainly). And in that case it
> actually doesn't make a difference AFAIK, CMake will use rpath itself
> and set it properly.
> 
> So the only thing you really should do is extract the -D flags from
> sdl-config --cflags. The rest of the information can be found with the
> SDL module in cmake as far as I can see.
Well, after some digging I think those defines are not necessary at all,
so using cmake-provided SDL_INCLUDE_DIR and SDL_LIBRARIES will be enough
and it will be really cross-platform.

> > Agreed. But I still see it as a bug that cmake uses srcdir ==
> > builddir AND includes it's own files into glob when doing GLOB.
> If you think so, you should open a bugreport. 
I guess I will. GLOB_RECURSE may not be the best way to specify
project sources, but it matching anything under CMakeFiles/ is certainly
not what user would expect.

> Then you didn't specify your source directory as include-dir:
> INCLUDE_DIRECTORY(${CMAKE_SOURCE_DIR})

> Run cmake from your builddir, the cmake wiki should have some docs about
> basic usage which includes this.
Thanks, it seems to be what I need.

-- 
Dmitry A. Marakasov    | jabber: amdmi3 at jabber.ru
amdmi3 at amdmi3.ru       | http://www.amdmi3.ru


More information about the CMake mailing list