[asterisk-scf-commits] asterisk-scf/release/cmake.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue Apr 10 11:13:17 CDT 2012
branch "master" has been updated
via 226b350be1793954e70094b14a12b8b21a59b17f (commit)
from 346da67a06b49d990804162dce91de2144d96e8b (commit)
Summary of changes:
AsteriskSCF.cmake | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
- Log -----------------------------------------------------------------
commit 226b350be1793954e70094b14a12b8b21a59b17f
Author: David M. Lee <dlee at digium.com>
Date: Fri Apr 6 13:13:26 2012 -0500
Enable compile flags for Clang
diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index ea4fe3a..b4df864 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -1,7 +1,7 @@
#
# Asterisk SCF -- An open-source communications framework.
#
-# Copyright (C) 2010-2011, Digium, Inc.
+# Copyright (C) 2010-2012, Digium, Inc.
#
# See http://www.asterisk.org for more information about
# the Asterisk SCF project. Please do not directly contact
@@ -63,6 +63,16 @@ if(APPLE)
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
endif()
+# Set flags for detecting the Clang compiler
+if("${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}" MATCHES ".*clang")
+ set(CMAKE_COMPILER_IS_CLANGCXX 1)
+endif()
+
+if("${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}" MATCHES ".*clang")
+ set(CMAKE_COMPILER_IS_CLANGCC 1)
+endif()
+
+
if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "This project must not be built in the source directory")
endif()
@@ -286,7 +296,7 @@ macro(__astscf_compute_test_paths)
endmacro()
function(astscf_allowwarnings)
- if(CMAKE_COMPILER_IS_GNUCXX)
+ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
unset(_lv)
string(REPLACE "-Werror" "" _lv "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_DEBUG "${_lv}" PARENT_SCOPE)
@@ -368,7 +378,7 @@ function(astscf_project NAME ICE_VERSION)
# Ubuntu 11.04.
# See http://bugs.launchpad.net/ubuntu/+source/boost1.42/+bug/776860
if(ENABLE_CPP0X)
- if(CMAKE_COMPILER_IS_GNUCXX)
+ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-std=c++0x HAVE_STD_CPP0X)
if(HAVE_STD_CPP0X)
@@ -390,15 +400,22 @@ function(astscf_project NAME ICE_VERSION)
list(APPEND cxx_flags -flat_namespace)
endif()
- if(CMAKE_COMPILER_IS_GNUCC)
+ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANGCC)
list(APPEND c_flags_debug "-Wall" "-g3")
list(APPEND c_flags_profile "-ftest-coverage" "-fprofile-arcs")
endif()
- if(CMAKE_COMPILER_IS_GNUCXX)
+ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
list(APPEND cxx_flags ${ICE_CXX_FLAGS})
list(APPEND cxx_flags_debug "-Wall" "-Wextra" "-g3")
list(APPEND cxx_flags_debug "-Wshadow" "-Wmissing-format-attribute" "-Wformat=2" "-Wpointer-arith" "-Wconversion")
+ include(CheckCXXCompilerFlag)
+ # GCC disables the sign conversion check by default for C++; Clang, not so much
+ # Be explicit so we're consistent, but the flag isn't supported on older GCC
+ CHECK_CXX_COMPILER_FLAG(-Wno-sign-conversion HAVE_W_NO_SIGN_CONVERSION)
+ if(HAVE_W_NO_SIGN_CONVERSION)
+ list(APPEND cxx_flags_debug "-Wno-sign-conversion")
+ endif()
# When building shared objects (libraries or modules), the linker normally
# doesn't try to ensure that all symbols referenced by the code linked
# into the object have been satisfied... which means that unresolved
@@ -408,7 +425,6 @@ function(astscf_project NAME ICE_VERSION)
if(NOT APPLE)
list(APPEND cxx_flags_debug "-Wl,--no-undefined")
endif()
- include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-Wlogical-op HAVE_W_LOGICAL_OP)
if(HAVE_W_LOGICAL_OP)
list(APPEND cxx_flags_debug "-Wlogical-op")
-----------------------------------------------------------------------
--
asterisk-scf/release/cmake.git
More information about the asterisk-scf-commits
mailing list