From: José Fonseca Date: Wed, 24 Oct 2012 12:43:06 +0000 (+0100) Subject: Prefer clang on MacOSX. X-Git-Url: https://git.cworth.org/git?p=apitrace;a=commitdiff_plain;h=76efdcb9194d78a63307122570f9fa9c8ab62557 Prefer clang on MacOSX. For __thread support. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6329689..09633c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,14 @@ cmake_minimum_required (VERSION 2.8) + +# Use clang on MacOSX. gcc doesn't support __thread key, and Apple has +# abandoned it for clang. This must be done before the project is defined. +if (APPLE) + set (CMAKE_C_COMPILER "clang") + set (CMAKE_CXX_COMPILER "clang++") +endif () + + project (apitrace) @@ -25,6 +34,15 @@ set (ENABLE_EGL true CACHE BOOL "Enable EGL support.") ############################################################################## # Find dependencies +# Ensure __thread is support +if (APPLE) + include (CheckCXXSourceCompiles) + check_cxx_source_compiles("__thread int i; int main() { return 0; }" HAVE_COMPILER_TLS) + if (NOT HAVE_COMPILER_TLS) + message (FATAL_ERROR "C++ compiler does not support __thread keyword. Please install XCode 4.5 or higher.") + endif () +endif () + set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) set (CMAKE_USE_PYTHON_VERSION 2.7 2.6)