Cleanup gcc version checking code a little.

Also fix this error from cmake 3.5.1:

```
CMake Error at CMakeLists.txt:62 (if):
  if given arguments:

    "CMAKE_COMPILER_IS_GNUCXX" "AND" "CMAKE_CXX_COMPILER_VERSION" "VERSION_LESS_EQUAL" "4.8.5"

  Unknown arguments specified
```
This commit is contained in:
Davis King 2021-04-28 08:05:22 -04:00
parent 8e9755ab0f
commit ded68b9af7
2 changed files with 2 additions and 7 deletions

View File

@ -58,11 +58,6 @@ if(has_parent)
endif()
endif()
# As of dlib 19.22, GCC 4.8.5 is no longer supported, building will fail, so let users know.
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 4.8.5)
message(FATAL_ERROR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_VERSION} is too old for dlib ${VERSION}.\n\
Either update your compiler to be fully compliant with C++11 or build an older version of dlib, such as 19.21.")
endif()
if (COMMAND pybind11_add_module AND MSVC)
# True when building a python extension module using Visual Studio. We care

View File

@ -46,8 +46,8 @@ endif()
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_LESS 4.8)
message(FATAL_ERROR "C++11 is required to use dlib, but the version of GCC you are using is too old and doesn't support C++11. You need GCC 4.8 or newer. ")
if (GCC_VERSION VERSION_LESS 4.9)
message(FATAL_ERROR "C++11 is required to use dlib, but the version of GCC you are using is too old and doesn't support C++11. You need GCC 4.9 or newer. ")
endif()
endif()