On Sun, Nov 11, 2012 at 2:39 AM, JonY <[email protected]> wrote:

>> It's unfortunate you both had bad experiences with cmake. Cmake really is 
>> quite powerful, and recent syntax mods make it friendlier to use.
>>
>> For example, I contributed the following cmake build scripts to the mruby 
>> project
>>
>>   https://github.com/mruby/mruby/blob/master/CMakeLists.txt
>>   https://github.com/mruby/mruby/blob/master/tools/CMakeLists.txt
>>   https://github.com/mruby/mruby/blob/master/tools/mruby/CMakeLists.txt
>>   
>> https://github.com/mruby/mruby/blob/master/cmake/modules/IntrospectSystem.cmake
>>
>> which are fairly modular and maintainable.
>>
>
> They look clean, but mods? cmake has mods? These has to be installed by
> the end user too?

I think he means "macro" and "module" files. Usually you distribute
this together with your application/library and just do:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/mycmakemodules)

See, for instance, what I do for zsync-windows:

https://www.assembla.com/code/zsync-windows/git/nodes/cmake/c/CMakeLists.txt

https://www.assembla.com/code/zsync-windows/git/nodes/cmake/c/cmake

This "mycmakemodules" directory is more or less like the m4 directory
in autotools, and provides one additional feature, which is very
useful when developing a cross-platform build system: finders, which
"guess" where some library and/or include files are available from so
that the user does not need to specify that manually. For instance:

https://www.assembla.com/code/zsync-windows/git/nodes/cmake/c/cmake/FindDmalloc.cmake


>> Another nice thing about cmake is it's concept of "toolchain files" that 
>> allow you to easily modularize cross-compiling build recipes. For example, 
>> with the same basic structure as above, one creates toolchain "libraries" to 
>> support different platforms:
>>
>
> "Toolchain files" for every system and triplet combination that you MAY
> want to support? This is one of the parts that I do not understand about
> cmake, why does it have to make cross-compile difficult?

A "toolchain" file is just a file that says "for platform X the C
compiler is arm-gcc-4.2, the C++ compiler is arm-g++-4.2, the make
tool is...", etc. CMake includes support for many platforms (compilers
and operating systems) out of the box. You only need to create your
own toolchain file when adding support for a new
compiler/language/platform. In practice, this usually means you only
need to create a toolchain file for cross-compiling for embedded
platforms.

As an additional bonus, there are the "superbuilds": you can easily
combine provide a CMake-based meta-build system for CMake and
non-CMake-based projects. This way, it would be possible to use the
very same CMake build system to build mingw-w64 on Windows, Linux,
BSD, etc. Even for cross-compiling. It'd be more or less what I am
doing in winstng to build Wt:

http://gitorious.org/winstng

http://webtoolkit.eu

I have been using CMake for open source (KDE, Wt, zsync and many
others) and for commercial projects since 2006. When your project has
to target more than one compiler and/or operating system, it is the
only rational tool to use. Anything else quickly becomes
unmaintainable. That's my experience, YMMV.

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to