MantisBT - CMake
View Issue Details
0007045CMakeCMakepublic2008-05-18 23:572008-08-19 15:55
Eric Wing 
 
normalminoralways
closedfixed 
CMake-2-6 
 
0007045: CMake compiles Obj-C (.m) files with g++ instead of gcc (Mac)
I noticed that .m files are being compiled with g++ instead of gcc in non-C++ projects in the Makefile generator. The .m is for Objective-C, the .mm is for Objective-C++. In the former case, gcc should be used, not g++. This gives me linking problems in certain cases, presumably dealing with C++ name mangling, gcc incompatibility (such as linking stuff compiled with gcc 3.3 vs gcc 4.0), or stricter type checking.

Attached are two simple test programs, one with .m, the other with .mm.
With the Makefiles, gcc should be invoked in the .m test. g++ should be invoked (as it is now) with the .mm file.

The Xcode generator does the correct thing.

No tags attached.
gz HelloObjC.tar.gz (726) 2008-05-18 23:57
https://public.kitware.com/Bug/file/1472/HelloObjC.tar.gz
Issue History
2008-05-18 23:57Eric WingNew Issue
2008-05-18 23:57Eric WingFile Added: HelloObjC.tar.gz
2008-08-19 15:55Bill HoffmanStatusnew => closed
2008-08-19 15:55Bill HoffmanNote Added: 0013082
2008-08-19 15:55Bill HoffmanResolutionopen => fixed

Notes
(0013082)
Bill Hoffman   
2008-08-19 15:55   
cvs commit -m "BUG: fix for 7045, use gcc for .m" cmSystemTools.cxx
Committer: Bill Hoffman <bill.hoffman@kitware.com>
/cvsroot/CMake/CMake/Source/cmSystemTools.cxx,v <-- cmSystemTools.cxx
new revision: 1.384; previous revision: 1.383