Skip to content

Commit

Permalink
CMake: silent GCC12 warnings for deprecated std::iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
HuguesDelorme committed Apr 25, 2024
1 parent 637058a commit 4d7f95b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,16 @@ endif()
if(OpenCASCADE_FOUND)
message(STATUS "OpenCascade version ${OpenCASCADE_VERSION}")

# Silent warnings C4996 and STL4015: the std::iterator class template(used as a base class to
# provide typedefs) is deprecated in C++17
if(MSVC AND OpenCASCADE_VERSION VERSION_LESS 7.7.0)
list(APPEND Mayo_CompileDefinitions _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING)
# std::iterator class template(used as a base class to provide typedefs) is deprecated in C++17
# OpenCascade < 7.7.0 uses std::iterator for NCollection_StlIterator and this is causing many
# deprecation warnings
if(OpenCASCADE_VERSION VERSION_LESS 7.7.0)
if(MSVC)
# Silent warnings C4996 and STL4015
list(APPEND Mayo_CompileDefinitions _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING)
elseif((CMAKE_CXX_COMPILER_ID MATCHES "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12))
list(APPEND Mayo_CompileOptions -Wno-deprecated-declarations)
endif()
endif()

# Add OpenCASCADE libraries
Expand Down

0 comments on commit 4d7f95b

Please sign in to comment.