I would like to use some standard layout for my linux c++ project which is built using cmake and contains some executables and a library that these execs might link to. Currently I just had a folder for the project and a sub folder for each sub project. With a CMakeLists in the top level and one in each sub level that the opt level adds.
Project-
executable1
executable2
library
However I think it would be better setup like the following
Project -
lib //Library output folder
bin //Executable output folder
src //Al cpp source files
include //All header files
test //All tests
I would have just one CMakeLists in top level. I can easily set this up in cmake. does anyone have reasons for choosing a different layout?
I wouldn't put the lib, bin and test output directly on the project directory: if you want to make a debug and a release build, you get stuck, because you have only one placeholder. Out of source build is your friend! I would use something like:
Project
src
include
CMakeLists.txt
These will be generated when using cmake:
Project_build_dbg
bin
lib
test
Project_build_release
bin
lib
test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With