[CMake] find_package() for static only / shared only
Mario Emmenlauer
mario at emmenlauer.de
Fri Mar 23 05:24:10 EDT 2018
Dear PF, thanks! I think this is a quite sensible approach and I will
do as you suggest. I did not consider it at first because there are
some packages that can install static and shared side-by-side. But I
agree that your suggestion is ore pragmatic and also less error-prone.
All the best,
Mario
On 23.03.2018 00:57, P F 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
>
>
Viele Gruesse,
Mario Emmenlauer
--
BioDataAnalysis GmbH, Mario Emmenlauer Tel. Buero: +49-89-74677203
Balanstr. 43 mailto: memmenlauer * biodataanalysis.de
D-81669 München http://www.biodataanalysis.de/
More information about the CMake
mailing list