clang/gcc: Add build option FREECAD_WARN_ERROR to force to make warnings into errors

This commit is contained in:
wmayer
2024-05-29 13:12:17 +02:00
committed by wwmayer
parent 8ac14f83c6
commit 560cab6f31
52 changed files with 172 additions and 7 deletions

View File

@@ -58,6 +58,8 @@ macro(InitializeFreeCADBuildOptions)
message("Libpack NOT found.\nIf you intend to use a Windows libpack, set the FREECAD_LIBPACK_DIR to the libpack directory.")
message(STATUS "Visit: https://github.com/FreeCAD/FreeCAD-Libpack/releases/ for Windows libpack downloads.")
endif()
elseif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
option(FREECAD_WARN_ERROR "Make all warnings into errors. " OFF)
else(MSVC)
option(FREECAD_LIBPACK_USE "Use the LibPack to Build FreeCAD (only Win32 so far)." OFF)
set(FREECAD_LIBPACK_DIR "" CACHE PATH "Directory of the FreeCAD LibPack")

View File

@@ -268,3 +268,9 @@ MACRO(SET_PYTHON_PREFIX_SUFFIX ProjectName)
set_target_properties(${ProjectName} PROPERTIES SUFFIX ".so")
endif(WIN32)
ENDMACRO(SET_PYTHON_PREFIX_SUFFIX)
function(target_compile_warn_error ProjectName)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
target_compile_options(${ProjectName} PRIVATE -Werror)
endif()
endfunction()