Skip to content

Commit 6b536a2

Browse files
committed
[#168] Enable -Werror for Clang builds
This was lifted directly from the irods/irods CMakeLists.txt file.
1 parent 9755f7a commit 6b536a2

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
2929
include(GNUInstallDirs)
3030
include(UseLibCXX)
3131

32+
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
33+
set(IRODS_BUILD_WITH_WERROR_DEFAULT ON)
34+
else()
35+
set(IRODS_BUILD_WITH_WERROR_DEFAULT OFF)
36+
endif()
37+
38+
set(IRODS_BUILD_WITH_WERROR ${IRODS_BUILD_WITH_WERROR_DEFAULT} CACHE BOOL "Choose whether to compile with -Werror.")
39+
40+
if (IRODS_BUILD_WITH_WERROR)
41+
add_compile_options(-Werror)
42+
endif()
43+
3244
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
3345
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build {Debug, Release}." FORCE)
3446
message(STATUS "Setting unspecified CMAKE_BUILD_TYPE to '${CMAKE_BUILD_TYPE}'")

0 commit comments

Comments
 (0)