[CMake] --whole-archive

2007-09-13 Thread Juan Sanchez
Hi,

On linux, I need to generate an shared library from an archive.  I need
to have:

-Wl,-whole-archive

before and

-Wl,-no-whole-archive

after the archive on the shared library link line.  Is there a way to do
this.  The static archive is compiled fPIC so symbol relocation is not
an issue.

Thanks,

Juan
-- 
Juan Sanchez
[EMAIL PROTECTED]
800-538-8450 Ext. 54395
512-602-4395


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] --whole-archive

2007-09-13 Thread Juan Sanchez
After some extensive googling, I found the solution here.

http://www.mail-archive.com/cmake@cmake.org/msg01890.html



Juan Sanchez wrote:
> Hi,
> 
> On linux, I need to generate an shared library from an archive.  I need
> to have:
> 
> -Wl,-whole-archive
> 
> before and
> 
> -Wl,-no-whole-archive
> 
> after the archive on the shared library link line.  Is there a way to do
> this.  The static archive is compiled fPIC so symbol relocation is not
> an issue.
> 
> Thanks,
> 
> Juan


-- 
Juan Sanchez
[EMAIL PROTECTED]
800-538-8450 Ext. 54395
512-602-4395


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


[CMake] whole archive linkage

2015-01-23 Thread Adam
Hi All,

I have a library that must be linked with -Wl,--whole-archive -lyourlib

The library contains a static which registers itself in its constructor.
This problem is described here http://stackoverflow.com/a/842770

Is there a target property I can set on this library so consumers of the
library automatically get whole archive linkage when including this library.


Regards,
Adam
-- 

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] whole archive linkage

2015-01-23 Thread J Decker
can just include it in the list of target_link_libraries() directive

On Fri, Jan 23, 2015 at 7:41 PM, Adam  wrote:

> Hi All,
>
> I have a library that must be linked with -Wl,--whole-archive -lyourlib
>
> The library contains a static which registers itself in its constructor.
> This problem is described here http://stackoverflow.com/a/842770
>
> Is there a target property I can set on this library so consumers of the
> library automatically get whole archive linkage when including this library.
>
>
> Regards,
> Adam
>
>
>
> --
>
> 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] whole archive linkage

2015-01-23 Thread Braden McDaniel
On Sat, 2015-01-24 at 13:41 +1000, Adam wrote:

> The library contains a static which registers itself in its
> constructor. This problem is described here
> http://stackoverflow.com/a/842770

As something of an aside to your question, I don't know that I accept
that as a sane use case.  C++ doesn't guarantee that (in that example) m
will be constructed before h.  If m is not constructed first,
construction of h calls operator[] on an uninitialized object.


-- 
Braden McDaniel 

-- 

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] whole archive linkage

2015-01-24 Thread Adam
On Sat, 2015-01-24 at 01:43 -0500, Braden McDaniel wrote:
> On Sat, 2015-01-24 at 13:41 +1000, Adam wrote:
> 
> > The library contains a static which registers itself in its
> > constructor. This problem is described here
> > http://stackoverflow.com/a/842770
> 
> As something of an aside to your question, I don't know that I accept
> that as a sane use case.  C++ doesn't guarantee that (in that example) m
> will be constructed before h.  If m is not constructed first,
> construction of h calls operator[] on an uninitialized object.
> 

I agree.  The actually legacy library I'm using has wrapped the global
map 'm' inside a singleton which I believe resolves the static ordering
issue. 

I currently have to specify something like the following for every
application that wants to use this library

target_link_libraries(
   Application
   -Wl,--whole-archive -llegacyLib -Wl,--no-whole-archive
   libA
   libB )

I was hoping there might have been a better way to do this with target
properties of legacyLib.

~Adam


-- 

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] whole archive linkage

2015-01-24 Thread Stephen Kelly
Adam wrote:

> I was hoping there might have been a better way to do this with target
> properties of legacyLib.
> 

There is with cmake 3.1:

 set(isExe $,EXECUTABLE>)
 target_sources(legacyLib INTERFACE 
  "$<${isExe}:${CMAKE_CURRENT_SOURCE_DIR}/use_symbol.cpp>")

LegacyLib provides a simple source file which gets compiled into executables 
linking to it, and the source file invokes the singleton or whatever.

This kind of use-case was the primary motivation for target_sources.

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/7082

Thanks,

Steve.


-- 

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