[CMake] Relinking static libs

Bill Hoffman bill.hoffman at kitware.com
Thu Apr 10 09:25:40 EDT 2008


Jean Lepropre wrote:
> Ok, I have similar instructions and it does not work (relink is not done):
> 
> 
> 1. In top-level CMakeLists.txt:
> ...
> ADD_SUBDIRECTORY(libs/bar)
> ADD_SUBDIRECTORY(applications/foo)
> ...
> 
> 
> 2. In libs/bar/CMakeLists.txt:
> ...
> ADD_LIBRARY(bar STATIC ...)
> ...
> 
> 
> 3. In applications/foo/CMakeLists.txt:
> ...
> LINK_DIRECTORIES(${foo_BINARY_DIR}/../../libs/bar)
This looks odd, you should not need this link_directories call.

> ADD_EXECUTABLE(foo ...)
> TARGET_LINK_LIBRARIES(foo bar ...)
> ...
> 
> 
> 4. In generated applications/foo/CMakeFiles/foo.dir/build.make, there is 
> no
> dependence on libbard.a.
> 

Please provide a complete example and email me a tar or zip file, and I 
will test it.

-Bill


More information about the CMake mailing list