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)
This commit is contained in:
Aziz Baibabaev 2015-07-13 17:30:14 +02:00
parent 95887df088
commit bd664d9aa1
1 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
# By default, g++ won't warn or error if you forget to return a value in a # 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 # function which requires you to do so. This option makes it give a warning
# for doing this. # for doing this.
add_definitions("-Wreturn-type") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wreturn-type")
endif() endif()
# Setup some options to allow a user to enable SSE and AVX instruction use. # Setup some options to allow a user to enable SSE and AVX instruction use.