[CMAKE] Get rid of replace_compile_flags

Introduce a finer-grained remove_target_compile_option instead
This commit is contained in:
Jérôme Gardou 2020-09-18 11:49:18 +02:00 committed by Jérôme Gardou
parent b52fa999eb
commit 7e116f0ef3
27 changed files with 138 additions and 144 deletions

View file

@ -5,11 +5,6 @@ add_definitions(
include_directories(include)
if(MSVC)
# error C4312: 'type cast': conversion from 'unsigned long' to 'void *' of greater size
replace_compile_flags("/we4312" " ")
endif()
list(APPEND SOURCE
src/autofit/autofit.c
src/base/ftadvanc.c
@ -60,7 +55,10 @@ list(APPEND SOURCE
add_library(freetype ${SOURCE})
if(GCC)
if (MSVC)
# error C4312: 'type cast': conversion from 'unsigned long' to 'void *' of greater size
remove_target_compile_option(freetype "/we4312")
elseif(GCC)
target_compile_options(freetype PRIVATE -fno-builtin-malloc)
elseif(CLANG)
target_compile_options(freetype PRIVATE -Wno-tautological-constant-compare)

View file

@ -66,10 +66,10 @@ add_library(libxml2 ${SOURCE})
if(MSVC AND (NOT USE_CLANG_CL))
# Unreferenced local variable
replace_compile_flags("/we4101" " ")
remove_target_compile_option(libxml2 "/we4101")
target_compile_options(libxml2 PRIVATE "/wd4101")
# Local variable initialized but not referenced
replace_compile_flags("/we4189" " ")
remove_target_compile_option(libxml2 "/we4189")
else()
target_compile_options(libxml2 PRIVATE "-w")
endif()