Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions dlib/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ cmake_minimum_required(VERSION 3.10.0)
set (target_name dtest)
PROJECT(${target_name})

option(Werror "Error on warnings" ON)

# compile the dlib/all/source.cpp file into its own object just to make sure it compiles
set(DLIB_TEST_COMPILE_ALL_SOURCE_CPP ON)



add_subdirectory(.. dlib_build)

add_executable(${target_name} main.cpp tester.cpp
Expand Down Expand Up @@ -169,8 +173,13 @@ get_filename_component(DLIB_FFMPEG_DATA ${CMAKE_SOURCE_DIR}/ffmpeg_data/details.
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)
# Turn on all warnings, and treat them as errors by default
add_compile_options(-W -Wall -Wextra -Wpedantic)
if (Werror)
add_compile_options(-Werror)
endif()

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)
Expand Down Expand Up @@ -204,11 +213,16 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif()

elseif (MSVC)
# Treat warnings as errors.
add_compile_options(/WX)
if (Werror)
# Treat warnings as errors.
add_compile_options(/WX)
endif()
else() # basically Clang
# Treat warnings as errors, but do not turn on all warnings.
add_compile_options(-W -Werror)
add_compile_options(-W)
if (Werror)
add_compile_options(-Werror)
endif()
# This is for the comment in face_detection_ex.cpp that says "faces/*.jpg"
add_compile_options(-Wno-comment)

Expand Down
Loading