[CMake] Starting with Cmake

Dong Tiger idlecat511 at gmail.com
Mon Jul 13 23:46:51 EDT 2009


2009/7/12 Tyler Roscoe <tyler at cryptio.net>

> I hope this is a real email address. Posting from a fake one is sketchy.
>
> On Sat, Jul 11, 2009 at 06:04:48PM -0700, ML wrote:
> > 1. Is there a doc that describes the 'bare essentials' to a CMake
> > file. What I absolutely need to have in the file.
>
> I think there's one somewhere on the wiki, and there are other examples
> that google will find. The _Mastering CMake_ book has a tutorial chapter
> that is helpful but not essential.
>
> > 2. Can I call my Cmake file anything? Or do I have to call it
> > CMakeLists.txt?
>
> You can call it something else but I wouldn't recommend it. Actually I'm
> not sure if add_subdirectory() will take a file name (but it might).
>
> > 3. Can CMake check out code from SVN?
> >
> > 4. Can CMake e-mail build results to a specified e-mail address?
>
> You'll probably want to use CDash for these types of activities. CDash
> is sort of an automation/continuous integration wrapper for CMake. It
> has its own website, but it integrates nicely with CMake.
>
> > 5. Say I have something like:
> > SET(SRCS file1.c file2.c file3.c)
> > Can I write this like:
> > SET(SRCS /
> >       file1.c /
> >       file2.c /
> >       file3.c
> > )
> >
> > Like one file name per line like I can do in a gnu Make File?
>
What about a long command line in ADD_CUSTOM_COMMAND? Can I break it into
multiple lines?

>
>
> I'm not sure why you put those / in there (did you mean \ ?) but CMake
> is pretty tolerant of whitespace. Just write:
>
> set (srcs
>     file1.c
>    file2.c
>    file3.c
> )
>
> > 6. In Make I would define all of my headers too, would I do the same
> > as #5 above? How does the my Add_Executable statement?
>
> This isn't necessary in CMake, although it does make those headers
> available for IDE users. You just add them right alongside the source
> files: add_executable (${sources} ${headers}).
>
> > 7. How do I tell Cmake to compile to a static library like a .a or .so
> > or .dll?
>
> add_library() takes STATIC and SHARED flags.
>
> hth,
> tyler
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090714/66eff9cc/attachment.htm>


More information about the CMake mailing list