mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 19:33:28 +01:00
cmake: fix setting of -Werror
Setting COMPILE_FLAGS (or COMPILE_OPTIONS) property directly does not end up on the command line (even though it should because add_compile_options does just that). Also, set -Werror for tests as well, because no warnings now. Not set for 'external' only because simply moving add_compile_options above add_subdirectory(external) doesn't do it, and moving add_usbdirectory down is too big of a change (it will pick up new flags). -Werror set only for GCC on Linux, since warnings not yet cleared for other compilers/systems.
This commit is contained in:
parent
1f9058187c
commit
0a70ba2c01
@ -699,25 +699,19 @@ if(NOT ZMQ_LIB)
|
|||||||
message(FATAL_ERROR "Could not find require libzmq")
|
message(FATAL_ERROR "Could not find require libzmq")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
function (treat_warnings_as_errors dirs)
|
|
||||||
foreach(dir ${ARGV})
|
|
||||||
set_property(DIRECTORY ${dir}
|
|
||||||
APPEND PROPERTY COMPILE_FLAGS "-Werror")
|
|
||||||
endforeach()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
add_subdirectory(contrib)
|
|
||||||
add_subdirectory(src)
|
|
||||||
|
|
||||||
treat_warnings_as_errors(contrib src)
|
|
||||||
|
|
||||||
option(BUILD_TESTS "Build tests." OFF)
|
option(BUILD_TESTS "Build tests." OFF)
|
||||||
|
|
||||||
if(BUILD_TESTS)
|
if(BUILD_TESTS)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# warnings are cleared only for GCC on Linux
|
||||||
|
if (NOT (MINGW OR APPLE OR FREEBSD OR OPENBSD OR DRAGONFLY))
|
||||||
|
add_compile_options("${WARNINGS_AS_ERRORS_FLAG}") # applies only to targets that follow
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(contrib)
|
||||||
|
add_subdirectory(src)
|
||||||
|
|
||||||
if(BUILD_DOCUMENTATION)
|
if(BUILD_DOCUMENTATION)
|
||||||
set(DOC_GRAPHS "YES" CACHE STRING "Create dependency graphs (needs graphviz)")
|
set(DOC_GRAPHS "YES" CACHE STRING "Create dependency graphs (needs graphviz)")
|
||||||
|
Loading…
Reference in New Issue
Block a user