[CMake] Problem with CMAKE and m file for Objective-c

reyman reyman64 at gmail.com
Fri Jul 31 08:15:56 EDT 2009


On Thu, Jul 30, 2009 at 5:36 PM, Tyler Roscoe <tyler at cryptio.net> wrote:

> On Thu, Jul 30, 2009 at 01:21:45AM +0200, reyman wrote:
> > I have file extension .m and .h in my src folder, my compiler is GCC.
> > When i want to compile, this is /usr/bin/c++ who launch and compile ... i
> > don't understand why CMake doesn't recognize the .m file and use the C
> > compilator gcc.
>

Finaly i have find a solution with this code src :

file(
    GLOB_RECURSE
    source_files
    src/*.h
    src/*.m
    src/*.c
)

SET_SOURCE_FILES_PROPERTIES(
    ${source_files}
    PROPERTIES LANGUAGE C
)

gcc -x objective-c produce stray error with LD linking, but gcc without this
option running without LD error.
Objective-c compiler (gcc) is ok with this.


> Have you tried playing with enable_language()? I'm guessing CMake
> doesn't know that it should use gcc with .m files and is defaulting to
> C++ mode.
>
> > If a try to modify CXX Compiler for gcc, i have "stray error" in all my
> > source file when LD link the .o ... So, a very bad solution ...
>
> How did you modify the compiler?
>
> tyler
>

Thanks lot for your response tyler :]
Seb.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090731/9d5bc7ef/attachment.htm>


More information about the CMake mailing list