[CMake] Subprojects and Cmake?

Nicholas Braden nicholas11braden at gmail.com
Sun Mar 6 13:04:31 EST 2016


If you are using the add_subdirectory approach, I believe you should
not be using find_package and instead you just need to use
target_link_libraries to have everything handled for you. Another
approach would be making a superproject that builds your dependencies
and your own project via ExternalProject_Add - this generally works
well especially since it allows the user to easily customize the build
of each dependency or use an existing install, and you don't have to
worry about name collisions.

On Sun, Mar 6, 2016 at 12:00 PM, Juhani Karlsson
<juhani.karlsson at talvi.com> wrote:
> Hi everyone,
>
> I`m having beginner problems how to include another Cmake project into
> another properly! (NanoGui)
>
> At the moment I`m using simply the add_subdirectory() command and then
> target_link_libraries to link it to the project.
> Seems to build fine, but when I try to include NanoGui in the project cannot
> find it correctly. What is the preferred workflow for this?
>
> I`m using Clion, GCC and built in CMake 3.3.
>
> Be gentle - total CMake newbie here : ) Image of the project and
> CMakeLists.txt in the attachments!
>
> I hope you can help!
> Thanks,
> - Juhani
>
> --
> --
> Juhani Karlsson
> 3D Artist/TD
>
> Talvi Digital Oy
> Tehtaankatu 27a
> 00150 Helsinki
> +358 443443088
> juhani.karlsson at talvi.fi
> www.vimeo.com/talvi
>
> --
>
> 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


More information about the CMake mailing list