Hi Martin,

On Wed, 1 Jun 2016 14:58:53 +0000
Wagner Martin <martin.wag...@neuberger.net> wrote:

> > 
> > Could you provide a working, stripped down example to show the
> > problem provided via github (in an example repo).
> >   
> 
> I've added a simple test project to 
> 
> https://github.com/martinwag/test_cmake/tree/master
> 
> Note that this example does not need cross gcc for ARM. It doesn't
> implement any useful functionality!

I forked your repo and played a little bit around. 

https://github.com/pboettch/test_cmake

Here are my conclusions:

1) Due to the use of add_libary(... OBJECTS ...) you cannot link
libraries with libraries or interfaces, this is a pity - especially for
a complex project with a lot of sub-dirs. 

There is a possibility to merge STATIC-libraries to generated one big
archive using external tools (libtool). If I were you I'd try to
this way to profit from the target_*-cmake-features.

2) I created a log-dir with an interface-library - which only carries
the log.h and thus the printf-prototypes

3) Both, drivers and terminal link with this interface-library (to get
their hands on log.h)

4) In addition I added two libraries to drivers/ uart-logging1 and
uart-logging2. This shows how you could compile-configure your
printf-function depending on the hardware used. In the main CMakeLists
you just need to select one of them - depending on the option's value.

Basically I followed the idea of instantiating a print-function
'somewhere' in the project (it could also be done outside) and then
select the one you want to use at the final link.

Of course this way you could add other ways of printf'ing - logging1
and logging2 are just stupid examples.

HTH and sorry for the delay,
--
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

Reply via email to