MantisBT - CMake
View Issue Details
0011898CMakeCMakepublic2011-02-25 15:452016-06-10 14:31
tim blechmann 
Kitware Robot 
normalmajorhave not tried
closedmoved 
CMake 2.8.4 
 
0011898: xcode projects compile objective-c++ files as objective-c
in my cmake build system, there are some objective-c++ files with the extension .M.

the cmake generated makefiles compile the source correctly, the xcode project doesn't compile it as objective-c++, but as objective-c.
CompileC buildxcode/lang/SuperCollider.build/libsclang.build/Objects-normal/x86_64/SC_Speech.o lang/LangPrimSource/SC_Speech.M normal x86_64 objective-c com.apple.compilers.gcc.4_2
cd /Users/joshp/src/supercollider
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x objective-c -arch x86_64 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O3 -DCMAKE_INTDIR="Release" -Dlibsclang_EXPORTS -D_REENTRANT -DSC_DARWIN -DHAVE_LIBCURL -DLIBSNDFILE_1018 -DYYSTACK_USE_ALLOCA -DHAVE_SPEECH -DHAVE_WII -DBUILDING_SUPERCOLLIDER -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/joshp/src/supercollider/buildxcode/lang/Release -I/Users/joshp/src/supercollider/buildxcode/lang/Release/include -I/Users/joshp/src/supercollider/include/common -I/Users/joshp/src/supercollider/include/lang -I/Users/joshp/src/supercollider/include/plugin_interface -I/Users/joshp/src/supercollider/lang/LangSource/Bison -I/Users/joshp/src/supercollider/external_libraries/icu -I/Users/joshp/src/supercollider/lang/LangPrimSource/HID_Utilities -I/Users/joshp/src/supercollider/lang/LangPrimSource/WiiMote_OSX -I/Users/joshp/src/supercollider/external_libraries/libsndfile -I/Users/joshp/src/supercollider/buildxcode/lang/SuperCollider.build/libsclang.build/DerivedSources/x86_64 -I/Users/joshp/src/supercollider/buildxcode/lang/SuperCollider.build/libsclang.build/DerivedSources -DNDEBUG -fPIC -fschedule-insns2 -fomit-frame-pointer -ffast-math -fpascal-strings -isystem /Users/joshp/src/supercollider/external_libraries/libsndfile -c /Users/joshp/src/supercollider/lang/LangPrimSource/SC_Speech.M -o /Users/joshp/src/supercollider/buildxcode/lang/SuperCollider.build/libsclang.build/Objects-normal/x86_64/SC_Speech.o
No tags attached.
Issue History
2011-02-25 15:45tim blechmannNew Issue
2011-02-25 17:07David ColeNote Added: 0025581
2011-02-25 17:09David ColeNote Added: 0025582
2011-02-25 17:34tim blechmannNote Added: 0025584
2011-02-25 17:41David ColeNote Added: 0025585
2011-02-25 17:43David ColeAssigned To => David Cole
2011-02-25 17:43David ColeStatusnew => assigned
2011-02-26 04:51tim blechmannNote Added: 0025587
2011-03-18 14:13Sean McBrideNote Added: 0025821
2012-08-13 15:36David ColeStatusassigned => backlog
2012-08-13 15:36David ColeNote Added: 0030618
2012-08-13 15:36David ColeAssigned ToDavid Cole =>
2016-06-10 14:28Kitware RobotNote Added: 0041807
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0025581)
David Cole   
2011-02-25 17:07   
Isn't ".mm" the commonly accepted file extension for objective-c++? What happens if you use a *.mm file instead of *.M?
(0025582)
David Cole   
2011-02-25 17:09   
Is *.M also commonly expected to compile as objective-c++, and be equivalent to *.mm?
(0025584)
tim blechmann   
2011-02-25 17:34   
according to the gcc man page:

For any given input file, the file name suffix determines what kind of compilation is done:

[snip]

       file.mm
       file.M
           Objective-C++ source code which must be preprocessed.
(0025585)
David Cole   
2011-02-25 17:41   
I would think, however, that on a typical Mac, which is "case insensitive" for file name comparison purposes, using *.M to distinguish from *.m is not that great of a convention... Personally, I would not rely on it when there's an alternative that avoids the issue.

However... since it works with Makefiles, it should probably work with Xcode too. Valid bug. Thanks for the report.
(0025587)
tim blechmann   
2011-02-26 04:51   
actually, native xcode projects seem to detect the language correctly as well.
(at least that was reported, cannot test myself as i am not on osx)
(0025821)
Sean McBride   
2011-03-18 14:13   
I've never seen nor heard of .M being used for Obj-C++...
(0030618)
David Cole   
2012-08-13 15:36   
Sending old, not-recently-updated issues to the backlog.

(The age of the bug alone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0041807)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.