Am 2017-08-07 11:35, schrieb Björn Blissing:
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?

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.

Greetings,

Eike
--
--

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

Reply via email to