On 19.05.08 02:06:51, Dmitry Marakasov wrote: > * Andreas Pakulat ([EMAIL PROTECTED]) wrote: > > > > # depends > > > set(SDL_CONFIG "sdl-config" CACHE STRING "Path to sdl-config script") > > Thats broken by design, what if sdl-config is not in my PATH? > > > > FIND_PACKAGE(SDL REQUIRED) > > > FIND_PACKAGE(SDL_image REQUIRED) > > > FIND_PACKAGE(SDL_mixer REQUIRED) > > And why do the above modules not set proper variables, which would allow > > you to completely get rid of sdl-config calls. If they don't they should > > be fixed. > I didn't bother finding out actually, that was quick and dirty > CMakeLists.txt. My point was that cmake's SDL module doesn't use > sdl-config at all, but the latter provides more than just include > directory and library to link. > > Compare CMake's SDL variables: > SDL_INCLUDE_DIRS=/usr/local/include/SDL > SDL_LIBRARY=/usr/local/lib/libSDLmain.a;/usr/local/lib/libSDL.so;-lpthread > > to > 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. You can do this stuff much more easily with a plain Makefile. 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. > > > CMakeFiles/Memonix.dir/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.o > > > gets into project object files (seems like it's because > > > CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp gets into GLOB_RECURSE. > > > That's obviously undesired. > > Right, then don't use GLOB_RECURSE when you use srcdir == builddir. In > > fact, don't use srcdir == builddir unless you have good reasons. Apart > > from that you could as well just list all the files in the project in a > > variable, instead of using GLOB. > 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. > Btw, I didn't find a way to change builddir in documentation. I've done > that once in my own project (and got some problems with Qt, since > generated includes went to build/ and were not included from other > source files), but now I cannot recall it. Then you didn't specify your source directory as include-dir: INCLUDE_DIRECTORY(${CMAKE_SOURCE_DIR}) > So how do I make all cmake-generated and output files go to build/ if > project directory layout is like this:a Run cmake from your builddir, the cmake wiki should have some docs about basic usage which includes this. Andreas -- You could live a better life, if you had a better mind and a better body. _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake