Skip to content

Commit

Permalink
enable more warnings/make them errors per mapbox/cpp#37
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Oct 16, 2017
1 parent bc9eb9f commit 8d53efe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)

option(BUILD_EXAMPLES "Build examples ON/OFF(default)" OFF)
option(WERROR "Add -Werror flag to build (turns warnings into errors)" ON)

# Enable extra warnings to adhere to https://github.com/mapbox/cpp/issues/37
set(DESIRED_WARNINGS "-Wall -Wextra -Wmost -Wconversion -Wunreachable-code -Wuninitialized -pedantic-errors -Wold-style-cast -Wno-error=unused-variable -Wshadow -Wfloat-equal")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DESIRED_WARNINGS}")

if (WERROR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif()

include(cmake/spatialalgorithms.cmake)
include(cmake/mason.cmake)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ make -j
./test_sa
```

The `-Werror` flag is enabled by default, which turns compiler warnings into errors. You can disable like: `cmake -DWERROR=OFF ..`.

### Example Useage

```c++
Expand Down

0 comments on commit 8d53efe

Please sign in to comment.