mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
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.
This commit is contained in:
6
Buildscr
6
Buildscr
@ -26,7 +26,11 @@ in puzzles do perl -i -pe 's/Unidentified build/$(Version)/' osx/Info.plist
|
|||||||
|
|
||||||
ifneq "$(NOICONS)" yes then
|
ifneq "$(NOICONS)" yes then
|
||||||
# Run enough of a native Unix build to produce the various icons.
|
# Run enough of a native Unix build to produce the various icons.
|
||||||
in . do cmake -B build-icons puzzles
|
# This also checks that the build completes in 'strict' mode (with
|
||||||
|
# lots of warnings and -Werror), and triggers a build failure if
|
||||||
|
# not.
|
||||||
|
in . do cmake -B build-icons puzzles -DSTRICT=ON
|
||||||
|
in build-icons do make -j$(nproc)
|
||||||
in build-icons do make -j$(nproc) icons VERBOSE=1
|
in build-icons do make -j$(nproc) icons VERBOSE=1
|
||||||
|
|
||||||
# Copy the C icon files into the icons source subdirectory, for the
|
# Copy the C icon files into the icons source subdirectory, for the
|
||||||
|
@ -29,24 +29,9 @@ set(platform_libs -lm)
|
|||||||
|
|
||||||
set(build_icons TRUE)
|
set(build_icons TRUE)
|
||||||
|
|
||||||
function(try_append_cflag flag)
|
if(DEFINED STRICT AND (CMAKE_C_COMPILER_ID MATCHES "GNU" OR
|
||||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wwrite-strings -std=c99 -pedantic -Werror")
|
||||||
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)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
function(get_platform_puzzle_extra_source_files OUTVAR NAME)
|
function(get_platform_puzzle_extra_source_files OUTVAR NAME)
|
||||||
|
Reference in New Issue
Block a user