From f45bc97b72113307db1c80acd7e2050eb390daae Mon Sep 17 00:00:00 2001 From: Green Sky Date: Wed, 17 Apr 2024 12:32:45 +0200 Subject: [PATCH] CMake: Properly declare target include directories for generated includes. Previously the non targeted `include_directories()` was used, which had issue when using the `png_static` target in a submodule. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77e5398b6a..ffb29f8111 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,8 +362,6 @@ else() message(STATUS "Could not find an AWK-compatible program") endif() -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - if(NOT AWK OR ANDROID OR IOS) # No awk available to generate sources; use pre-built pnglibconf.h configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt @@ -714,6 +712,8 @@ if(PNG_SHARED) endif() target_include_directories(png_shared PUBLIC $) + target_include_directories(png_shared + PUBLIC $) target_include_directories(png_shared SYSTEM INTERFACE $) target_link_libraries(png_shared PUBLIC ZLIB::ZLIB ${M_LIBRARY}) @@ -728,6 +728,8 @@ if(PNG_STATIC) DEBUG_POSTFIX "${PNG_DEBUG_POSTFIX}") target_include_directories(png_static PUBLIC $) + target_include_directories(png_static + PUBLIC $) target_include_directories(png_static SYSTEM INTERFACE $) target_link_libraries(png_static PUBLIC ZLIB::ZLIB ${M_LIBRARY})