CMake: private includes before public includes

This way, build-in headers (for example png headers) will always be included
before system headers.
This commit is contained in:
Maarten Bent
2019-11-27 20:40:11 +01:00
parent 4d72739714
commit 38c38e2274
2 changed files with 11 additions and 3 deletions

View File

@@ -405,14 +405,18 @@ endmacro()
# Forwards everything to target_include_directories() except for monolithic
# build where it collects all include paths for linking with the mono lib
macro(wx_lib_include_directories name)
cmake_parse_arguments(_LIB_INCLUDE_DIRS "" "" "PUBLIC;PRIVATE" ${ARGN})
if(wxBUILD_MONOLITHIC)
cmake_parse_arguments(_LIB_INCLUDE_DIRS "" "" "PUBLIC;PRIVATE" ${ARGN})
list(APPEND wxMONO_INCLUDE_DIRS_PUBLIC ${_LIB_INCLUDE_DIRS_PUBLIC})
list(APPEND wxMONO_INCLUDE_DIRS_PRIVATE ${_LIB_INCLUDE_DIRS_PRIVATE})
set(wxMONO_INCLUDE_DIRS_PUBLIC ${wxMONO_INCLUDE_DIRS_PUBLIC} PARENT_SCOPE)
set(wxMONO_INCLUDE_DIRS_PRIVATE ${wxMONO_INCLUDE_DIRS_PRIVATE} PARENT_SCOPE)
else()
target_include_directories(${name};BEFORE;${ARGN})
set(INCLUDE_POS)
if (_LIB_INCLUDE_DIRS_PRIVATE)
set(INCLUDE_POS BEFORE)
endif()
target_include_directories(${name};${INCLUDE_POS};${ARGN})
endif()
endmacro()