How to define a target to include multiple libraries stored in a single directory

258 views Asked by At

I want to create a module that allows a target to include multiple static libraries stored in the same directory.

The end goal is to allow a target to include -L<library dir> -l<staticlib-1> -l<staticlib-2> ... -l<staticlib-n> when linking.

I've tried using target_link_libraries like the following, which didn't worked:

    add_library(SomeTargetName INTERFACE)
    target_link_libraries(SomeTargetName INTERFACE "-L${SOME_TARGET_LIBRARY_DIR}" )

The above snippet causes the following error message:

INTERFACE_LIBRARY targets may only have whitelisted properties. The property "LINK_DIRECTORIES" is not allowed.

Does cmake support this kind of usecase? If so, how is it done?

0

There are 0 answers