Skip to content

Commit

Permalink
[irods#168] Enable -Werror for Clang builds
Browse files Browse the repository at this point in the history
This was lifted directly from the irods/irods CMakeLists.txt file.
  • Loading branch information
alanking committed Oct 13, 2023
1 parent 9755f7a commit 8288bd2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
include(GNUInstallDirs)
include(UseLibCXX)

if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
set(IRODS_BUILD_WITH_WERROR_DEFAULT ON)
else()
set(IRODS_BUILD_WITH_WERROR_DEFAULT OFF)
endif()

set(IRODS_BUILD_WITH_WERROR ${IRODS_BUILD_WITH_WERROR_DEFAULT} CACHE BOOL "Choose whether to compile with -Werror.")

if (IRODS_BUILD_WITH_WERROR)
add_compile_options(-Werror)
endif()

if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build {Debug, Release}." FORCE)
message(STATUS "Setting unspecified CMAKE_BUILD_TYPE to '${CMAKE_BUILD_TYPE}'")
Expand Down

0 comments on commit 8288bd2

Please sign in to comment.