[CMake] Problem with link directories

Brad King brad.king at kitware.com
Fri Mar 10 09:06:50 EST 2006


jolinda wrote:
> Just to check, I've made the littlest cmakelists.txt file I can that shows
> the problem. Here it is in it's entirety: 
> 
> PROJECT(MyProject)
> ADD_EXECUTABLE(MyProject WIN32 file2.cpp )
> LINK_DIRECTORIES( "d:/dcmtk-3.5.3" )
> TARGET_LINK_LIBRARIES(MyProject dcmdata.lib)
> 
> If I build a project for Visual Studio 7 using CMake 1.8, I see the
> following under the debug Win32 configuration in MyProject.vcproj.cmake:

That does not add the link directories before the target.  Try this:

PROJECT(MyProject)
LINK_DIRECTORIES( "d:/dcmtk-3.5.3" )
ADD_EXECUTABLE(MyProject WIN32 file2.cpp )
TARGET_LINK_LIBRARIES(MyProject dcmdata.lib)

Now the MyProject executable will have the given set of link 
directories.  You can also do this:

ADD_EXECUTABLE(MyProject WIN32 file2.cpp )
TARGET_LINK_LIBRARIES(MyProject d:/dcmtk-3.5.3/dcmdata.lib)

-Brad


More information about the CMake mailing list