[CMake] Cross compile + shared libs problem

Frederik Deweerdt deweerdt at free.fr
Tue Mar 25 14:36:54 EDT 2008


On Tue, Mar 25, 2008 at 05:55:00PM +0100, Alexander Neundorf wrote:
> On Tuesday 25 March 2008, Frederik Deweerdt wrote:
> > On Tue, Mar 25, 2008 at 01:19:52AM +0100, Alexander Neundorf wrote:
> > > On Tuesday 25 March 2008, Frederik Deweerdt wrote:
> > > > Hi,
> > > >
> > > > I'm trying to cross-compile static libraries for RTEMS. Our project's
> > > > also targets Linux, where we use shared libraries. We declare the
> > > > libraries with: add_library(libname srcs...). So STATIC or SHARED is
> > > > omitted.
> > > > On RTEMS there are no static libraries, so I was expecting that by
> > > > setting BUILD_SHARED_LIBS to OFF in the toolchain file, I would get
> > > > static libraries.
> > >
> > > Does this value end up in the cache ?
> > > Is it still OFF in the cmake files of your application ?
> >
> > Hm yes, sorry I missed a trivial set in one of our CMakeLists.txt.
> 
> So it works now ?
Yes it does, thanks.
> 
> > > In Modules/Platform/ you can find an eCos.cmake. eCos is in general quite
> > > similar to RTEMS (also RTOS, also one address space, also no shared libs,
> > > etc.). It contains:
> > > # eCos doesn't support shared libs
> > > SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
> > >
> > > SET(CMAKE_CXX_LINK_SHARED_LIBRARY )
> > > SET(CMAKE_CXX_LINK_MODULE_LIBRARY )
> > > SET(CMAKE_C_LINK_SHARED_LIBRARY )
> > > SET(CMAKE_C_LINK_MODULE_LIBRARY )
> > >
> > > You should also create a RTEMS.cmake (if you haven't done so yet) and use
> > > these settings there. If you have problems with this let me know.
> > > I'd really be happy to add that to cmake cvs.
> >
> > I first did that, but as I need it done for tomorrow, I ended up
> > throwing the four lines (a ripoff of eCos.cmake basically), in the
> > Toolchain file.
> > I'll be able to send you a cleaned-up patch later this week.
> 
> Yes, please do so :-)
I validated the general approach this morning, should be ready by
tomorrow.

Regards,
Frederik


More information about the CMake mailing list