[CMake] find_package() for static only / shared only

Ray Donnelly mingw.android at gmail.com
Thu Mar 22 22:14:53 EDT 2018


Our why doesn't cmake set a long needed standard here of .dll.lib and be
done with this nonsense?

On Thu, Mar 22, 2018, 11:58 PM P F via CMake <cmake at cmake.org> wrote:

> Why not install shared libraries in one location and static libraries in
> another?
>
> > On Mar 21, 2018, at 4:55 AM, Mario Emmenlauer <mario at emmenlauer.de>
> wrote:
> >
> >
> > I've googled this issue for a while now but found only few
> > references (1,2) and no solution. I'd like to enforce that
> > find_package() will only accept static or shared libraries.
> > I would then set this option based on BUILD_SHARED_LIBS=(ON|OFF).
> >
> > I.e. I'd love to have something like:
> >    if(BUILD_SHARED_LIBS)
> >        BUILD_TYPE="SHARED"
> >    else()
> >        BUILD_TYPE="STATIC"
> >    endif()
> >    find_package(XXX ${BUILD_TYPE})
> >    find_package(YYY ${BUILD_TYPE})
> >    find_package(ZZZ ${BUILD_TYPE})
> >    ...
> >
> >
> > It seems that this does not exist? I could also not find a
> > good workaround. The best I can find is to use 'NAMES' and
> > add the static or shared library names manually.
> >
> > This is not very suitable, because I have a project with more
> > than 30 dependencies. The project should either build (fully)
> > static or (fully) shared. I can not easily maintain lists of
> > 30 static and shared library names on several platforms.
> >
> > Is there a solution or good workaround?
> >
> > All the best,
> >
> >    Mario Emmenlauer
> >
> >
> > (1) https://cmake.org/pipermail/cmake/2012-September/052059.html
> > (2) https://cmake.org/pipermail/cmake/2010-December/041326.html
> >
> >
> > --
> > BioDataAnalysis GmbH, Mario Emmenlauer      Tel. Buero: +49-89-74677203
> > Balanstr. 43                   mailto: memmenlauer * biodataanalysis.de
> > D-81669 München                          http://www.biodataanalysis.de/
> > --
> >
> > 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
>
> --
>
> 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/20180323/40cf23e8/attachment.html>


More information about the CMake mailing list