[ccan] CMake build system

Nicu Tofan nicu.tofan at gmail.com
Sat Mar 8 21:17:39 EST 2014


Changes committed to https://github.com/TNick/ccan/tree/cmake now allow
building the project with cmake.
I had to rename time.h into time_ccan.h because the wrong file was picked
by the compiler.
Sadly, the make build system is now broken because of my change from

    #include "config.h"

to

    #include <ccan/time/config.h>

Also, it appears that I wrongfully assumed in previous mail that config.h
file is expected in module directory. I can see now that it is being build
in root directory. I would argue that a config.h.in in each module
directory would make it clear what definitions affect current module. Just
a random thought.

Regards,
Nicu



2014-03-07 23:43 GMT+02:00 Nicu Tofan <nicu.tofan at gmail.com>:

> Hello!
>
> I would like to know your thoughts on adding a CMake build system as the
> one in my fork here:
> https://github.com/TNick/ccan
> (Note: at least on my machine code does not compile without hacks,
> probably because of include paths; it is meant as an example for now)
>
> This would make including ccan in a CMake driven project trivial. Here's
> how I imagine it:
>
> mkdir ~/test_ccan
> cd ~/test_ccan
> git init
> touch CMakeLists.txt
> git submodule add git at github.com:rustyrussell/ccan.git ccan
>
> Now in CmakeLists.txt:
>
> set( PROJECT_NAME ccan_test )
> project(${PROJECT_NAME})
> add_subdirectory( "ccan" )
> add_executable( ${PROJECT_NAME} main.c)
> target_link_libraries( ${PROJECT_NAME}
>     ccan_time
>     ccan_cpuid
>     ccan_antithread
> )
> add_dependencies ( ${PROJECT_NAME}
>     ccan_alignof
> )
>
> The system only builds only those modules that are actually needed. There
> are, of course, many things to add (libccan, examples, tests, the junk
> code, definitions in config.h.in).
>
> One important issue is that many (all?) modules require a config.h file in
> source directory to be created. The cmake build system will throw it in
> build directory. When including a header that requires config.h, the
> compiler will pick the header from current target.
>
> The question is, basically, if you are interested in adding this and
> further enhancements to main repo or I should keep it as a fork.
>
> On a different note, I couldn't find a one page index of all modules
> (probably because of a lack of skill) so I've created one:
> http://tnick.github.io/overview/2014/03/05/ccan.html
>
> Have a great day!
> Nicu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20140308/efce982c/attachment.html>


More information about the ccan mailing list