[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] Fwd: Create main and sub-projects; be able to compile them together and individually.
From:       Muhammad Osama <osama94 () gmail ! com>
Date:       2016-03-08 5:17:39
Message-ID: CAPkbuXyCvNfA3G9m9_ObW=0=ws9Uc+XbeCPOHeQCLtVjeHAiQg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

[Attachment #5 (text/html)]

<div dir="ltr">Hi, I am new to cmake and really hope am doing this correctly. I asked \
stackoverflow but didn&#39;t get a good enough answer for my specific problem \
here;<br><br>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.<br><br>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;<br><br>CMakeLists.txt \
(root project)<br>| __ sub_dir-1<br>| __ | __ CMakeLists.txt (sub-project)<br>| __ \
sub_dir-2<br>| __ | __ CMakeLists.txt (sub-project)<br>| __ sub_dir-3<br>| __ | __ \
CMakeLists.txt (sub-project)<br>...<br><br>Essentially, I want to be able \
to:<br><br>1.<div class="gmail_default" style="font-family:&#39;trebuchet \
ms&#39;,sans-serif;font-size:small;color:rgb(0,0,0);display:inline">​ \
​</div>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.<br><br>2.<div class="gmail_default" \
style="font-family:&#39;trebuchet \
ms&#39;,sans-serif;font-size:small;color:rgb(0,0,0);display:inline">​ \
​</div>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;<br><br>while retaining the first bullet point of having the ability to \
compile it as an entire project.<br>And also not crowding the sub-dir/CMakeLists.txt \
too much with redundant code?<br><br>Appreciate any suggestions! Thank \
you.<br><br><br>--<br>Muhammad Osama </div>



-- 

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



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic