Re: [CMake] Dependency on imported target with ninja-generator

2016-06-28 Thread Patrick Boettcher
On Wed, 22 Jun 2016 19:44:14 -0500
Nicholas Braden  wrote:

> If Project B depends on Project A, you should probably be using the
> ExternalProject module with a superproject structure that builds both
> projects in the proper order.
> 
> https://cmake.org/cmake/help/latest/module/ExternalProject.html
> 
> Trying to manually call CMake is not really a good idea IMO - let
> ExternalProject handle it for you.

That was it: superproject - based on CMake + ExternalProject.

Thanks a lot.

Regards,
--
Patrick.
-- 

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] Dependency on imported target with ninja-generator

2016-06-22 Thread Nicholas Braden
If Project B depends on Project A, you should probably be using the
ExternalProject module with a superproject structure that builds both
projects in the proper order.

https://cmake.org/cmake/help/latest/module/ExternalProject.html

Trying to manually call CMake is not really a good idea IMO - let
ExternalProject handle it for you.

On Wed, Jun 22, 2016 at 10:59 AM, Patrick Boettcher
 wrote:
> Hi list,
>
> I'm finding myself in the following situation.
>
> - Project A generates libmain.a and export(TARGETS ... NAMESPACE ns) it
>   to a file. The target is called ns::main
>
> - Project B includes this file and has some executables link with
>   libmain.a (via target_link_libraries(exe ns::main).
>
> - Project B's CMakeLists.txt contains a add_custom_target(build ...)
>   which runs cmake --build in project A's build-dir.
>
> - the target build is a add_dependency() of ns::main.
>
> Building it with gnu-make works like a charm - make is entering project
> A's build-dir before linking.
>
> Building it with ninja fails with not finding libmain.a - which is
> normal it has not yet been built. Ninja seems to evaluate the complete
> dependency-tree of files before doing anything.
>
> Is there a way to fix this?
>
> Thanks.
>
> best regards,
> --
> Patrick.
>
>
>
> --
>
> 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