[CMake] LINK_DIRECTORIES before ADD_EXECUTABLE?
Tyler Roscoe
tyler at cryptio.net
Mon May 18 18:36:33 EDT 2009
On Mon, May 18, 2009 at 11:21:17PM +0100, John Platt wrote:
> INCLUDE_DIRECTORIES( /usr/local/boost_1_39_0 )
> ADD_LIBRARY( lib1 STATIC ${lib1_srcs} )
>
> ADD_EXECUTABLE( lib1test lib1test.cpp )
> LINK_DIRECTORIES( /usr/local/lib ) # boost stuff
> TARGET_LINK_LIBRARIES( lib1test lib1 boost_filesystem-gcc42-mt boost_system-gcc42-mt )
[...]
> If LINK_DIRECTORIES is moved before ADD_EXECUTABLE -
>
> LINK_DIRECTORIES( /home/john/lib1/src ) ## works here
> ADD_EXECUTABLE( lib2test lib2test.cpp )
> TARGET_LINK_LIBRARIES( lib2test lib2 lib1 boost_filesystem-gcc42-mt boost_system-gcc42-mt)
>
> lib2test links and executes.
>
> 1. Are the boost libraries statically or dynamically linked to lib1test?
I believe that depends on whether your boost libraries are static or
dynamic libraries. Maybe I don't understand the question?
> 2. Why does moving LINK_DIRECTORIES before ADD_EXECUTABLE appear to fix things?
More information about the CMake
mailing list