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

Hendrik Sattler post at hendrik-sattler.de
Wed Feb 14 17:42:29 EST 2018



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.


More information about the CMake mailing list