From 6a637cfc22be27660327bc7eee11c8a8214c6f5c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 11 Apr 2018 17:30:15 -0400 Subject: [PATCH] CMakeLists: Don't dump libpng's includes into the top-level directory Instead, add the includes to the target, which only libraries that link it in can actually see. --- CMakeLists.txt | 1 - Externals/libpng/CMakeLists.txt | 15 +++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f9d18f1cad..fdbf7bae4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -599,7 +599,6 @@ if (PNG_FOUND) else() message(STATUS "Using static libpng from Externals") add_subdirectory(Externals/libpng) - include_directories(Externals/libpng) set(PNG png) endif() diff --git a/Externals/libpng/CMakeLists.txt b/Externals/libpng/CMakeLists.txt index 8489e6944a..4396e4a34c 100644 --- a/Externals/libpng/CMakeLists.txt +++ b/Externals/libpng/CMakeLists.txt @@ -1,5 +1,4 @@ -# OUR SOURCES -set(SRCS +add_library(png STATIC png.h pngconf.h png.c @@ -18,7 +17,15 @@ set(SRCS pngwtran.c pngwutil.c ) + +target_include_directories(png +PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + if(NOT MSVC) - add_definitions(-Wno-self-assign) + target_compile_options(png + PRIVATE + -Wno-self-assign + ) endif() -add_library(png STATIC ${SRCS})