[CMake] Migrating from another build system that maintains its own source file lists

Alan W. Irwin irwin at beluga.phys.uvic.ca
Wed May 27 14:17:24 EDT 2015


On 2015-05-27 13:48-0400 Kevin Houlihan wrote:

> Hello,
>
> I want to migrate from a build system that has its own lists of source
> files that must be maintained for the time being. I have scripts to
> translate those list files into CMakeLists.txt files but I don't know of a
> good way to integrate those into a CMake generated build system and keep
> the generated CMakeLists.txt files up to date with the files they were
> generated from.
>
> My current solution is to use a Makefile to check to see if the
> CMakeLists.txt files need to be updated as part of the build. This is a bit
> clumsy.
>
> The issue seems similar to the problem of using file globbing in
> CMakeLIsts.txt files and as far as I know, the answer there is "don't do
> that". Still I thought I'd try my luck.
>
> Any suggestions?

Use a CMake list of files, and maintain that, e.g.,

set(lib_SRC_FILE_LIST
a.c
b.c
c.c
[...]
)

add_library(lib ${lib_SRC_FILE_LIST})

or if there are thousands of files in the list and you don't want
to disrupt the logic of your principal CMakeLists.txt files with
lists scattered all over within the file, then look at
the include(...) command which will include CMake source code
from a file (say completely devoted to the above list creation command).

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
-------------- next part --------------
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list