[CMake] NMake Makefiles, 2.4.4 and target link libraries

Bill Hoffman bill.hoffman at kitware.com
Tue Nov 28 21:30:44 EST 2006


Patrick J. Franz -- ML wrote:
> I upgraded to v2.4.4 today from v2.4.4-p3, I believe, and noticed that 
> one of my projects was no longer building. The error from the build 
> looks like:
>
>> Linking C shared library lib\my_library.dll
>> LINK : fatal error LNK1104: cannot open file 
>> "lib/my_library_dep.dll.lib"
>> NMAKE : fatal error U1077: 'link' : return code '0x450'
>> Stop.
>> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual 
>> Studio\VC98\bin\N
>> MAKE.EXE"' : return code '0x2'
>> Stop.
>> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual 
>> Studio\VC98\bin\N
>> MAKE.EXE"' : return code '0x2'
>> Stop.
>
> This is built from a Makefile generated with the "NMake Makefiles" 
> generator. The obvious problem is that there is no 
> 'my_library_dep.dll.lib' file available since the link library is 
> named 'my_library_dep.lib'. (I verified that 'my_library_dep.lib' was 
> built and is present in the lib/ subdirectory.)
>
> The relevant part of my CMakeLists.txt is:
>
> ADD_LIBRARY(my_library SHARED ${my_library_sources})
> TARGET_LINK_LIBRARIES(my_library my_library_dep)
>
> Has anyone else experienced this problem?

There must be something else going on how is my_library_dep defined?  Is 
it a cmake target?

The following works fine:
add_library(bar SHARED bar.c)
add_library(foo SHARED foo.c)
target_link_libraries(foo bar)

It also works if bar is not a cmake built library.   Can you post the 
CMakeCache.txt from that project?

-Bill




More information about the CMake mailing list