[CMake] Advice on converting legacy project to modern CMake

Björn Blissing bjorn.blissing at vti.se
Mon Aug 7 07:35:47 EDT 2017


Hi,

I have some legacy projects which I intend to update to modern CMake. The documentation is good but do not really cover "best practices". So I have some questions which I hope some of you could help to answer:

1. Which version if CMake should I target? I.e. Which version should I require in my cmake_minimum_required() statement?

2. What are some best practices when choosing a namespace for my library export? For example, lets say that I have a library which handles interfacing with a piece of fictional hardware, lets call this hardware "Anvil". My library and project is then aptly named "Anvil". But what to name the namespace?

3. Some of my legacy projects have all source in the same directory, i.e. both source and header files are in the same directory. Others have both private and public headers in the same directory. How do I handle this with target_include_directories()? Preferably I would like to avoid reorganizing the file structure.

Regards

Björn

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170807/7bad4bf8/attachment.html>


More information about the CMake mailing list