The LINK_DIRECTORIES has to be before the ADD_EXECUTABLE. Another way to do it that should work for both version of cmake is to use the full path to the library in target_link_libraries.
target_link_libraries(MyProject d:/dcmtk-3.5.3/dcmdata.lib) The duplicate library stuff has been fixed in cvs CMake as well. -Bill At 06:48 PM 3/9/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: > ><Tool > Name="VCLinkerTool" > AdditionalOptions="/MACHINE:I386 /STACK:10000000 /machine:I386 >/INCREMENTAL:YES" > AdditionalDependencies=" odbc32.lib odbccp32.lib dcmdata.lib " > OutputFile="Debug\MyProject.exe" > LinkIncremental="1" > SuppressStartupBanner="TRUE" > >AdditionalLibraryDirectories="d:\dcmtk-3.5.3\$(INTDIR),d:\dcmtk-3.5.3\" > ProgramDatabaseFile="$(OutDir)\MyProject.pdb" > GenerateDebugInformation="TRUE" > SubSystem="2" > StackReserveSize="10000000"/> > > >If I try the same thing using CMake 2.2, I get this: > ><Tool > Name="VCLinkerTool" > AdditionalOptions="/MACHINE:I386 /STACK:10000000 /machine:I386 " > AdditionalDependencies="kernel32.lib user32.lib gdi32.lib >winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib >uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib >winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib >uuid.lib odbc32.lib odbccp32.lib dcmdata.lib " > OutputFile="Debug\MyProject.exe" > LinkIncremental="2" > AdditionalLibraryDirectories="" > ProgramDatabaseFile="$(OutDir)\MyProject.pdb" > GenerateDebugInformation="TRUE" > SubSystem="2" > StackReserveSize="10000000"/> > >So, not only are my library directories not there, but there's an explosion >of redundant dependencies. > >Jolinda > >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of Brad King >Sent: Thursday, March 09, 2006 6:34 AM >To: [EMAIL PROTECTED] >Cc: [EMAIL PROTECTED] >Subject: Re: [CMake] Problem with link directories > > >jolinda wrote: >> Hi, >> >> I have a Visual Studio 7.0 project that was building fine using >> CMake-1.8 that won't build with version 2.2. I have a simple >> CMakeLists.txt file that includes things like: >> >> LINK_DIRECTORIES( ${DCMTK_PATH}/dcmdata/libsrc >> ${DCMTK_PATH}/dcmimage/libsrc ) >> >> When using version 1.8, these directories show up under >> "AdditionalLibraryDirectories" in the file Voxelator.vcproj.cmake. >> However, after using version 2.2, I see AdditionalLibraryDirectories = >> "". >> >> Has something changed in the new version? > >Move the call to be before the targets that need it are added. > >-Brad >_______________________________________________ >CMake mailing list >[email protected] >http://www.cmake.org/mailman/listinfo/cmake > >_______________________________________________ >CMake mailing list >[email protected] >http://www.cmake.org/mailman/listinfo/cmake _______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
