[CMake] LINK_DIRECTORIES question...

Brad King brad.king at kitware.com
Thu Mar 31 08:23:35 EST 2005


Lars Pechan wrote:
>                top-level (CML1.txt)
>                             /   \                             \
>                            /     \                              \
>         foo (CML2.txt)  bar (CML3.txt)   exe (CML4.txt
> The main difference with my real setup is that I have about 25 
> directories on the same level as foo; most of which produce a static lib.
 > In VS.NET I get a 'library not found: foo.lib' whilst in the nmake
 > config it builds fine.

If you actually create this minimial example does the problem still 
occur?  Does the "foo.lib" actually exist in the appropriate place when 
the link error occurs?

> So I try to fix this by
> 1) Adding LINK_DIRECTORIES(${TOP-LEVEL_BINARY_DIR}/foo
>                                                           
> ${TOP-LEVEL_BINARY_DIR}/bar) to CML4.txt.
> I do this despite being able to see that VS.NET already has the path 
> setup correctly.

If the paths are already listed then this shouldn't be necessary.  Also 
you should never have to use ${CMAKE_CFG_INTDIR} in a LINK_DIRECTORIES 
command because CMake does it automatically for the VS generators.

> What am I doing wrong? What is the best-practice for writing 
> CMakeLists.txt files that work for both Nmake Makefiles and VS.NET2003?

The intention of CMake is that there should be no special needs to 
support multiple generators.

-Brad


More information about the CMake mailing list