diff --git a/dlib/test/CMakeLists.txt b/dlib/test/CMakeLists.txt index 330ac241..3d0df673 100644 --- a/dlib/test/CMakeLists.txt +++ b/dlib/test/CMakeLists.txt @@ -168,58 +168,6 @@ add_executable(${target_name} main.cpp tester.cpp get_filename_component(DLIB_FFMPEG_DATA ${CMAKE_SOURCE_DIR}/ffmpeg_data/details.cfg REALPATH) target_compile_definitions(${target_name} PRIVATE DLIB_FFMPEG_DATA="${DLIB_FFMPEG_DATA}") -if (CMAKE_COMPILER_IS_GNUCXX) - # Turn on all warnings, and treat them as errors. - add_compile_options(-W -Wall -Wextra -Wpedantic -Werror) - add_compile_options(-fdiagnostics-color=always) - # I don't care about unused testing functions though. I like to keep them - # around. Don't warn about it. - add_compile_options(-Wno-unused-function) - add_compile_options(-Wno-strict-overflow) - add_compile_options(-Wno-maybe-uninitialized) - - if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11.3.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 11.4.0) OR - (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 14.0.1)) - # These versions of gcc wrongly yield this warning: - # dlib::row_major_layout::layout >::data’ with nonzero offset 8 [-Werror=free-nonheap-object] - # 61 | delete [] item; - # Which by inspection of the dlib::row_major_layout::layout class you can see is clearly incorrect, as `data` is most - # definitely heap allocated. - add_compile_options(-Wno-free-nonheap-object) - endif() - - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 14.0.1) - # These versions of gcc wrongly yield this warning: - # In member function ‘allocate_array’, - # inlined from ‘set_max_size’ at /builddir/build/BUILD/dlib-19.24.4/dlib/../dlib/svm/../matrix/../array/array_kernel.h:438:59, - # inlined from ‘push_back.constprop’ at /builddir/build/BUILD/dlib-19.24.4/dlib/../dlib/svm/../matrix/../array/array_kernel.h:769:30: - # /builddir/build/BUILD/dlib-19.24.4/dlib/../dlib/svm/../memory_manager_stateless/memory_manager_stateless_kernel_1.h:54:24: warning: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=] - # 54 | return new T[size]; - # when compiling dlib example programs that most definitely do not ask for such allocations. - add_compile_options(-Wno-alloc-size-larger-than) - endif() - - if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0") - # strip debug symbols to make the binary smaller - target_link_options(${target_name} PRIVATE $<$:-s>) - endif() - -elseif (MSVC) - # Treat warnings as errors. - add_compile_options(/WX) -else() # basically Clang - # Treat warnings as errors, but do not turn on all warnings. - add_compile_options(-W -Werror) - # This is for the comment in face_detection_ex.cpp that says "faces/*.jpg" - add_compile_options(-Wno-comment) - - if(${CMAKE_VERSION} VERSION_GREATER "3.8.0") - # strip debug symbols to make the binary smaller - target_link_options(${target_name} PRIVATE $<$:-s>) - endif() -endif() - - target_link_libraries(${target_name} dlib::dlib )