Am 2017-08-07 11:35, schrieb Björn Blissing:

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?

If you want to have support for compile feature (i.e. automatically selecting C++11 if needed), then you should use at least 3.1. I personally don't see a reason to start lower anyway, if someone wants to build your new software, getting a new CMake shouldn't a problem anyway.

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.

If things are in the same directory you don't need target_include_directories(), as the header files will be found anyway if you use "" (probably also <>). If they are in a different directory it doesn't matter if the private and public things are mixed, you need to add that directory anyway.



Powered by

Please keep messages on-topic and check the CMake FAQ at:

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

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe:

Reply via email to