Hi, I am new to cmake and really hope am doing this correctly. I asked
stackoverflow but didn't get a good enough answer for my specific problem
here;

If I want root/sub-directories/ as separate sub-projects that can be
compiled using the individualCMakeLists.txts in their folders I find myself
literally copy pasting almost the entire root file CMakeLists.txt per
sub-directory.

I was wondering if there is a better way to have a main project and then
sub-projects that get the shared dependencies from main project and can be
compiled without cmake-ing the root CMakeLists.txt. My directory structure
is;

CMakeLists.txt (root project)
| __ sub_dir-1
| __ | __ CMakeLists.txt (sub-project)
| __ sub_dir-2
| __ | __ CMakeLists.txt (sub-project)
| __ sub_dir-3
| __ | __ CMakeLists.txt (sub-project)
...

Essentially, I want to be able to:

1.
​ ​
cmake root/CMakeLists.txt, which creates an entire project that includes
the sub-projects (I already have this implemented using individual
CMakeLists.txts inside sub-directories.

2.
​ ​
cmake root/sub-dir/CMakeLists.txt and only compile the sub-project, which
essentially also finds the necessary dependencies and includes them from
maybe .cmake includes or root/CMakeLists.txt. What is the best way to
approach this structure;

while retaining the first bullet point of having the ability to compile it
as an entire project.
And also not crowding the sub-dir/CMakeLists.txt too much with redundant
code?

Appreciate any suggestions! Thank you.


--
Muhammad Osama
-- 

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