[CMake] General questions

Yang Zhang yanghatespam at gmail.com
Sun Feb 24 16:27:47 EST 2008


Hi, thanks for your reply.

Mike Jackson wrote:
 >
 > -- 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).

I did try using `ccmake ../`, but I couldn't figure out how to use this 
interface - it kept generating Makefiles in the source directory. `cmake 
../` worked, though. (I'm still confused about this.)

 >
 >>
 >> - 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.

That wasn't quite what I was asking, but I *think* the wiki has answered 
my question:

"Auto depend information for C++, C, and Fortran"

 >
 >>
 >> - 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.

I'm aware of this, but I was wondering if cmake can generate autotools 
inputs so as to create POSIX-portable preferably-GNU-compliant packages.

 >
 > 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
 >
-- 
Yang Zhang
http://www.mit.edu/~y_z/


More information about the CMake mailing list