[CMake] CMake & MFC

Robert Dailey rcdailey at gmail.com
Thu Oct 20 15:12:48 EDT 2011


Also for reference, our original build system uses Cygwin and makefiles.
Below I will paste the command line invoked to compile 1 source file in this
MFC project as well as the link command.

Also please note that when building through our original build system, which
also uses VS2003, it successfully builds. For some reason it isn't trying to
find mfc40.lib. I don't understand command line builds using MSVC so I'm
hoping someone with more experience can maybe find a missing piece to the
puzzle here.

There is a file called "uploadlogDlg.cpp" and this is the command used to
build it:

"C:/PROGRA~1/MICROS~1.NET/Vc7"/bin/cl.exe      -nologo -MDd -EHsc -GT
-Zm800 -YX -FpWINNT5.0_DBG.OBJ/vc7.pch -D_MBCS -D_AFXDLL -D_WINDOWS
-D_WINDLL -D_AFXDLL -D_USRDLL -D_HAVE_STL_ -D_WINDOWS
-D_WIN32_WINNT=0x0400 -DUNSAFE_CONFIGOPS_ALLOWED   -DPRODUCT_TESS
-DUSE_GTINET=true -DDEBUG -D_HAVE_STL_ -D_REENTRANT -D_STLP_DEBUG
-DBUILD_VERSION=\"6.3.2.111019021006\" -D_X86_ -DWINNT -DWIN32
-D_WIN32_WINNT=0x0500 -DWINVER=0x500 -DWIN32_IMPORT_EXPORT -DSTL=std
-I. -IWINNT5.0_DBG.OBJ -I../../../work/B1/WINNT5.0_DBG.OBJ/bin
-I../../../work/B1/WINNT5.0_DBG.OBJ/include
-I../../../work/B1/WINNT5.0_DBG.OBJ/include/nspr
-I../../../work/B1/WINNT5.0_DBG.OBJ/include/stlport
-I../../../work/B1/WINNT5.0_DBG.OBJ/include/gtinet -X
-I"C:/PROGRA~1/MICROS~1.NET/Vc7"/include
-I"C:/PROGRA~1/MICROS~1.NET"/VC7/PlatformSDK/include
-I../../../work/B1/WINNT5.0_DBG.OBJ/include/mssdkutils
-I"C:/PROGRA~1/MICROS~1.NET/Vc7"/atlmfc/include
-I"C:/PROGRA~1/MICROS~1.NET/Vc7"/atlmfc/include   -Zi -D_DEBUG -Od -W3
-FdWINNT5.0_DBG.OBJ/vc7.pdb /RTC1 -we4103 -GR -GF -D_USE_32BIT_TIME_T
   -c \
	\
	/FoWINNT5.0_DBG.OBJ/uploadlogDlg.obj \
	\
	uploadlogDlg.cpp



Also here is the linker command from what I can see:

"C:/PROGRA~1/MICROS~1.NET/Vc7"/bin/cl.exe \
	\
	/FeWINNT5.0_DBG.OBJ/uploadlog.exe \
	\
	WINNT5.0_DBG.OBJ/StdAfx.obj WINNT5.0_DBG.OBJ/uploader.obj
WINNT5.0_DBG.OBJ/uploadlog.obj WINNT5.0_DBG.OBJ/uploadlogDlg.obj
WINNT5.0_DBG.OBJ/mlog.obj  WINNT5.0_DBG.OBJ/uploadlog_exe.res
-FmWINNT5.0_DBG.OBJ/uploadlog.map /link /DEBUG /DEBUGTYPE:CV /FIXED:NO
/SUBSYSTEM:WINDOWS      -nologo /LIBPATH:WINNT5.0_DBG.OBJ
/LIBPATH:../common/WINNT5.0_DBG.OBJ
/LIBPATH:../../../work/B1/WINNT5.0_DBG.OBJ/lib
/LIBPATH:"C:/PROGRA~1/MICROS~1.NET/Vc7"/atlmfc/lib
/LIBPATH:../../../work/B1/WINNT5.0_DBG.OBJ/lib -debug -debugtype:cv
\
	 advapi32.lib gdconfig.lib gdlog.lib gdlogviewer.lib gdnet.lib
gdutil.lib gdgsoap.lib gmmwsclient.lib ole32.lib Ws2_32.lib gdzlib.lib
-pdb:WINNT5.0_DBG.OBJ/uploadlog.pdb libnspr4.lib libplc4.lib
libplds4.lib
c:/cygwin/bin/cp.exe -fup WINNT5.0_DBG.OBJ/uploadlog.exe
WINNT5.0_DBG.OBJ/uploadlog.pdb WINNT5.0_DBG.OBJ/uploadlog.map
WINNT5.0_DBG.OBJ/uploadlog.pdb WINNT5.0_DBG.OBJ/uploadlog.map
../../../work/B1/WINNT5.0_DBG.OBJ/bin



---------
Robert Dailey


On Thu, Oct 20, 2011 at 2:04 PM, Robert Dailey <rcdailey at gmail.com> wrote:

> I grepped everything possible, I found nothing related to mfc4. This is
> getting scary...
>
> Since I'm not a CMake developer or expert, can someone guide me with steps
> on how to debug this issue? If I need to debug CMake itself from source,
> that is acceptable but hopefully we don't need to start there.
>
> Once I open the generated VS2008 solution, is there anything in project
> settings I can look at to maybe see something suspicious? Just let me know
> what I need to do and I"ll post the information you need.
>
> Thanks in advance...
>
> ---------
> Robert Dailey
>
>
>
> On Thu, Oct 20, 2011 at 12:01 PM, Robert Dailey <rcdailey at gmail.com>wrote:
>
>> I did this and it links just fine... hmmm. Let me grep my source tree for
>> "mfc4" and see what I get. I really am running out of ideas, I don't know
>> what else to look for.
>>
>> ---------
>> Robert Dailey
>>
>>
>>
>> On Thu, Oct 20, 2011 at 11:46 AM, Bill Hoffman <bill.hoffman at kitware.com>wrote:
>>
>>> On 10/20/2011 12:35 PM, Robert Dailey wrote:
>>>
>>>> I just tried with VS2008 and I get the same:
>>>>     fatal error LNK1104: cannot open file 'mfc40.lib'
>>>>
>>>> Also I created a default MFC application using the new project wizard in
>>>> VS2008 and it compiled & linked just fine, so it seems like maybe this
>>>> is a CMake issue?
>>>>
>>>>
>>> Can you take the default MFC app that you created, and write CMake files
>>> for it?  Then see if that works?
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111020/d657efb5/attachment-0001.htm>


More information about the CMake mailing list