[CMake] Where to find consistent documentation about CMake ?

Alexander Neundorf a.neundorf-work at gmx.net
Wed Jul 5 03:59:31 EDT 2006


Hi,

Am Mittwoch 05 Juli 2006 09:01 schrieb Sagnes, Frederic:
> Hello,
>
> I'm getting used to CMake to build a cross platform project on Windows and
> Linux, and it really seems to be quite powerful. But the documentation
> provided on the website is really minimalist, rough (no topics, no real
> examples ...) and incomplete (no summary of all internal variables and
> their meanings, some commands are not clearly described ...). I'm really
> feeling like I'm missing a big part of the magic behind CMake. We could
> buy the book, but I'm working in a corporate environment and it would
> take weeks until I get it.

Please check also the cmake wiki and FAQ.
There are also many examples in vtk, itk and KDE 4 svn 
( http://websvn.kde.org/trunk/KDE/ )

> Did I miss something or the only available documentation is the
> command-line generated one, the FAQ and the Wiki?
>
> Here are a few question I couldn't answer by reading the documentation:
> * How can I be sure to link statically on Unix when using the 
> FIND_LIBRARY primitive? 

> * How can I raise an error message and stop the generation (when 
> a library I'm depending on is not available for instance) 

MESSAGE(FATAL_ERROR "game over")

> * Can I use an 
> intern variable so that CMake can automatically raise the compiler error
> checking level (like CMAKE_CXX_WARNING_LEVEL for Visual Studio), and add
> for instance -Wall and -pedantic to the GCC command line? 

See the flags below.
You can also check
if (MSVC)
and
if (CMAKE_COMPILER_IS_GNUCXX)
to test for the compiler in cmake.

> * How does CMake 
> handle release/debug profiles with Unix Makefile generator?

You can set CMAKE_BUILD_TYPE e.g. to DEBUG or RELEASE, and then the specific compile flags will be used:

set(CMAKE_CXX_FLAGS_RELEASE "-O2")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns 
-fno-inline")
set(CMAKE_C_FLAGS_RELEASE    "-O2")
set(CMAKE_C_FLAGS_DEBUG      "-g -O2 -fno-reorder-blocks -fno-schedule-insns 
-fno-inline")

Bye
Alex
-- 


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


More information about the CMake mailing list