[CMake] General questions
Mike Jackson
imikejackson at gmail.com
Sat Feb 23 09:55:15 EST 2008
--
Mike Jackson Senior Research Engineer
Innovative Management & Technology Services
On Feb 23, 2008, at 4:34 AM, Yang Zhang wrote:
> Hi, I just finished reading the example in the documentation on the
> website, and am left with a few beginner questions off the top of
> my head:
>
> - How do I generate multiple versions of my program (debug,
> profiled, optimized, etc.)?
CMake prefers an "out of source" build tree for each "configuration"
of your project. For example if your project is called MyProject,
then at the same level as MyProject folder, create a new folder
called MyProject-Debug. Change into the MyProject-Debug directory and
then run "ccmake ../MyProject" from the terminal. Change the
selection for CMAKE_BUILD_TYPE to "Debug". Type "C" to configure,
then type "g" to generate the Makefiles. For a release build, create
another directory called MyProject-Release and basically do the same
thing as before except set CMAKE_BUILD_TYPE to Release.
You can also create these directories just "inside" your project
folder. If you do that you can change to "ccmake ../" instead of
"ccmake ../MyProject". Sometimes this type of setup works better for
some IDEs (Eclipse is one).
>
> - Can cmake auto-generate and cache transitive dependencies via
> #includes (best described in Peter Miller's paper "Recursive Make
> Considered Harmful")?
I have no idea what a ransitive dependencies is, BUT cmake is more
than capable of generating custom header files based on input from
the cmake files. Look at the "CONFIGURE_FILE" command. run "cmake --
help-command CONFIGURE_FILE" in a terminal.
>
> - Can cmake auto-infer libraries based on #includes + a DB of
> header-to-library mappings?
Not sure. I'll let the cmake developers answer that one.
>
> - Can cmake generate autotools inputs (for POSIX-portable
> preferably-GNU-compliant packaging)?
CMake is a _replacement_ for AutoTools but NOT make. CMake will
generate a system specific MakeFile for the system it is run on. The
Makefiles are NOT portable across systems unless those systems are
EXACT MIRROR COPIES of each other. Running cmake is the same as
doing ./configure in an autotools project.
CMake has CTest for automatic testing (make test) will build and run
your tests.
CMake also has CPack for packaging your project for various platforms.
>
> Thanks!
> --
> Yang Zhang
> http://www.mit.edu/~y_z/
Mike Jackson
More information about the CMake
mailing list