1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

cmake: add CURL_WERROR for enabling "warning as errors"

This commit is contained in:
Daniel Stenberg 2017-07-06 12:12:31 +02:00
parent 75c3596f75
commit ce81aeb877

View File

@ -72,6 +72,7 @@ set(OS "\"${CMAKE_SYSTEM_NAME}\"")
include_directories(${PROJECT_BINARY_DIR}/include/curl) include_directories(${PROJECT_BINARY_DIR}/include/curl)
include_directories( ${CURL_SOURCE_DIR}/include ) include_directories( ${CURL_SOURCE_DIR}/include )
option(CURL_WERROR "Turn compiler warnings into errors" OFF)
option(BUILD_CURL_EXE "Set to ON to build curl executable." ON) option(BUILD_CURL_EXE "Set to ON to build curl executable." ON)
option(CURL_STATICLIB "Set to ON to build libcurl with static linking." OFF) option(CURL_STATICLIB "Set to ON to build libcurl with static linking." OFF)
option(ENABLE_ARES "Set to ON to enable c-ares support" OFF) option(ENABLE_ARES "Set to ON to enable c-ares support" OFF)
@ -244,6 +245,16 @@ if(BORLAND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
endif(BORLAND) endif(BORLAND)
if(CURL_WERROR)
if(MSVC_VERSION)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /WX")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_RELEASE} /WX")
else()
# this assumes clang or gcc style options
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif()
endif(CURL_WERROR)
# If we are on AIX, do the _ALL_SOURCE magic # If we are on AIX, do the _ALL_SOURCE magic
if(${CMAKE_SYSTEM_NAME} MATCHES AIX) if(${CMAKE_SYSTEM_NAME} MATCHES AIX)
set(_ALL_SOURCE 1) set(_ALL_SOURCE 1)