[CMake] Correct usage of add_library

Sergei Nikulov sergey.nikulov at gmail.com
Wed Dec 23 05:38:38 EST 2015


Hello,

2015-12-23 13:32 GMT+03:00 Cedric Doucet <cedric.doucet at inria.fr>:
>
> Hello,
>
> I have a code which consist in a kernel and several independent modules
> which depend on this kernel.
> I would like to let users build the module they want by typing, for example,
>
>     make module1
>
> to build the first module.
> But, as this first module depends on the kernel, I need this kernel to be
> built BEFORE module1.
>

You should add

add_dependencies(module1 kernel)

in your module1 CMakeLists.txt

https://cmake.org/cmake/help/latest/command/add_dependencies.html

HTH,

-- 
Best Regards,
Sergei Nikulov


More information about the CMake mailing list