[CMake] Marking a library dependency from within a library.

Bill Hoffman bill.hoffman at kitware.com
Thu Oct 18 07:47:35 EDT 2007


Josef Karthauser wrote:
> I have a library (libA), which depends upon another library (libB) for 
> its implementation.    I also have an executable (execC) which uses 
> LibA.  Is there an easy way of getting LibB added to the list of 
> dependencies, so what when I do
> 
>  
> 
>   Add_Executable(exeC)
> 
>   Target_Link_Libraries(exeC libA)
> 

Yes, where you create libA, you add this:

target_link_libraries(libA libB)

CMake will automatically chain.

-Bill


More information about the CMake mailing list