[CMake] Approach to both shared and static lib (again, sorry)

Ray Donnelly mingw.android at gmail.com
Sat May 19 16:16:55 EDT 2018


On Sat, May 19, 2018, 8:50 PM Mateusz Loskot <mateusz at loskot.net> wrote:

> On 19 May 2018 at 15:00, Elvis Stansvik <elvis.stansvik at orexplore.com>
> wrote:
> > I know this has been asked before, but I've never seen a really
> > authoritative answer.
> >
> > Say I have a simple single-library project.
> >
> > The advise I've seen is to not pass SHARED or STATIC to the
> > add_library(..), but instead let the user pass
> > -DBUILD_SHARED_LIBS:BOOL=ON/OFF to build the library as either shared
> > or static.
> >
> > That's fine, but leads to packagers having to do ugly things like e.g:
> >
> >     https://salsa.debian.org/hle/dlib/blob/master/debian/rules
> >
> > That is, do two separate configure/build/install, in order to get both
> > a shared and static version.
>
> IMHO, there is nothing ugly in this approach.
> Not every system allows (or recomments) to generate both,
> static and shared, from the same object files.
> Why not view static vs shared as the similar to 32 vs 64 bit?
>

Because they are different architectures that in many cases require
different compilers and in some cases different host machines to run on.
Static vs shared has none of these issues to contend with.

>
> Best regards,
> --
> Mateusz Loskot, http://mateusz.loskot.net
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180519/d373753f/attachment.html>


More information about the CMake mailing list