From bd664d9aa1362598c29c351aecc9b7901695ca6a Mon Sep 17 00:00:00 2001 From: Aziz Baibabaev Date: Mon, 13 Jul 2015 17:30:14 +0200 Subject: [PATCH] Replace add_definitions with CMAKE_CXX_FLAGS in cmake file When using add_definitions erroneous flags are passed to dll resource compiler under MinGW. This breaks the build for anything linked to dlib, using a dll rc and MinGW. The proper way is to append to CMAKE_CXX_FLAGS. For CMake 2.8.12 and higher the proper way is add_compile_options(-Wreturn-type) OR target_compile_options(dlib PRIVATE -Wreturn-type) --- dlib/cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlib/cmake b/dlib/cmake index 87ee87bc3..d4a0bd2ed 100644 --- a/dlib/cmake +++ b/dlib/cmake @@ -15,8 +15,8 @@ string(REGEX REPLACE "cmake$" "" dlib_path ${CMAKE_CURRENT_LIST_FILE}) if (CMAKE_COMPILER_IS_GNUCXX) # By default, g++ won't warn or error if you forget to return a value in a # function which requires you to do so. This option makes it give a warning - # for doing this. - add_definitions("-Wreturn-type") + # for doing this. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wreturn-type") endif() # Setup some options to allow a user to enable SSE and AVX instruction use.