[CMake] Config.cmake.in: Conditionally serve static or shared library

Kim Walisch kim.walisch at gmail.com
Thu Feb 15 02:11:05 EST 2018


Thanks for your comment, I seem to have misunderstood the usage of
BUILD_SHARED_LIBS. I will remove the hack to serve either a static or
shared libprimesieve from my cmake config file.

Kim

On Feb 14, 2018 11:42 PM, "Hendrik Sattler" <post at hendrik-sattler.de> wrote:

>
>
> Am 14. Februar 2018 21:47:24 MEZ schrieb Kim Walisch <
> kim.walisch at gmail.com>:
> >Thanks, I got it working!
> >
> >Unfortunately I could not make the generator expression work inside
> >PrimesieveConfig.cmake.in, here is the error message:
> >
> >CMake Error:
> >  Error evaluating generator expression:
> >    $<BUILD_SHARED_LIBS:libprimesieve>
> >  Expression did not evaluate to a known generator expression
> >
> >Note that in my main CMakeLists.txt the generator expression worked
> >fine. But I figured out I don't actually need the generator expression,
> >the following code inside my PrimesieveConfig.cmake.in does the trick:
> >
> >if(BUILD_SHARED_LIBS)
>
> This is IMHO using the wrong variable! This variable tells that I want to
> build MY libs as static, not that I want to link 3rdParty libs statically!
> At least this is surprising behavior.
>
> OTOH and luckily, there are still the real targets to choose from.
>
> >This trick is also used by the c-ares library:
>
> Others also doing this wrong does not make it any better.
>
> HS
>
> --
> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
> gesendet.
> --
>
> 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/20180215/bd8b0118/attachment.html>


More information about the CMake mailing list