From 4185605d5edc0beebe39f2a2472e5c5d11f7a6af Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 29 May 2024 13:12:17 +0200 Subject: [PATCH] clang/gcc: Add build option FREECAD_WARN_ERROR to force to make warnings into errors --- .../InitializeFreeCADBuildOptions.cmake | 2 ++ cMake/FreeCadMacros.cmake | 6 ++++++ src/App/CMakeLists.txt | 3 +++ src/Base/CMakeLists.txt | 3 +++ src/Gui/CMakeLists.txt | 13 ++++++++----- src/Main/CMakeLists.txt | 12 ++++++++++++ src/Mod/Assembly/App/CMakeLists.txt | 3 +++ src/Mod/Assembly/Gui/CMakeLists.txt | 3 +++ src/Mod/CAM/App/CMakeLists.txt | 4 +++- src/Mod/CAM/Gui/CMakeLists.txt | 3 +++ src/Mod/CAM/PathSimulator/App/CMakeLists.txt | 3 +++ src/Mod/CAM/PathSimulator/AppGL/CMakeLists.txt | 3 +++ src/Mod/Draft/App/CMakeLists.txt | 3 +++ src/Mod/Drawing/App/CMakeLists.txt | 3 +++ src/Mod/Drawing/Gui/CMakeLists.txt | 3 +++ src/Mod/Fem/App/CMakeLists.txt | 3 +++ src/Mod/Fem/Gui/CMakeLists.txt | 3 +++ src/Mod/Import/App/CMakeLists.txt | 3 +++ src/Mod/Import/Gui/CMakeLists.txt | 3 +++ src/Mod/Inspection/App/CMakeLists.txt | 3 +++ src/Mod/Inspection/Gui/CMakeLists.txt | 3 +++ src/Mod/JtReader/App/CMakeLists.txt | 3 +++ src/Mod/Material/App/CMakeLists.txt | 3 +++ src/Mod/Material/Gui/CMakeLists.txt | 3 +++ src/Mod/Measure/App/CMakeLists.txt | 3 +++ src/Mod/Measure/Gui/CMakeLists.txt | 3 +++ src/Mod/Mesh/App/CMakeLists.txt | 3 +++ src/Mod/Mesh/Gui/CMakeLists.txt | 3 +++ src/Mod/MeshPart/App/CMakeLists.txt | 3 +++ src/Mod/MeshPart/Gui/CMakeLists.txt | 3 +++ src/Mod/Part/App/CMakeLists.txt | 3 +++ src/Mod/Part/Gui/CMakeLists.txt | 3 +++ src/Mod/PartDesign/App/CMakeLists.txt | 3 +++ src/Mod/PartDesign/Gui/CMakeLists.txt | 3 +++ src/Mod/Points/App/CMakeLists.txt | 3 +++ src/Mod/Points/Gui/CMakeLists.txt | 3 +++ src/Mod/ReverseEngineering/App/CMakeLists.txt | 3 +++ src/Mod/ReverseEngineering/Gui/CMakeLists.txt | 3 +++ src/Mod/Robot/App/CMakeLists.txt | 3 +++ src/Mod/Robot/Gui/CMakeLists.txt | 3 +++ src/Mod/Sketcher/App/CMakeLists.txt | 3 +++ src/Mod/Sketcher/Gui/CMakeLists.txt | 4 +++- src/Mod/Spreadsheet/App/CMakeLists.txt | 3 +++ src/Mod/Spreadsheet/Gui/CMakeLists.txt | 3 +++ src/Mod/Start/App/CMakeLists.txt | 3 +++ src/Mod/Start/Gui/CMakeLists.txt | 3 +++ src/Mod/Surface/App/CMakeLists.txt | 3 +++ src/Mod/Surface/Gui/CMakeLists.txt | 3 +++ src/Mod/TechDraw/App/CMakeLists.txt | 3 +++ src/Mod/TechDraw/Gui/CMakeLists.txt | 3 +++ src/Mod/Test/Gui/CMakeLists.txt | 3 +++ src/Mod/Web/App/CMakeLists.txt | 3 +++ 52 files changed, 172 insertions(+), 7 deletions(-) diff --git a/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake b/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake index 09a13e943c..3d8d366d2d 100644 --- a/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake +++ b/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake @@ -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") diff --git a/cMake/FreeCadMacros.cmake b/cMake/FreeCadMacros.cmake index 6e660c3697..34f5ddfec8 100644 --- a/cMake/FreeCadMacros.cmake +++ b/cMake/FreeCadMacros.cmake @@ -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() diff --git a/src/App/CMakeLists.txt b/src/App/CMakeLists.txt index fd5e798d08..817fc8b635 100644 --- a/src/App/CMakeLists.txt +++ b/src/App/CMakeLists.txt @@ -342,6 +342,9 @@ endif(FREECAD_USE_PCH) add_library(FreeCADApp SHARED ${FreeCADApp_SRCS}) target_link_libraries(FreeCADApp ${FreeCADApp_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(FreeCADApp) +endif() add_dependencies(FreeCADApp fc_version) diff --git a/src/Base/CMakeLists.txt b/src/Base/CMakeLists.txt index 5418696a7d..a38b3ed60c 100644 --- a/src/Base/CMakeLists.txt +++ b/src/Base/CMakeLists.txt @@ -388,6 +388,9 @@ endif(FREECAD_USE_PCH) add_library(FreeCADBase SHARED ${FreeCADBase_SRCS}) target_link_libraries(FreeCADBase ${FreeCADBase_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(FreeCADBase) +endif() SET_BIN_DIR(FreeCADBase FreeCADBase) diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index 57dc5d60d8..3461cfede1 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -21,11 +21,11 @@ if (FREECAD_USE_3DCONNEXION) endif(FREECAD_USE_3DCONNEXION) if(FREECAD_USE_3DCONNEXION_NAVLIB AND (MSVC OR APPLE)) - add_definitions(-DUSE_3DCONNEXION_NAVLIB) - if(APPLE) - add_definitions(-D__APPLE__) - endif(APPLE) - set(3DCONNEXION_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/3Dconnexion/inc) + add_definitions(-DUSE_3DCONNEXION_NAVLIB) + if(APPLE) + add_definitions(-D__APPLE__) + endif(APPLE) + set(3DCONNEXION_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/3Dconnexion/inc) endif(FREECAD_USE_3DCONNEXION_NAVLIB AND (MSVC OR APPLE)) if (BUILD_VR) @@ -1344,6 +1344,9 @@ endif () add_library(FreeCADGui SHARED ${FreeCADGui_SRCS}) target_link_libraries(FreeCADGui ${FreeCADGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(FreeCADGui) +endif() SET_BIN_DIR(FreeCADGui FreeCADGui) diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt index 118825f364..800644392a 100644 --- a/src/Main/CMakeLists.txt +++ b/src/Main/CMakeLists.txt @@ -46,6 +46,9 @@ if(BUILD_GUI) add_executable(FreeCADMain WIN32 ${FreeCAD_SRCS}) target_link_libraries(FreeCADMain ${FreeCAD_LIBS}) + if (FREECAD_WARN_ERROR) + target_compile_warn_error(FreeCADMain) + endif() SET_BIN_DIR(FreeCADMain FreeCAD) @@ -92,6 +95,9 @@ endif(NOT BUILD_DYNAMIC_LINK_PYTHON) target_link_libraries(FreeCADMainCmd ${FreeCADMainCmd_LIBS} ) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(FreeCADMainCmd) +endif() SET_BIN_DIR(FreeCADMainCmd FreeCADCmd) @@ -120,6 +126,9 @@ SET(FreeCADMainPy_SRCS add_library(FreeCADMainPy SHARED ${FreeCADMainPy_SRCS}) target_link_libraries(FreeCADMainPy FreeCADApp) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(FreeCADMainPy) +endif() SET_BIN_DIR(FreeCADMainPy FreeCAD) SET_PYTHON_PREFIX_SUFFIX(FreeCADMainPy) @@ -145,6 +154,9 @@ if(BUILD_GUI) add_library(FreeCADGuiPy SHARED ${FreeCADGuiPy_SRCS}) target_link_libraries(FreeCADGuiPy FreeCADGui) + if (FREECAD_WARN_ERROR) + target_compile_warn_error(FreeCADGuiPy) + endif() SET_BIN_DIR(FreeCADGuiPy FreeCADGui) SET_PYTHON_PREFIX_SUFFIX(FreeCADGuiPy) diff --git a/src/Mod/Assembly/App/CMakeLists.txt b/src/Mod/Assembly/App/CMakeLists.txt index bb7246f438..abab22a43a 100644 --- a/src/Mod/Assembly/App/CMakeLists.txt +++ b/src/Mod/Assembly/App/CMakeLists.txt @@ -52,6 +52,9 @@ SET(Assembly_SRCS add_library(Assembly SHARED ${Assembly_SRCS}) target_link_libraries(Assembly ${Assembly_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Assembly) +endif() if(FREECAD_USE_PCH) add_definitions(-D_PreComp_) diff --git a/src/Mod/Assembly/Gui/CMakeLists.txt b/src/Mod/Assembly/Gui/CMakeLists.txt index 11cb491fbe..3fb8d15623 100644 --- a/src/Mod/Assembly/Gui/CMakeLists.txt +++ b/src/Mod/Assembly/Gui/CMakeLists.txt @@ -67,6 +67,9 @@ SET(AssemblyGuiIcon_SVG add_library(AssemblyGui SHARED ${AssemblyGui_SRCS} ${AssemblyGuiIcon_SVG}) target_link_libraries(AssemblyGui ${AssemblyGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(AssemblyGui) +endif() SET_BIN_DIR(AssemblyGui AssemblyGui /Mod/Assembly) SET_PYTHON_PREFIX_SUFFIX(AssemblyGui) diff --git a/src/Mod/CAM/App/CMakeLists.txt b/src/Mod/CAM/App/CMakeLists.txt index 84c6dcd232..6e27eaac33 100644 --- a/src/Mod/CAM/App/CMakeLists.txt +++ b/src/Mod/CAM/App/CMakeLists.txt @@ -17,7 +17,6 @@ include_directories( link_directories(${OCC_LIBRARY_DIR}) set(Path_LIBS -# Robot Part area-native FreeCADApp @@ -120,6 +119,9 @@ SOURCE_GROUP("Module" FILES ${Mod_SRCS}) add_library(Path SHARED ${Path_SRCS}) target_link_libraries(Path ${Path_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Path) +endif() # Boost >= 1.75.0 if(NOT ${Boost_VERSION} LESS 107500) diff --git a/src/Mod/CAM/Gui/CMakeLists.txt b/src/Mod/CAM/Gui/CMakeLists.txt index bfa71d5079..b70350933f 100644 --- a/src/Mod/CAM/Gui/CMakeLists.txt +++ b/src/Mod/CAM/Gui/CMakeLists.txt @@ -85,6 +85,9 @@ SET(PathGuiIcon_SVG add_library(PathGui SHARED ${PathGui_SRCS} ${PathGuiIcon_SVG}) target_link_libraries(PathGui ${PathGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(PathGui) +endif() SET_BIN_DIR(PathGui PathGui /Mod/CAM) SET_PYTHON_PREFIX_SUFFIX(PathGui) diff --git a/src/Mod/CAM/PathSimulator/App/CMakeLists.txt b/src/Mod/CAM/PathSimulator/App/CMakeLists.txt index 569a2b89bc..6913f92773 100644 --- a/src/Mod/CAM/PathSimulator/App/CMakeLists.txt +++ b/src/Mod/CAM/PathSimulator/App/CMakeLists.txt @@ -43,6 +43,9 @@ SOURCE_GROUP("Python" FILES ${Python_SRCS}) add_library(PathSimulator SHARED ${PathSimulator_SRCS}) target_link_libraries(PathSimulator ${PathSimulator_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(PathSimulator) +endif() SET_BIN_DIR(PathSimulator PathSimulator /Mod/CAM) SET_PYTHON_PREFIX_SUFFIX(PathSimulator) diff --git a/src/Mod/CAM/PathSimulator/AppGL/CMakeLists.txt b/src/Mod/CAM/PathSimulator/AppGL/CMakeLists.txt index 832db7ad15..a397dcd666 100644 --- a/src/Mod/CAM/PathSimulator/AppGL/CMakeLists.txt +++ b/src/Mod/CAM/PathSimulator/AppGL/CMakeLists.txt @@ -96,6 +96,9 @@ endif(FREECAD_USE_PCH) add_library(CAMSimulator SHARED ${CAMSimulator_SRCS}) target_link_libraries(CAMSimulator ${CAMSimulator_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(CAMSimulator) +endif() SET_BIN_DIR(CAMSimulator CAMSimulator /Mod/CAM) SET_PYTHON_PREFIX_SUFFIX(CAMSimulator) diff --git a/src/Mod/Draft/App/CMakeLists.txt b/src/Mod/Draft/App/CMakeLists.txt index b9c902f5ac..f28aafc4f1 100644 --- a/src/Mod/Draft/App/CMakeLists.txt +++ b/src/Mod/Draft/App/CMakeLists.txt @@ -31,6 +31,9 @@ SET(DraftUtils_SRCS add_library(DraftUtils SHARED ${DraftUtils_SRCS}) target_link_libraries(DraftUtils ${DraftUtils_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(DraftUtils) +endif() SET_BIN_DIR(DraftUtils DraftUtils /Mod/Draft) diff --git a/src/Mod/Drawing/App/CMakeLists.txt b/src/Mod/Drawing/App/CMakeLists.txt index 4c5a2aef13..6003719af9 100644 --- a/src/Mod/Drawing/App/CMakeLists.txt +++ b/src/Mod/Drawing/App/CMakeLists.txt @@ -67,6 +67,9 @@ endif(FREECAD_USE_PCH) add_library(Drawing SHARED ${Drawing_SRCS} ${Features_SRCS} ${DrawingAlgos_SRCS}) target_link_libraries(Drawing ${Drawing_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Drawing) +endif() SET_BIN_DIR(Drawing Drawing /Mod/Drawing) SET_PYTHON_PREFIX_SUFFIX(Drawing) diff --git a/src/Mod/Drawing/Gui/CMakeLists.txt b/src/Mod/Drawing/Gui/CMakeLists.txt index edbf3465f5..428212846d 100644 --- a/src/Mod/Drawing/Gui/CMakeLists.txt +++ b/src/Mod/Drawing/Gui/CMakeLists.txt @@ -83,6 +83,9 @@ SET(DrawingGuiIcon_SVG add_library(DrawingGui SHARED ${DrawingGui_SRCS} ${DrawingGuiView_SRCS} ${DrawingGuiViewProvider_SRCS} ${DrawingGuiIcon_SVG}) target_link_libraries(DrawingGui ${DrawingGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(DrawingGui) +endif() SET_BIN_DIR(DrawingGui DrawingGui /Mod/Drawing) diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index 6580f1ae3c..cb9ea647a1 100644 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -197,6 +197,9 @@ endif(FREECAD_USE_PCH) add_library(Fem SHARED ${Fem_SRCS}) target_link_libraries(Fem ${Fem_LIBS} ${VTK_LIBRARIES}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Fem) +endif() find_package(OpenMP 4.0) if(OpenMP_CXX_FOUND) diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt index b86972b82a..0cfad23eb6 100755 --- a/src/Mod/Fem/Gui/CMakeLists.txt +++ b/src/Mod/Fem/Gui/CMakeLists.txt @@ -369,6 +369,9 @@ SET(FemGuiSymbol_IV add_library(FemGui SHARED ${FemGui_SRCS} ${FemGuiIcon_SVG} ${FemGuiSymbol_IV}) target_link_libraries(FemGui ${FemGui_LIBS} ${VTK_LIBRARIES}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(FemGui) +endif() fc_copy_sources(FemGui "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Fem" ${FemGuiIcon_SVG}) fc_copy_sources(FemGui "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Fem" ${FemGuiSymbol_IV}) diff --git a/src/Mod/Import/App/CMakeLists.txt b/src/Mod/Import/App/CMakeLists.txt index fff72a3683..6d9c7d83bf 100644 --- a/src/Mod/Import/App/CMakeLists.txt +++ b/src/Mod/Import/App/CMakeLists.txt @@ -87,6 +87,9 @@ generate_from_xml(StepShapePy) add_library(Import SHARED ${Import_SRCS}) target_link_libraries(Import ${Import_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Import) +endif() ADD_CUSTOM_TARGET(ImportPy ALL SOURCES ${SCL_Resources} diff --git a/src/Mod/Import/Gui/CMakeLists.txt b/src/Mod/Import/Gui/CMakeLists.txt index 4809d9ea0a..408cb0bdf6 100644 --- a/src/Mod/Import/Gui/CMakeLists.txt +++ b/src/Mod/Import/Gui/CMakeLists.txt @@ -39,6 +39,9 @@ SET(ImportGui_SRCS add_library(ImportGui SHARED ${ImportGui_SRCS}) target_link_libraries(ImportGui ${ImportGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(ImportGui) +endif() SET_BIN_DIR(ImportGui ImportGui /Mod/Import) diff --git a/src/Mod/Inspection/App/CMakeLists.txt b/src/Mod/Inspection/App/CMakeLists.txt index 80b4e7ed22..fffd85d376 100644 --- a/src/Mod/Inspection/App/CMakeLists.txt +++ b/src/Mod/Inspection/App/CMakeLists.txt @@ -38,6 +38,9 @@ endif(FREECAD_USE_PCH) add_library(Inspection SHARED ${Inspection_SRCS} ${Inspection_Scripts}) target_link_libraries(Inspection ${Inspection_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Inspection) +endif() fc_target_copy_resource_flat(Inspection ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/src/Mod/Inspection/Gui/CMakeLists.txt b/src/Mod/Inspection/Gui/CMakeLists.txt index b8270eab39..448fa23db3 100644 --- a/src/Mod/Inspection/Gui/CMakeLists.txt +++ b/src/Mod/Inspection/Gui/CMakeLists.txt @@ -57,6 +57,9 @@ SET(InspectionGuiIcon_SVG add_library(InspectionGui SHARED ${InspectionGui_SRCS} ${InspectionGui_Scripts} ${InspectionGuiIcon_SVG}) target_link_libraries(InspectionGui ${InspectionGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(InspectionGui) +endif() fc_target_copy_resource_flat(InspectionGui diff --git a/src/Mod/JtReader/App/CMakeLists.txt b/src/Mod/JtReader/App/CMakeLists.txt index 2425040cfd..62f4896bb2 100644 --- a/src/Mod/JtReader/App/CMakeLists.txt +++ b/src/Mod/JtReader/App/CMakeLists.txt @@ -56,6 +56,9 @@ SOURCE_GROUP("Module" FILES ${JtReader_SRCS}) add_library(JtReader SHARED ${JtReader_SRCS} ${JRJT_SRCS} ${JtReader_Scripts}) target_link_libraries(JtReader ${JtReader_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(JtReader) +endif() fc_target_copy_resource_flat(JtReader ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/src/Mod/Material/App/CMakeLists.txt b/src/Mod/Material/App/CMakeLists.txt index 81f8543f24..98bf98a67a 100644 --- a/src/Mod/Material/App/CMakeLists.txt +++ b/src/Mod/Material/App/CMakeLists.txt @@ -118,6 +118,9 @@ endif(FREECAD_USE_PCH) add_library(Materials SHARED ${Materials_SRCS}) target_link_libraries(Materials ${Materials_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Materials) +endif() SET_BIN_DIR(Materials Materials /Mod/Material) SET_PYTHON_PREFIX_SUFFIX(Materials) diff --git a/src/Mod/Material/Gui/CMakeLists.txt b/src/Mod/Material/Gui/CMakeLists.txt index cbb949b8a9..06761b3143 100644 --- a/src/Mod/Material/Gui/CMakeLists.txt +++ b/src/Mod/Material/Gui/CMakeLists.txt @@ -156,6 +156,9 @@ SET(MatGuiImages add_library(MatGui SHARED ${MatGui_SRCS} ${MatGuiIcon_SVG} ${MatGuiImages}) target_link_libraries(MatGui ${MatGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(MatGui) +endif() SET_BIN_DIR(MatGui MatGui /Mod/Material) SET_PYTHON_PREFIX_SUFFIX(MatGui) diff --git a/src/Mod/Measure/App/CMakeLists.txt b/src/Mod/Measure/App/CMakeLists.txt index 0ccf425de3..d36806f1f6 100644 --- a/src/Mod/Measure/App/CMakeLists.txt +++ b/src/Mod/Measure/App/CMakeLists.txt @@ -71,6 +71,9 @@ endif(FREECAD_USE_PCH) add_library(Measure SHARED ${Measure_SRCS}) target_link_libraries(Measure ${Measure_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Measure) +endif() #if(MSVC) # set_target_properties(Measure PROPERTIES SUFFIX ".pyd") diff --git a/src/Mod/Measure/Gui/CMakeLists.txt b/src/Mod/Measure/Gui/CMakeLists.txt index e6b491ae28..4ea36cdc7c 100644 --- a/src/Mod/Measure/Gui/CMakeLists.txt +++ b/src/Mod/Measure/Gui/CMakeLists.txt @@ -86,6 +86,9 @@ SET(MeasureGuiIcon_SVG add_library(MeasureGui SHARED ${MeasureGui_SRCS} ${MeasureGuiIcon_SVG}) target_link_libraries(MeasureGui ${MeasureGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(MeasureGui) +endif() SET_BIN_DIR(MeasureGui MeasureGui /Mod/Measure) SET_PYTHON_PREFIX_SUFFIX(MeasureGui) diff --git a/src/Mod/Mesh/App/CMakeLists.txt b/src/Mod/Mesh/App/CMakeLists.txt index 25e5627d5c..6a6ea57ae0 100644 --- a/src/Mod/Mesh/App/CMakeLists.txt +++ b/src/Mod/Mesh/App/CMakeLists.txt @@ -412,6 +412,9 @@ add_library(Mesh SHARED ${Core_SRCS} ${WildMagic4_SRCS} ${Mesh_SRCS}) target_link_libraries(Mesh ${Mesh_LIBS}) set_target_properties(Mesh PROPERTIES CXX_STANDARD_REQUIRED ON) set_target_properties(Mesh PROPERTIES CXX_STANDARD 17) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Mesh) +endif() SET_BIN_DIR(Mesh Mesh /Mod/Mesh) diff --git a/src/Mod/Mesh/Gui/CMakeLists.txt b/src/Mod/Mesh/Gui/CMakeLists.txt index e03a5ddcce..036001d52d 100644 --- a/src/Mod/Mesh/Gui/CMakeLists.txt +++ b/src/Mod/Mesh/Gui/CMakeLists.txt @@ -170,6 +170,9 @@ endif () add_library(MeshGui SHARED ${MeshGui_SRCS} ${MeshGuiIcon_SVG}) target_link_libraries(MeshGui ${MeshGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(MeshGui) +endif() SET_BIN_DIR(MeshGui MeshGui /Mod/Mesh) diff --git a/src/Mod/MeshPart/App/CMakeLists.txt b/src/Mod/MeshPart/App/CMakeLists.txt index 6bdaf76213..541c69744b 100644 --- a/src/Mod/MeshPart/App/CMakeLists.txt +++ b/src/Mod/MeshPart/App/CMakeLists.txt @@ -75,6 +75,9 @@ endif() add_library(MeshPart SHARED ${MeshPart_SRCS} ${MeshPart_Scripts}) target_link_libraries(MeshPart ${MeshPart_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(MeshPart) +endif() fc_target_copy_resource_flat(MeshPart diff --git a/src/Mod/MeshPart/Gui/CMakeLists.txt b/src/Mod/MeshPart/Gui/CMakeLists.txt index 5adbc3600c..f1c838362a 100644 --- a/src/Mod/MeshPart/Gui/CMakeLists.txt +++ b/src/Mod/MeshPart/Gui/CMakeLists.txt @@ -81,6 +81,9 @@ endif(FREECAD_USE_PCH) add_library(MeshPartGui SHARED ${MeshPartGui_SRCS} ${MeshPartGui_Scripts} ${FLATMESH_PY_SRCS}) target_link_libraries(MeshPartGui ${MeshPartGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(MeshPartGui) +endif() SET_BIN_DIR(MeshPartGui MeshPartGui /Mod/MeshPart) diff --git a/src/Mod/Part/App/CMakeLists.txt b/src/Mod/Part/App/CMakeLists.txt index 93bf3aa52c..a5532bd617 100644 --- a/src/Mod/Part/App/CMakeLists.txt +++ b/src/Mod/Part/App/CMakeLists.txt @@ -582,6 +582,9 @@ endif() add_library(Part SHARED ${Part_SRCS}) target_link_libraries(Part ${Part_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Part) +endif() SET_BIN_DIR(Part Part /Mod/Part) SET_PYTHON_PREFIX_SUFFIX(Part) diff --git a/src/Mod/Part/Gui/CMakeLists.txt b/src/Mod/Part/Gui/CMakeLists.txt index 9475aa01fd..9b4e372468 100644 --- a/src/Mod/Part/Gui/CMakeLists.txt +++ b/src/Mod/Part/Gui/CMakeLists.txt @@ -259,6 +259,9 @@ SET(PartGuiIcon_SVG add_library(PartGui SHARED ${PartGui_SRCS} ${PartGuiIcon_SVG}) target_link_libraries(PartGui ${PartGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(PartGui) +endif() SET_BIN_DIR(PartGui PartGui /Mod/Part) diff --git a/src/Mod/PartDesign/App/CMakeLists.txt b/src/Mod/PartDesign/App/CMakeLists.txt index 1a9774a3e1..d10d251f51 100644 --- a/src/Mod/PartDesign/App/CMakeLists.txt +++ b/src/Mod/PartDesign/App/CMakeLists.txt @@ -143,6 +143,9 @@ SET(PartDesign_SRCS add_library(PartDesign SHARED ${PartDesign_SRCS}) target_link_libraries(PartDesign ${PartDesign_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(PartDesign) +endif() if(FREECAD_USE_PCH) add_definitions(-D_PreComp_) diff --git a/src/Mod/PartDesign/Gui/CMakeLists.txt b/src/Mod/PartDesign/Gui/CMakeLists.txt index bcad23de7c..bd26aff846 100644 --- a/src/Mod/PartDesign/Gui/CMakeLists.txt +++ b/src/Mod/PartDesign/Gui/CMakeLists.txt @@ -259,6 +259,9 @@ SET(PartDesignGuiIcon_SVG add_library(PartDesignGui SHARED ${PartDesignGui_SRCS} ${PartDesignGuiIcon_SVG}) target_link_libraries(PartDesignGui ${PartDesignGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(PartDesignGui) +endif() SET_BIN_DIR(PartDesignGui PartDesignGui /Mod/PartDesign) SET_PYTHON_PREFIX_SUFFIX(PartDesignGui) diff --git a/src/Mod/Points/App/CMakeLists.txt b/src/Mod/Points/App/CMakeLists.txt index 0cd0601736..a16a258c5a 100644 --- a/src/Mod/Points/App/CMakeLists.txt +++ b/src/Mod/Points/App/CMakeLists.txt @@ -66,6 +66,9 @@ add_library(Points SHARED ${Points_SRCS} ${Points_Scripts}) link_directories(${CMAKE_BINARY_DIR}/src/3rdParty/libE57Format) target_link_libraries(Points E57Format ${Points_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Points) +endif() fc_target_copy_resource_flat(Points diff --git a/src/Mod/Points/Gui/CMakeLists.txt b/src/Mod/Points/Gui/CMakeLists.txt index 1533e20d0e..644e8c183b 100644 --- a/src/Mod/Points/Gui/CMakeLists.txt +++ b/src/Mod/Points/Gui/CMakeLists.txt @@ -66,6 +66,9 @@ endif(FREECAD_USE_PCH) add_library(PointsGui SHARED ${PointsGui_SRCS} ${PointsGui_Scripts} ${PointsGuiIcon_SVG}) target_link_libraries(PointsGui ${PointsGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(PointsGui) +endif() fc_target_copy_resource_flat(PointsGui ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/src/Mod/ReverseEngineering/App/CMakeLists.txt b/src/Mod/ReverseEngineering/App/CMakeLists.txt index 483e934e92..792ec70022 100644 --- a/src/Mod/ReverseEngineering/App/CMakeLists.txt +++ b/src/Mod/ReverseEngineering/App/CMakeLists.txt @@ -74,6 +74,9 @@ endif(FREECAD_USE_PCH) add_library(ReverseEngineering SHARED ${Reen_SRCS}) target_link_libraries(ReverseEngineering ${Reen_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(ReverseEngineering) +endif() SET_BIN_DIR(ReverseEngineering ReverseEngineering /Mod/ReverseEngineering) SET_PYTHON_PREFIX_SUFFIX(ReverseEngineering) diff --git a/src/Mod/ReverseEngineering/Gui/CMakeLists.txt b/src/Mod/ReverseEngineering/Gui/CMakeLists.txt index 1cdcd8944c..0330c7de14 100644 --- a/src/Mod/ReverseEngineering/Gui/CMakeLists.txt +++ b/src/Mod/ReverseEngineering/Gui/CMakeLists.txt @@ -70,6 +70,9 @@ endif(FREECAD_USE_PCH) add_library(ReverseEngineeringGui SHARED ${ReenGui_SRCS} ${ReverseEngineeringGuiIcon_SVG}) target_link_libraries(ReverseEngineeringGui ${ReenGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(ReverseEngineeringGui) +endif() SET_BIN_DIR(ReverseEngineeringGui ReverseEngineeringGui /Mod/ReverseEngineering) SET_PYTHON_PREFIX_SUFFIX(ReverseEngineeringGui) diff --git a/src/Mod/Robot/App/CMakeLists.txt b/src/Mod/Robot/App/CMakeLists.txt index ab314f7ff3..0babdd2edf 100644 --- a/src/Mod/Robot/App/CMakeLists.txt +++ b/src/Mod/Robot/App/CMakeLists.txt @@ -123,6 +123,9 @@ SOURCE_GROUP("Module" FILES ${Mod_SRCS}) add_library(Robot SHARED ${Robot_SRCS}) target_link_libraries(Robot ${Robot_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Robot) +endif() unset(_flag_found CACHE) check_cxx_compiler_flag("-Wno-deprecated-copy" _flag_found) diff --git a/src/Mod/Robot/Gui/CMakeLists.txt b/src/Mod/Robot/Gui/CMakeLists.txt index 90dab20ac1..486ade9eab 100644 --- a/src/Mod/Robot/Gui/CMakeLists.txt +++ b/src/Mod/Robot/Gui/CMakeLists.txt @@ -127,6 +127,9 @@ SET(RobotGuiIcon_SVG add_library(RobotGui SHARED ${RobotGui_SRCS} ${RobotGuiIcon_SVG}) target_link_libraries(RobotGui ${RobotGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(RobotGui) +endif() unset(_flag_found CACHE) check_cxx_compiler_flag("-Wno-deprecated-copy" _flag_found) diff --git a/src/Mod/Sketcher/App/CMakeLists.txt b/src/Mod/Sketcher/App/CMakeLists.txt index f563f04790..93ab66f497 100644 --- a/src/Mod/Sketcher/App/CMakeLists.txt +++ b/src/Mod/Sketcher/App/CMakeLists.txt @@ -145,6 +145,9 @@ SET(Sketcher_PCH_SRCS add_library(Sketcher SHARED ${Sketcher_SRCS}) target_link_libraries(Sketcher ${Sketcher_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Sketcher) +endif() if(FREECAD_USE_PCH) add_definitions(-D_PreComp_) diff --git a/src/Mod/Sketcher/Gui/CMakeLists.txt b/src/Mod/Sketcher/Gui/CMakeLists.txt index 1c500f3b9a..2a1a8aff00 100644 --- a/src/Mod/Sketcher/Gui/CMakeLists.txt +++ b/src/Mod/Sketcher/Gui/CMakeLists.txt @@ -197,7 +197,9 @@ SET(SketcherGuiIcon_SVG add_library(SketcherGui SHARED ${SketcherGui_SRCS} ${SketcherGuiIcon_SVG}) target_link_libraries(SketcherGui ${SketcherGui_LIBS}) - +if (FREECAD_WARN_ERROR) + target_compile_warn_error(SketcherGui) +endif() SET_BIN_DIR(SketcherGui SketcherGui /Mod/Sketcher) SET_PYTHON_PREFIX_SUFFIX(SketcherGui) diff --git a/src/Mod/Spreadsheet/App/CMakeLists.txt b/src/Mod/Spreadsheet/App/CMakeLists.txt index 959ce57bd0..0630553614 100644 --- a/src/Mod/Spreadsheet/App/CMakeLists.txt +++ b/src/Mod/Spreadsheet/App/CMakeLists.txt @@ -57,6 +57,9 @@ endif(FREECAD_USE_PCH) add_library(Spreadsheet SHARED ${Spreadsheet_SRCS}) target_link_libraries(Spreadsheet ${Spreadsheet_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Spreadsheet) +endif() SET_BIN_DIR(Spreadsheet Spreadsheet /Mod/Spreadsheet) diff --git a/src/Mod/Spreadsheet/Gui/CMakeLists.txt b/src/Mod/Spreadsheet/Gui/CMakeLists.txt index 85e6b34a4d..35e130667f 100644 --- a/src/Mod/Spreadsheet/Gui/CMakeLists.txt +++ b/src/Mod/Spreadsheet/Gui/CMakeLists.txt @@ -110,6 +110,9 @@ set(SpreadsheetGui_UIC_SRCS add_library(SpreadsheetGui SHARED ${SpreadsheetGui_SRCS} ${SpreadsheetGuiIcon_SVG}) target_link_libraries(SpreadsheetGui ${SpreadsheetGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(SpreadsheetGui) +endif() SET_BIN_DIR(SpreadsheetGui SpreadsheetGui /Mod/Spreadsheet) SET_PYTHON_PREFIX_SUFFIX(SpreadsheetGui) diff --git a/src/Mod/Start/App/CMakeLists.txt b/src/Mod/Start/App/CMakeLists.txt index b0595719bd..52ccf24e2a 100644 --- a/src/Mod/Start/App/CMakeLists.txt +++ b/src/Mod/Start/App/CMakeLists.txt @@ -43,6 +43,9 @@ SET(Start_SRCS add_library(Start SHARED ${Start_SRCS}) target_link_libraries(Start ${Start_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Start) +endif() SET_BIN_DIR(Start Start /Mod/Start) SET_PYTHON_PREFIX_SUFFIX(Start) diff --git a/src/Mod/Start/Gui/CMakeLists.txt b/src/Mod/Start/Gui/CMakeLists.txt index d120018941..a6417f89d1 100644 --- a/src/Mod/Start/Gui/CMakeLists.txt +++ b/src/Mod/Start/Gui/CMakeLists.txt @@ -91,6 +91,9 @@ endif (FREECAD_USE_PCH) add_library(StartGui SHARED ${StartGui_SRCS} ${StartGuiIcon_SVG} ${StartGuiThumbnail_PNG}) # target_link_libraries(StartGui ${StartGui_LIBS} Qt::Quick Qt::Qml Qt::QuickWidgets) target_link_libraries(StartGui ${StartGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(StartGui) +endif() SET_BIN_DIR(StartGui StartGui /Mod/Start) SET_PYTHON_PREFIX_SUFFIX(StartGui) diff --git a/src/Mod/Surface/App/CMakeLists.txt b/src/Mod/Surface/App/CMakeLists.txt index 1e4dd865ee..ea9160c3a7 100644 --- a/src/Mod/Surface/App/CMakeLists.txt +++ b/src/Mod/Surface/App/CMakeLists.txt @@ -71,6 +71,9 @@ endif(FREECAD_USE_PCH) link_directories(${OCC_LIBRARY_DIR}) add_library(Surface SHARED ${Surface_SRCS}) target_link_libraries(Surface ${Surface_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Surface) +endif() SET_BIN_DIR(Surface Surface /Mod/Surface) SET_PYTHON_PREFIX_SUFFIX(Surface) diff --git a/src/Mod/Surface/Gui/CMakeLists.txt b/src/Mod/Surface/Gui/CMakeLists.txt index 2029c157ce..86f2acb2bf 100644 --- a/src/Mod/Surface/Gui/CMakeLists.txt +++ b/src/Mod/Surface/Gui/CMakeLists.txt @@ -72,6 +72,9 @@ endif(FREECAD_USE_PCH) link_directories(${OCC_LIBRARY_DIR}) add_library(SurfaceGui SHARED ${SurfaceGui_SRCS} ${SurfaceGuiIcon_SVG}) target_link_libraries(SurfaceGui ${SurfaceGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(SurfaceGui) +endif() SET_BIN_DIR(SurfaceGui SurfaceGui /Mod/Surface) SET_PYTHON_PREFIX_SUFFIX(SurfaceGui) diff --git a/src/Mod/TechDraw/App/CMakeLists.txt b/src/Mod/TechDraw/App/CMakeLists.txt index d141eac135..4df2f85daf 100644 --- a/src/Mod/TechDraw/App/CMakeLists.txt +++ b/src/Mod/TechDraw/App/CMakeLists.txt @@ -277,6 +277,9 @@ endif(FREECAD_USE_PCH) add_library(TechDraw SHARED ${TechDraw_SRCS} ${Draw_SRCS} ${TechDrawAlgos_SRCS} ${Geometry_SRCS} ${Python_SRCS}) target_link_libraries(TechDraw ${TechDrawLIBS} ${TechDraw}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(TechDraw) +endif() ADD_CUSTOM_COMMAND(TARGET TechDraw POST_BUILD diff --git a/src/Mod/TechDraw/Gui/CMakeLists.txt b/src/Mod/TechDraw/Gui/CMakeLists.txt index 2951db9ad5..f9ab485b59 100644 --- a/src/Mod/TechDraw/Gui/CMakeLists.txt +++ b/src/Mod/TechDraw/Gui/CMakeLists.txt @@ -479,6 +479,9 @@ endif(FREECAD_USE_PCH) add_library(TechDrawGui SHARED ${TechDrawGui_SRCS} ${TechDrawGuiView_SRCS} ${TechDrawGuiViewProvider_SRCS} ${TechDrawGuiNav_SRCS} ${TechDrawGuiIcon_SVG} ${TechDrawGuiFonts} ${MRTE_SRCS}) target_link_libraries(TechDrawGui ${TechDrawGui_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(TechDrawGui) +endif() fc_copy_sources(TechDrawGui "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/TechDraw/" ${TechDrawGuiIcon_SVG}) INSTALL(FILES ${TechDrawGuiIcon_SVG} DESTINATION "${CMAKE_INSTALL_DATADIR}/Mod/TechDraw/Resources/icons") diff --git a/src/Mod/Test/Gui/CMakeLists.txt b/src/Mod/Test/Gui/CMakeLists.txt index c10b10ae64..adcb0c865b 100644 --- a/src/Mod/Test/Gui/CMakeLists.txt +++ b/src/Mod/Test/Gui/CMakeLists.txt @@ -61,6 +61,9 @@ add_library(QtUnitGui SHARED ${TestGui_SRCS} ${TestGuiPy_SRCS} ${TestGuiIcon_SVG target_link_libraries(QtUnitGui ${TestGui_LIBS}) add_dependencies(QtUnitGui Test) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(QtUnitGui) +endif() fc_copy_sources(QtUnitGui "${CMAKE_BINARY_DIR}/Mod/Test" qtunittest.py) fc_copy_sources(QtUnitGui "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Test" ${TestGuiIcon_SVG}) diff --git a/src/Mod/Web/App/CMakeLists.txt b/src/Mod/Web/App/CMakeLists.txt index 6e430151d9..f53a7ef032 100644 --- a/src/Mod/Web/App/CMakeLists.txt +++ b/src/Mod/Web/App/CMakeLists.txt @@ -31,6 +31,9 @@ endif(FREECAD_USE_PCH) add_library(Web SHARED ${Web_SRCS}) target_link_libraries(Web ${Web_LIBS}) +if (FREECAD_WARN_ERROR) + target_compile_warn_error(Web) +endif() SET_BIN_DIR(Web Web /Mod/Web) SET_PYTHON_PREFIX_SUFFIX(Web)