[CMake] Import library for executables?

Hariharan Iyer hariharan022 at gmail.com
Wed Sep 1 08:52:56 EDT 2010


  Hello folks,

I'm building an executable called foo.exe (project name foo) and a 
library called foo.lib (project name libfoo) that the executable depends 
on. I have an ImportLibrary line for foo.exe which looks like this:
ImportLibrary="<path>\lib\Debug\foo.lib"

and an OutputFile line for foo.lib that looks like this:
OutputFile="<path>\lib\Debug\foo.lib"

My build for the executable (foo.exe) fails with the following error:

"LINK : fatal error LNK1149: output filename matches input filename 
'foo.lib'"

A few questions:
1. I'm not sure if the error is because of the same name, but in any 
case, it seems to be wrong because one of the two libraries will be 
overwritten by the other. How do I avoid this (apart from using 
different names, of course) ?
2. Why is an import library required for the executable ? Isn't it only 
for DLL's?

Regards,
Hari



More information about the CMake mailing list