[CMake] Re-defining CMAKE_CXX_FLAGS with /TP for cl.exe

Knox, Kent Kent.Knox at amd.com
Mon Jun 29 18:20:51 EDT 2009


I've just stumbled across some surprising cl.exe behavior, and I would like to see if the collective minds of this dist list has come across this before.

In my c++ project, I override CMAKE_CXX_FLAGS with my own flags, including /TP.  Using an nmake based build, this causes the linking step to bomb.  Enabling verbose mode for nMake, I saw that /TP was actually being defined twice, once by me and I suppose cMake did too for good measure.  By eliminating my flags one by one, I found that my /TP caused the link problem.

This is using cmake 2.6.4, 64bit MSVC tools and nmake generator.  Snippet of error log below.  Does this make sense to anybody?

Kent

====================
[100%] Building CXX object foobar/CMakeFiles/foobar.dir/blahManager.cpp.obj
        cd C:\Programming\foobar\nMake\foobar
        C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe  @C:\Users\kknox\AppData\Loca
l\Temp\nm26C5.tmp
Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

cl   /DWIN32 /D_CONSOLE /EHsc /RTC1 /W3 /TP /DUNICODE /D_UNICODE /Od /D_DEBUG /MDd /Zi 
-IC:\Programming\boost_1_39_0  /TP /FoCMakeFiles\foobar.dir\blahManager.cpp.obj 
/FdC:\Programming\foobar\nMake\foobar\foobar.pdb -c C:\Programming\foobar\foobar\blahManager.cpp

blahManager.cpp
        cd C:\Programming\foobar\nMake
Linking CXX executable foobar.exe
        cd C:\Programming\foobar\nMake\foobar
        C:\Utils\cmake-2.6.4-win32-x86\bin\cmake.exe -E vs_link_exe C:\PROGRA~2\
MICROS~1.0\VC\bin\amd64\cl.exe   @CMakeFiles\foobar.dir\objects1.rsp @C:\
Users\kknox\AppData\Local\Temp\nm2E55.tmp
Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

cl CMakeFiles\foobar.dir\foobar.cpp.obj CMakeFiles\foobar.dir\fooService.cpp.obj CMakeFiles\foobar.dir\stdafx.cpp.obj CMakeFiles\
foobar.dir\barService.cpp.obj CMakeFiles\foobar.dir\blahManager.cpp.obj

foobar.cpp.obj
CMakeFiles\foobar.dir\foobar.cpp.obj(2) : error C2146: syntax error : missing ';' before identifier '¶8IJoí'
CMakeFiles\foobar.dir\foobar.cpp.obj(2) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
CMakeFiles\foobar.dir\foobar.cpp.obj(2) : error C2146: syntax error : missing ';' before identifier 'y'
CMakeFiles\foobar.dir\foobar.cpp.obj(2) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
CMakeFiles\foobar.dir\foobar.cpp.obj(2) : error C2143: syntax error : missing ';' before '%'
CMakeFiles\foobar.dir\foobar.cpp.obj(2) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
CMakeFiles\foobar.dir\foobar.cpp.obj(2) : error C3193: '%' : requires '/clr' command line option
CMakeFiles\foobar.dir\foobar.cpp.obj(2) : error C2059: syntax error : '.'
CMakeFiles\foobar.dir\foobar.cpp.obj(2) : error C2018: unknown character '0x2'
CMakeFiles\foobar.dir\foobar.cpp.obj(2) : error C2018: unknown character '0x1'
CMakeFiles\foobar.dir\foobar.cpp.obj(3) : error C2018: unknown character '0x10'
CMakeFiles\foobar.dir\foobar.cpp.obj(3) : error C2018: unknown character '0x1'



More information about the CMake mailing list