From 444da3574d327a7b81024d9b6a0cae5cba13947b Mon Sep 17 00:00:00 2001 From: dhewg Date: Thu, 22 Dec 2011 11:53:33 +0100 Subject: [PATCH] Fix compiler checks for newer gcc versions Use CXX instead of C checks - newer gcc versions refuse some C++ flags when compiling C. --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 694bc2c..d77a0cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.6) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sys/cmake") set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE) -include(CheckCCompilerFlag) +include(CheckCXXCompilerFlag) option(CORE "Build the core" ON) option(GAME "Build the base game code" ON) @@ -129,8 +129,8 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") add_definitions(-fno-strict-aliasing) - CHECK_C_COMPILER_FLAG("-fvisibility=hidden" cc_has_fvisibility) - if (cc_has_fvisibility) + CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" cxx_has_fvisibility) + if (cxx_has_fvisibility) add_definitions(-fvisibility=hidden) endif() @@ -139,8 +139,8 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") add_definitions(-Wno-switch) add_definitions(-Wno-format-security) - CHECK_C_COMPILER_FLAG("-Woverloaded-virtual" cc_has_Woverload_virtual) - if (cc_has_Woverload_virtual) + CHECK_CXX_COMPILER_FLAG("-Woverloaded-virtual" cxx_has_Woverload_virtual) + if (cxx_has_Woverload_virtual) add_definitions(-Woverloaded-virtual) endif() @@ -151,8 +151,8 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") add_definitions(-arch x86_64 -mmacosx-version-min=10.6) set(ldflags ${ldflags} "-arch x86_64 -mmacosx-version-min=10.6") elseif (cpu STREQUAL "x86") - CHECK_C_COMPILER_FLAG("-arch i386" cc_has_arch_i386) - if (cc_has_arch_i386) + CHECK_CXX_COMPILER_FLAG("-arch i386" cxx_has_arch_i386) + if (cxx_has_arch_i386) add_definitions(-arch i386) set(ldflags ${ldflags} "-arch i386") endif() @@ -160,8 +160,8 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") add_definitions(-mmacosx-version-min=10.4) set(ldflags ${ldflags} "-mmacosx-version-min=10.4") elseif (cpu STREQUAL "ppc") - CHECK_C_COMPILER_FLAG("-arch ppc" cc_has_arch_ppc) - if (cc_has_arch_ppc) + CHECK_CXX_COMPILER_FLAG("-arch ppc" cxx_has_arch_ppc) + if (cxx_has_arch_ppc) add_definitions(-arch ppc) set(ldflags ${ldflags} "-arch ppc") endif()