>From 7a35a0d9c4303d927fd76d01885ab83109caba3a Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Sat, 7 Apr 2018 22:12:21 +0100 Subject: [PATCH 15/19] CMakeLists.txt: Set defines locally, privately on the freetype target This makes the defines more hygienic: instead of writing them to the global definitions name space, they are set to only be used when compiling the FreeType library as such. --- CMakeLists.txt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b497ce32c..650c1f3a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,14 +173,6 @@ if (BUILD_FRAMEWORK) endif () -# Compiler definitions for building the library -add_definitions(-DFT2_BUILD_LIBRARY) -if (WIN32) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) - add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) -endif () - - # Find dependencies foreach (d ZLIB BZip2 PNG HarfBuzz) string(TOUPPER "${d}" D) @@ -335,6 +327,13 @@ set_target_properties( freetype PROPERTIES C_VISIBILITY_PRESET hidden) +target_compile_definitions( + freetype PRIVATE FT2_BUILD_LIBRARY) + +if (WIN32) + target_compile_definitions( + freetype PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) +endif () if (BUILD_SHARED_LIBS) set_target_properties(freetype PROPERTIES -- 2.14.3