[CMake] add_library and target_link_libraries in different directories?

Andreas Pakulat apaku at gmx.de
Mon Jan 12 08:31:59 EST 2009


On 12.01.09 11:27:28, Alexandre Feblot wrote:
> Hi,
> 
>  
> 
> I have not been able to define a library dependency in a directory
> different from the one in which the library target is created.
> 
> Is this done by design, or is there any way to do it?
> 
>  
> 
> My goal would be to have
> 
> -          each library in it's own directory (and a CMakeLists.txt file
> with a add_library command)
> 
> -          all dependencies stored in a single file at the root level
> 

Then you need to call add_subdirectory() for the library subdirs before
linking the libs. You can't link a target that you havent' defined yet.

Andreas
 
-- 
Chicken Little was right.


More information about the CMake mailing list