Support for CLANG compiler in CMakeLists.txt

This commit is contained in:
Paul Bakker 2013-12-30 17:56:23 +01:00
parent f0fc2a27b0
commit 92bc875e0a

View File

@ -3,6 +3,8 @@ project(POLARSSL C)
enable_testing()
string(REGEX MATCH "clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER}")
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wall -Wextra -W -Wdeclaration-after-statement")
set(CMAKE_C_FLAGS_DEBUG "-g3 -O0")
@ -11,6 +13,12 @@ if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS_CHECKFULL "${CMAKE_C_FLAGS_CHECK} -Wcast-qual")
endif(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_COMPILER_IS_CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wall -Wextra -W -Wdeclaration-after-statement")
set(CMAKE_C_FLAGS_DEBUG "-g3 -O0")
set(CMAKE_C_FLAGS_CHECK "${CMAKE_C_FLAGS} -Wpointer-arith -Wwrite-strings -Wdocumentation -Werror")
endif(CMAKE_COMPILER_IS_CLANG)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}
CACHE STRING "Choose the type of build: None Debug Release Coverage Check CheckFull"
FORCE)