Skip to content

Commit 1d1cc9a

Browse files
Green-Skyctruta
authored andcommitted
cmake: Fix an error in the declaration of target include directories
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. Signed-off-by: Cosmin Truta <[email protected]>
1 parent 1964d56 commit 1d1cc9a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,6 @@ else()
363363
message(STATUS "Could not find an AWK-compatible program")
364364
endif()
365365

366-
include_directories(${CMAKE_CURRENT_BINARY_DIR})
367-
368366
if(NOT AWK OR ANDROID OR IOS)
369367
# No awk available to generate sources; use pre-built pnglibconf.h
370368
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
@@ -715,6 +713,8 @@ if(PNG_SHARED)
715713
endif()
716714
target_include_directories(png_shared
717715
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
716+
target_include_directories(png_shared
717+
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
718718
target_include_directories(png_shared SYSTEM
719719
INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libpng${PNGLIB_ABI_VERSION}>)
720720
target_link_libraries(png_shared PUBLIC ZLIB::ZLIB ${M_LIBRARY})
@@ -729,6 +729,8 @@ if(PNG_STATIC)
729729
DEBUG_POSTFIX "${PNG_DEBUG_POSTFIX}")
730730
target_include_directories(png_static
731731
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
732+
target_include_directories(png_static
733+
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
732734
target_include_directories(png_static SYSTEM
733735
INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libpng${PNGLIB_ABI_VERSION}>)
734736
target_link_libraries(png_static PUBLIC ZLIB::ZLIB ${M_LIBRARY})

scripts/cmake/AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Author List
2121
* Dan Rosser
2222
* David Callu
2323
* Eric Riff
24+
* Erik Scholz
2425
* Gianfranco Costamagna
2526
* Gleb Mazovetskiy
2627
* Glenn Randers-Pehrson

0 commit comments

Comments
 (0)