1

All of my projects have the following structure tree:

project
|----utils
|    |----util_1
|    |    |----inc_directory(hpp files inside)
|    |    |----src_directory(cpp files inside)
|    ..........
|    ..........
|    |----util_n
|    |    |----inc_directory(hpp files inside)
|    |    |----src_directory(cpp files inside)
|
|----main.cpp
|----CMakeLists.txt

I want to write a generic CMakeLists.txt file that will allow me to compile any project which has the same structure.

usr1234567
  • 21,601
  • 16
  • 108
  • 128
Sawel
  • 929
  • 7
  • 17
  • 3
    You could use a mechanism similar to here: http://stackoverflow.com/questions/7787823/cmake-how-to-get-the-name-of-all-subdirectories-of-a-directory and browse the directories and get the cpp files dynamically – Hayt Sep 02 '16 at 11:33
  • That's not the way CMake works. Just add the utils and your are done, why adding complexity? – usr1234567 Sep 02 '16 at 13:20

0 Answers0