do not use precompiled header for setting global compiler definitions and to disable compiler warnings

only 4 of these warnings are still relevant, CMake shall be used to disable them

Compiler definitions:

  NOMINMAX:
    * is already globally defined in SetGlobalCompilerAndLinkerSettings.cmake

  WIN32_LEAN_AND_MEAN:
    * use CMake target_compile_options on relevant targets

Warnings that still occur:

  C4251, C4273, C4275: all related to dllimport / export
    * use CMake target_compile_options on relevant targets

  C4661: no suitable definition provied for explicit template instantiation request
    * triggered in Mesh because of Vector3D in Base - not all functions are defined in header
    * use CMake target_compile_options on relevant targets

Warnings that are Currently not triggered (fix code if they appear again):

  C4005: macro redefinition

  C4244: argument conversion, possible loss of data

  C4267: conversion from size_t to type, possible loss of data

  C4305: truncation from type1 to type2
    * only occurrence disabled in Reader.cpp

  C4522: multiple assignment operator specified

  C5208: unnamed class in typedef name

Obsolete Compiler warnings:

  C4181: not mentioned in Microsoft docs anymore

  C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
    * throw(optional_type_list)  deprecated in C++17

  C4482: nonstandard extension used: enum 'enumeration' used in qualified name
    * not generated for compilers that support C++11

  C4503: 'identifier': decorated name length exceeded, name was truncated
    * obsolete since Visual Studio 2017

  C4786: not mentioned in Microsoft docs anymore
This commit is contained in:
Markus Reitböck
2025-08-26 11:39:16 +02:00
committed by Chris Hennes
parent 965109dd73
commit 749ac36615
76 changed files with 167 additions and 310 deletions

View File

@@ -289,6 +289,11 @@ target_include_directories(
)
target_link_libraries(TechDraw ${TechDrawLIBS} ${TechDraw})
if (MSVC)
target_compile_options(TechDraw PRIVATE /wd4275)
endif()
if (FREECAD_WARN_ERROR)
target_compile_warn_error(TechDraw)
endif()

View File

@@ -25,10 +25,6 @@
#include <FCConfig.h>
#ifdef _MSC_VER
# pragma warning( disable : 4275 )
#endif
#ifdef _PreComp_
// standard

View File

@@ -485,6 +485,11 @@ target_include_directories(
)
target_link_libraries(TechDrawGui ${TechDrawGui_LIBS})
if (MSVC)
target_compile_definitions(TechDrawGui PRIVATE WIN32_LEAN_AND_MEAN)
endif()
if (FREECAD_WARN_ERROR)
target_compile_warn_error(TechDrawGui)
endif()

View File

@@ -25,14 +25,7 @@
#include <FCConfig.h>
#ifdef _MSC_VER
# pragma warning(disable : 4005)
#endif
#ifdef FC_OS_WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#endif
#ifdef _PreComp_
@@ -51,7 +44,6 @@
#include <vector>
#ifdef FC_OS_WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef small
#endif