[CMake] Couple of library/link questions

Andreas Pakulat apaku at gmx.de
Tue Mar 20 18:21:03 EDT 2012


On 20.03.12 14:01:31, Oliver Smith wrote:
> I'm trying to make a CMakeLists for libevent, and had a couple of
> questions that would make it a bit cleaner:
> 
> - Other than using a macro to do { add_executable(...)
> target_link_libraries(...) } is there a /clean/ way to make
> everything in a subdirectory automatically link a given library?

No.

> - The makefiles I'm basing this on build libevent_core.lib,
> libevent_extras.lib and then libevent.lib which is basically the two
> previous libraries merged.
> 
> I wanted to do:
> 
> ADD_LIBRARY(libevent_core ${CoreSrcFiles})
> ADD_LIBRARY(libevent_extras ${ExtraSrcFiles})
> ADD_LIBRARY(libevent)
> TARGET_LINK_LIBRARIES(libevent libevent_core libevent_extras)
> 
> but this generates a warning/error,  listing the two libraries in

Whats the error? It should just work.

Andreas



More information about the CMake mailing list