diff options
| author | Simon Tatham <anakin@pobox.com> | 2021-03-31 18:44:44 +0100 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2021-03-31 18:44:44 +0100 |
| commit | 306fab356e357ef13578667b476abce706a55203 (patch) | |
| tree | ef4707e95236af0ad2e2d32280fd99d24f9fd1a6 /cmake | |
| parent | 76aa9619c07bc1a62fafa99e14dbd187ea9aa565 (diff) | |
| download | puzzles-306fab356e357ef13578667b476abce706a55203.zip puzzles-306fab356e357ef13578667b476abce706a55203.tar.gz puzzles-306fab356e357ef13578667b476abce706a55203.tar.bz2 puzzles-306fab356e357ef13578667b476abce706a55203.tar.xz | |
Stop automatically adding warning flags and -Werror.
It's better to be lax for normal users trying to build the puzzles
from source to actually run them. That way, warning changes in some
particular compiler I haven't seen yet won't break the build.
Instead, I've invented a cmake setting -DSTRICT=ON which turns on all
those flags. So I can build with them myself, to ensure the code is as
portable as possible. And that flag is set in Buildscr, so that my
official builds won't complete until that warning mode is satisfied.
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/platforms/unix.cmake | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/cmake/platforms/unix.cmake b/cmake/platforms/unix.cmake index b858be8..df95144 100644 --- a/cmake/platforms/unix.cmake +++ b/cmake/platforms/unix.cmake @@ -29,24 +29,9 @@ set(platform_libs -lm) set(build_icons TRUE) -function(try_append_cflag flag) - set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}") - try_compile(compile_passed ${CMAKE_BINARY_DIR} - SOURCES ${CMAKE_SOURCE_DIR}/cmake/testbuild.c - OUTPUT_VARIABLE test_compile_output - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${GTK_INCLUDE_DIRS}") - if(compile_passed) - set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} PARENT_SCOPE) - endif() -endfunction() -if (CMAKE_C_COMPILER_ID MATCHES "GNU" OR - CMAKE_C_COMPILER_ID MATCHES "Clang") - try_append_cflag(-Wall) - try_append_cflag(-Werror) - try_append_cflag(-std=c89) - try_append_cflag(-pedantic) - try_append_cflag(-Wwrite-strings) +if(DEFINED STRICT AND (CMAKE_C_COMPILER_ID MATCHES "GNU" OR + CMAKE_C_COMPILER_ID MATCHES "Clang")) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wwrite-strings -std=c99 -pedantic -Werror") endif() function(get_platform_puzzle_extra_source_files OUTVAR NAME) |