cmake: allow to easily set global compilation flags

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4948 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2011-10-29 11:39:06 +00:00
parent 251382aefe
commit 93fe62f77e
1 changed files with 7 additions and 2 deletions

View File

@ -103,6 +103,11 @@ set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
set(CMAKE_SHARED_LIBRARY_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
#-------------------------------------------------------------------------------
# Set some default compiler flag
#-------------------------------------------------------------------------------
set(DEFAULT_GCC_FLAG "-m32 -msse -msse2 -march=i686 -pthread -Wno-write-strings -Wno-invalid-offsetof")
#-------------------------------------------------------------------------------
# Allow user to set some default flags
# Note: string STRIP must be used to remove trailing and leading spaces.
@ -130,7 +135,7 @@ if(DEFINED USER_CMAKE_C_FLAGS)
string(STRIP "${USER_CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
endif(DEFINED USER_CMAKE_C_FLAGS)
# Use some default machine flags
string(STRIP "${CMAKE_C_FLAGS} -m32 -msse -msse2 -march=i686 -pthread" CMAKE_C_FLAGS)
string(STRIP "${CMAKE_C_FLAGS} ${DEFAULT_GCC_FLAG}" CMAKE_C_FLAGS)
### C++ flags
@ -141,7 +146,7 @@ if(DEFINED USER_CMAKE_CXX_FLAGS)
string(STRIP "${USER_CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
endif(DEFINED USER_CMAKE_CXX_FLAGS)
# Use some default machine flags
string(STRIP "${CMAKE_CXX_FLAGS} -m32 -msse -msse2 -march=i686 -pthread" CMAKE_CXX_FLAGS)
string(STRIP "${CMAKE_CXX_FLAGS} ${DEFAULT_GCC_FLAG}" CMAKE_CXX_FLAGS)
#-------------------------------------------------------------------------------
# Default package option