[CMake] LINK : fatal error LNK1104: cannot open file 'z.lib'

Tyler Roscoe tyler at cryptio.net
Sat Jun 6 13:14:28 EDT 2009


On Sat, Jun 06, 2009 at 09:30:00AM +0200, motes motes wrote:
> I use cmake to create makefiles for a C++ project. One of the target links
> is just called 'z':
> 
> TARGET_LINK_LIBRARIES(z  ...

What do you mean by "target links"? Do you mean "libraries needed by my
target"?

Your TARGET_LINK_LIBRARIES line makes it look like z is the name of the
target you are building.

> When I try to compile the code (Visual Studio 2008) I get:
> 
> LINK : fatal error LNK1104: cannot open file 'z.lib'
> 
> I have tried to download zlib for windows and point to the zlib .lib files
> from VS 2008 but that is not what it want. What is 'z'?

What do you mean by "that is not what it want"? The error you are seeing
implies that VS can't find the z.lib that you downloaded. Maybe you need
to adjust your library search path with link_directories()?

tyler


More information about the CMake mailing list