[CMake] From autotools to cmake for existing project

Nizar Khalifa Sallem nksallem at laas.fr
Tue Jan 11 08:12:27 EST 2011


At Tue, 11 Jan 2011 12:40:03 +0000 (GMT),
Carlos Lopez Gonzalez wrote:
> 
> Hi!
> I'd like to use cmake on our project (Synfig - http://synfig.org)
> Currently it uses autotools and pkconfig to prepare the code to the build and 
> install processes. It is a C++/gtkmm application. Currently it builds fine on 
> linux, builds with lots of hacking on windows under cgwin and nobody maintain 
> the Mac builds.
> The application has the following subprojects:
> 
> -ETL: it is a template library. 
> There is not output binaries nor entry point. It just defines templates. It is 
> used by the others subprojects so its headers should be locatable. It has 
> external libraries dependences.
> -synfig-core: This is the libraries of Synfig. It produces the libraries and a 
> command line tool render animations documents. It needs ETL headers. It has 
> external libraries dependences.
> -synfig-studio: This is the graphical user interface that creates the synfig 
> documents and uses the synfig-core libraries to render the animation on on the 
> screen or to a file. It needs the synfig libraries and has dependences with 
> external libraries. 
> 
> 
> My proposed strategy is this: 
> On linux start by ETL and port it to install properly on the computer. Continue 
> with synfig-core and then synfig-studio. Once it works fine with cmake and linux 
> continue with windows and then (hopefully womeone who owns a mac can help) 
> continue with mac version.
> 
> 
> So the question is: 
> which is the best strategy to allow synfig to use cmake? I know that it might be 
> a very complex question but I want to know which are the major roadblocks I 
> would find. Anybody has previous experience with something similar? Can you 
> point to me to any similar case of study?
> 
> I forecast the problem of replace pkconfig tools. Should I use pkconfig inside 
> cmake or use the .cmake replacements to find the libraries and forget completely 
> pkconfig? In the middle of porting, when ETL would be installed, would the 
> unported synfig-core and synfig-studio parts (already with autotools) find 
> properly the ETL libraries? How to proceed in that case?
> 
> Please be patience with me because I'm just start learning. I have the Mastering 
> cmake book and have done a whole read once, so I can understand technical 
> terminology (or at last can search for it), but I don't have any experience with 
> cmake and my experience with autotools is ... well better don't remind me ;)
> 
> Thanks!
> Carlos
> 
> 
> 
>       
> _______________________________________________
> 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
Hi,

Even if I can't point you to a real case study, I can answer from own
experience. You have done the major part : identifying the
subprojects. Actually that was the first step. Now for each project
you will need to identify : 
- which exteranl toosl (libraries or programs) you relie on
Then you can start writing a CMakeLists.txt for every one of them.
- how the subprojects are related
- is there a possible factorizing between the CMakeLists.txt if yes
then your top CMakeLists.txt file would contain common external needs
and add_directory() macros call to every subproject and if subproejcts
are related then you can link targets.

Hope this can help,
--
Nizar


More information about the CMake mailing list