[CMake] Create main and sub-projects; be able to compile them together and individually.

🐋 Jan Hegewald jan.hegewald at awi.de
Thu Mar 10 08:40:20 EST 2016


Hi Muhammad,

> On 08.03.2016, at 19:12, Muhammad Osama <osama94 at gmail.com> wrote:
> 
> Hi Jan,
> 
> Thank you for your reply, I am in the similar situation, have a very similar implementation using target_*** but since I don't do that for ALL the dependencies, I am unable to cmake or compile individual projects in the sub directories. So, few questions;

Dos this mean you have CMakeLists without any targets?

> 
> 1. This still requires me to run cmake on the root CMakeLists.txt to set the flags and what not before I run the sub project to make it correct?

No. With the setup I mentioned you would be able to build everything if CMAKE_CURRENT_LIST_DIR is the root, or you could choose to build any of the other sub-dirs on their own.

> 2. Another question is that your implementation, does it not include a config file? In theory you're copy pasting most of the dependencies in the CMakeLists.txt of root into the sub-dir ones? Is there a better way to do this?

I think you are now talking of you original setup, not the one I proposed?

Cheers,
Jan



More information about the CMake mailing list