Re: [CMake] Subprojects and Cmake?

2016-03-06 Thread Nicholas Braden
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
 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.karls...@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
-- 

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


Re: [CMake] Subprojects and Cmake?

2016-03-06 Thread Juhani Karlsson
Thanks for the fast answer Nicholas!

Superproject sounds good to my ears!
I`m going to try the ExternalProject_Add again. I think I missed something
essential when I tried to use it!
NanoGui builds fine as is - so Its just me fng things up ; )

Thanks,
- J

On 6 March 2016 at 20:04, Nicholas Braden 
wrote:

> 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
>  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.karls...@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
>



-- 
-- 
Juhani Karlsson
3D Artist/TD

Talvi Digital Oy
Tehtaankatu 27a
00150 Helsinki
+358 443443088
juhani.karls...@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