CMake: check CMAKE_C_COMPILER_ID instead of CMAKE_CXX_COMPILER_ID
authorCampbell Barton <ideasman42@gmail.com>
Mon, 2 Dec 2013 00:36:33 +0000 (11:36 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 2 Dec 2013 00:36:33 +0000 (11:36 +1100)
While its possible to have different C/C++ compilers, we dont support
this at the moment, so just check C compiler ID for now.

CMakeLists.txt
build_files/cmake/macros.cmake

index 6767fb9227706d35eadb60082cd3cffbe6adf2c2..1ff10d9377b38098d00b931fdcd152d07e011705 100644 (file)
@@ -922,10 +922,10 @@ if(UNIX AND NOT APPLE)
        if(CMAKE_COMPILER_IS_GNUCC)
                set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
        # CLang is the same as GCC for now.
-       elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+       elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
                set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
        # Solaris CC
-       elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
+       elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro")
                set(PLATFORM_CFLAGS "-pipe -features=extensions -fPIC -D__FUNCTION__=__func__")
                
        # Intel C++ Compiler
@@ -1781,7 +1781,7 @@ elseif(APPLE)
        if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
                set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
                set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic  -msse -msse2 -msse3 -mssse3")
-               if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+               if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
                        set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize  -fvariable-expansion-in-unroller")
                        set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize  -fvariable-expansion-in-unroller")
                endif()
@@ -2028,7 +2028,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
                ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
        endif()
 
-elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
 
        # strange, clang complains these are not supported, but then yses them.
        ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
@@ -2241,6 +2241,9 @@ if(FIRST_RUN)
 
        endmacro()
 
+       message(STATUS "C Compiler:   \"${CMAKE_C_COMPILER_ID}\"")
+       message(STATUS "C++ Compiler: \"${CMAKE_CXX_COMPILER_ID}\"")
+
        info_cfg_text("Build Options:")
        info_cfg_option(WITH_GAMEENGINE)
        info_cfg_option(WITH_PLAYER)
index e7e88ad5703c89b284fe2e03a3e5039b20179358..0bf31f7e67873fcbf22c7cdeb23fb842f09872ed 100644 (file)
@@ -530,7 +530,7 @@ macro(remove_strict_flags)
                add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
        endif()
 
-       if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+       if(CMAKE_C_COMPILER_ID MATCHES "Clang")
                remove_cc_flag("-Wunused-parameter")
                remove_cc_flag("-Wunused-variable")
                remove_cc_flag("-Werror=[^ ]+")
@@ -555,7 +555,7 @@ macro(remove_strict_flags_file
        foreach(_SOURCE ${ARGV})
 
                if(CMAKE_COMPILER_IS_GNUCC OR
-                 (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
+                 (CMAKE_C_COMPILER_ID MATCHES "Clang"))
 
                        set_source_files_properties(${_SOURCE}
                                PROPERTIES