|
From: Yoda-JM <yo...@us...> - 2011-02-24 10:33:35
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Feb 6 16:17:12 2011 +0100
Build fix to allow proper linkage of pthreads
---
game/CMakeLists.txt | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index ccf5faf..3a34f6b 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -117,18 +117,15 @@ else()
endif()
-# Set default compile flags for GCC
-if(CMAKE_COMPILER_IS_GNUCXX)
- message(STATUS "GCC detected, adding compile flags")
- # -pedantic cannot be used because ffmpeg headers are b0rked
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-missing-field-initializers")
- # -pthread is unrecognized on Windows and ansi standard causes errors
- if(NOT WIN32)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -pthread")
- endif(NOT WIN32)
+if(APPLE)
# Needed for ffmpeg.cc to compile cleanly on OSX (it's a (unsigned long) long story)
add_definitions("-D__STDC_CONSTANT_MACROS")
-endif(CMAKE_COMPILER_IS_GNUCXX)
+endif(APPLE)
+
+if(UNIX)
+ list(APPEND CMAKE_CXX_FLAGS -pthread)
+ list(APPEND CMAKE_EXE_LINKER_FLAGS -pthread)
+endif(UNIX)
if(MSVC)
set(SUBSYSTEM_WIN32 WIN32)
|