[CMake] Problem with link directories

jolinda jolinda at uoregon.edu
Fri Mar 10 12:14:20 EST 2006


Thanks Brad and Bill for your help. I misunderstood before -- I thought you
meant I had to have LINK_DIRECTORIES before TARGET_LINK_LIBRARIES, not
ADD_EXECUTABLE. If this is documented somewhere I apologize for missing it.

Jolinda


-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Friday, March 10, 2006 6:07 AM
To: jolinda at uoregon.edu
Cc: cmake at www.cmake.org
Subject: Re: [CMake] Problem with link directories


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