Skip to content

Commit 05e616c

Browse files
committed
Improve CMake build for Clang compiler
Add -Wall and -Werror options for Clang compiler. The only reason for the -Werror option is because the build also enables it for other compilers. If it ever becomes an obstacle in future, it will be removed for all compilers. The important option is -Wall to detect code smells.
1 parent 39e3b5e commit 05e616c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
3737
add_compile_options($<$<CONFIG:Debug>:-ggdb>)
3838
add_compile_options($<$<CONFIG:RelWithDebInfo>:-ggdb>)
3939
endif()
40+
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
41+
add_compile_options(-Wall -Werror)
42+
endif()
4043
if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
4144
add_compile_options(-Wall -Werror)
4245
endif()

0 commit comments

Comments
 (0)