[CMake] how do I test if a library target is static or shared?

Aleksander Demko ademko at gmail.com
Mon Sep 22 17:46:10 EDT 2008


Dang, that won't work for me. I'm in effect trying to make my own
EXPORT like command (export doesn't maintain C flags or other stuff I
need) so I need to be able to gleam a bunch of info from the library
targets dynamically.

Basically I want to quickly build one library in one cmake session,
than import it in another (without have to write custom Find-.cmake
files etc). Maybe this exists already in cmake, but I can't seem to
find it.


On Mon, Sep 22, 2008 at 4:32 PM, Mike Jackson
<mike.jackson at bluequartz.net> wrote:
> You will probably have to set your own variable into the cache and then
> check that variable later on in your scripts
>
>
>
> On Sep 22, 2008, at 5:23 PM, Aleksander Demko wrote:
>
>> On Mon, Sep 22, 2008 at 4:15 PM, Mike Jackson
>> <mike.jackson at bluequartz.net> wrote:
>>>
>>> Assuming you mean a library that you are creating the default is static.
>>> If
>>> you want a dynamic library then use the "SHARED" keyword:
>>>
>>> add_library (mylib SHARED libsource.cpp)
>>>
>>
>> I understand that. But later in my script I want to check if mylib is
>> shared or static with an IF command. I want the command to know if the
>> add_library was the default static, shared or shared because
>> BUILD_SHARE_LIBS is true.


More information about the CMake mailing list