diff options
author | Tim Blechmann <tim@klingt.org> | 2014-03-19 16:31:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-20 13:40:41 (GMT) |
commit | 95cdf132489c79e88a10fdf7a7566fa002c7680b (patch) | |
tree | 2f8dac8cdc0061edd55fb0135ba5e26872d6a5d8 | |
parent | 0f79dab48bf17e867fe19a7b7140fa7513f4b72d (diff) | |
download | CMake-95cdf132489c79e88a10fdf7a7566fa002c7680b.zip CMake-95cdf132489c79e88a10fdf7a7566fa002c7680b.tar.gz CMake-95cdf132489c79e88a10fdf7a7566fa002c7680b.tar.bz2 |
Treat .m files consistently as C across all generators
Objective C sources should be compiled with the C compiler, not C++.
The Xcode generator correctly classifies ".m" sources already. The
cmSystemTools::GetFileFormat method was fixed by commit v2.8.0~1782 (fix
for 7045, use gcc for .m, 2008-08-19) but it is not used by any of the
generator since commit v2.4.0~2819 (major changes to support addition of
languages, 2004-09-22).
Fix the CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS table entries so that
cmGlobalGenerator::GetLanguageFromExtension tells the Makefile, Ninja,
and VS IDE generators to compile ".m" sources as C. This makes behavior
consistent on all generators.
Signed-off-by: Tim Blechmann <tim@klingt.org>
-rw-r--r-- | Modules/CMakeCCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/CMakeCXXCompiler.cmake.in | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 804cce2..694f8b8 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -26,7 +26,7 @@ if(CMAKE_COMPILER_IS_MINGW) set(MINGW 1) endif() set(CMAKE_C_COMPILER_ID_RUN 1) -set(CMAKE_C_SOURCE_FILE_EXTENSIONS c) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_C_LINKER_PREFERENCE 10) diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 35aa6c4..c75611a 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -27,7 +27,7 @@ if(CMAKE_COMPILER_IS_MINGW) endif() set(CMAKE_CXX_COMPILER_ID_RUN 1) set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) -set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP) set(CMAKE_CXX_LINKER_PREFERENCE 30) set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) |