[ccan] CMake build system

Nicu Tofan nicu.tofan at gmail.com
Sat Mar 8 08:43:34 EST 2014


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/20140307/a6e92d8a/attachment.html>


More information about the ccan mailing list