>From 24069b36bdb13ab414c03616e7f572dbb4d622f1 Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Sat, 7 Apr 2018 22:17:29 +0100 Subject: [PATCH 16/19] CMakeLists.txt: Set include directories locally on freetype target As in the previous commit, set include directories that are only needed for building the library as such locally on the freetype target. This is cleaner than setting them globally. --- CMakeLists.txt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 650c1f3a1..fc6f07f6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,9 +246,6 @@ if (HARFBUZZ_FOUND) endif () file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h" "${FTOPTION_H}") -# Specify library include directories -include_directories("${PROJECT_SOURCE_DIR}/include") -include_directories(BEFORE "${PROJECT_BINARY_DIR}/include") file(GLOB PUBLIC_HEADERS "include/ft2build.h" "include/freetype/*.h") @@ -341,6 +338,14 @@ if (BUILD_SHARED_LIBS) SOVERSION ${LIBRARY_SOVERSION}) endif () +target_include_directories( + freetype BEFORE # Pick up ftconfig.h and ftoption.h generated above. + PRIVATE "${PROJECT_BINARY_DIR}/include") + +target_include_directories( + freetype + PRIVATE "${PROJECT_SOURCE_DIR}/include") + if (BUILD_FRAMEWORK) set_property(SOURCE ${PUBLIC_CONFIG_HEADERS} @@ -367,20 +372,20 @@ endif () if (ZLIB_FOUND) target_link_libraries(freetype ${MAYBE_PRIVATE} ${ZLIB_LIBRARIES}) - include_directories(${ZLIB_INCLUDE_DIRS}) + target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS}) endif () if (BZIP2_FOUND) target_link_libraries(freetype ${MAYBE_PRIVATE} ${BZIP2_LIBRARIES}) - include_directories(${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS + target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS endif () if (PNG_FOUND) add_definitions(${PNG_DEFINITIONS}) target_link_libraries(freetype ${MAYBE_PRIVATE} ${PNG_LIBRARIES}) - include_directories(${PNG_INCLUDE_DIRS}) + target_include_directories(freetype PRIVATE ${PNG_INCLUDE_DIRS}) endif () if (HARFBUZZ_FOUND) target_link_libraries(freetype ${MAYBE_PRIVATE} ${HARFBUZZ_LIBRARIES}) - include_directories(${HARFBUZZ_INCLUDE_DIRS}) + target_include_directories(freetype PRIVATE ${HARFBUZZ_INCLUDE_DIRS}) endif () -- 2.14.3