diff --git a/cmake/VISPGenerateConfig.cmake b/cmake/VISPGenerateConfig.cmake index 84710a2903..589dad8dc5 100644 --- a/cmake/VISPGenerateConfig.cmake +++ b/cmake/VISPGenerateConfig.cmake @@ -144,6 +144,7 @@ if(UNIX) set(VISP_INCLUDE_DIRS_CONFIGCMAKE "\${VISP_INSTALL_PATH}/${VISP_INC_INSTALL_PATH}") foreach(m ${VISP_MODULES_BUILD}) list(APPEND VISP_INCLUDE_DIRS_CONFIGCMAKE ${VISP_MODULE_${m}_INC_DEPS}) + list(APPEND VISP_INCLUDE_DIRS_CONFIGCMAKE ${VISP_MODULE_${m}_SYSTEM_INC_DEPS}) endforeach() vp_list_unique(VISP_INCLUDE_DIRS_CONFIGCMAKE) endif() @@ -164,6 +165,7 @@ if(WIN32) set(VISP_INCLUDE_DIRS_CONFIGCMAKE "\${VISP_CONFIG_PATH}/${VISP_INC_INSTALL_PATH}") foreach(m ${VISP_MODULES_BUILD}) list(APPEND VISP_INCLUDE_DIRS_CONFIGCMAKE ${VISP_MODULE_${m}_INC_DEPS}) + list(APPEND VISP_INCLUDE_DIRS_CONFIGCMAKE ${VISP_MODULE_${m}_SYSTEM_INC_DEPS}) endforeach() vp_list_unique(VISP_INCLUDE_DIRS_CONFIGCMAKE) diff --git a/cmake/VISPModule.cmake b/cmake/VISPModule.cmake index fa4d1a54c8..c4fc939f4e 100644 --- a/cmake/VISPModule.cmake +++ b/cmake/VISPModule.cmake @@ -86,6 +86,7 @@ foreach(mod ${VISP_MODULES_BUILD} ${VISP_MODULES_DISABLED_USER} ${VISP_MODULES_D unset(VISP_MODULE_${mod}_PRIVATE_OPT_DEPS CACHE) unset(VISP_MODULE_${mod}_LINK_DEPS CACHE) unset(VISP_MODULE_${mod}_INC_DEPS CACHE) + unset(VISP_MODULE_${mod}_SYSTEM_INC_DEPS CACHE) unset(VISP_MODULE_${mod}_WRAPPERS CACHE) endforeach() @@ -179,6 +180,7 @@ macro(vp_add_module _name) set(VISP_MODULE_${the_module}_LINK_DEPS "" CACHE INTERNAL "") set(VISP_MODULE_${the_module}_INC_DEPS "" CACHE INTERNAL "") + set(VISP_MODULE_${the_module}_SYSTEM_INC_DEPS "" CACHE INTERNAL "") # parse list of dependencies if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS") @@ -606,7 +608,6 @@ macro(vp_target_include_modules target) endforeach() vp_list_unique(VISP_MODULE_${the_module}_INC_DEPS) vp_list_unique(VISP_MODULE_${the_module}_SYSTEM_INC_DEPS) - endmacro() # setup include paths for the list of passed modules and recursively add dependent modules @@ -836,12 +837,22 @@ macro(_vp_create_module) target_compile_definitions(${the_module} PRIVATE visp_EXPORTS) endif() - set_property(TARGET ${the_module} APPEND PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${VISP_MODULE_${the_module}_INC_DEPS} - ) - set_property(TARGET ${the_module} APPEND PROPERTY - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${VISP_MODULE_${the_module}_SYSTEM_INC_DEPS} - ) + #set_property(TARGET ${the_module} APPEND PROPERTY + # # Here we need also to add system include dirs, otherwise they are missing + # INTERFACE_INCLUDE_DIRECTORIES ${VISP_MODULE_${the_module}_INC_DEPS} ${VISP_MODULE_${the_module}_SYSTEM_INC_DEPS} + #) + #set_property(TARGET ${the_module} APPEND PROPERTY + # INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${VISP_MODULE_${the_module}_SYSTEM_INC_DEPS} + #) + set(inc "${VISP_MODULE_${the_module}_INC_DEPS};${VISP_MODULE_${the_module}_SYSTEM_INC_DEPS}") + if(NOT (CMAKE_VERSION VERSION_LESS "3.11.0")) # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1264 : eliminates "Cannot specify compile definitions for imported target" error message + target_include_directories(${the_module} SYSTEM INTERFACE "$") + else() + set_target_properties(${the_module} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "$" + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "$" + ) + endif() # For dynamic link numbering convenions if(NOT ANDROID) diff --git a/cmake/VISPUtils.cmake b/cmake/VISPUtils.cmake index 4a332e02a2..e3094740e1 100644 --- a/cmake/VISPUtils.cmake +++ b/cmake/VISPUtils.cmake @@ -214,12 +214,10 @@ function(vp_target_include_directories target) if(TARGET ${target}) target_include_directories(${target} SYSTEM PRIVATE ${__system_params}) else() - set(__new_inc ${VP_TARGET_INCLUDE_SYSTEM_DIRS_${target}}) - list(APPEND __new_inc ${__system_params}) + set(__new_inc "${VP_TARGET_INCLUDE_SYSTEM_DIRS_${target}};${__system_params}") set(VP_TARGET_INCLUDE_SYSTEM_DIRS_${target} "${__new_inc}" CACHE INTERNAL "") endif() endif() - endfunction() # clears all passed variables @@ -794,10 +792,12 @@ function(vp_target_link_libraries target) endfunction() function(_vp_append_target_includes target) + # Only defined for visp_ targets if(DEFINED VP_TARGET_INCLUDE_DIRS_${target}) target_include_directories(${target} PRIVATE ${VP_TARGET_INCLUDE_DIRS_${target}}) unset(VP_TARGET_INCLUDE_DIRS_${target} CACHE) endif() + # Only defined for visp_ targets if(DEFINED VP_TARGET_INCLUDE_SYSTEM_DIRS_${target}) target_include_directories(${target} SYSTEM PRIVATE ${VP_TARGET_INCLUDE_SYSTEM_DIRS_${target}}) unset(VP_TARGET_INCLUDE_SYSTEM_DIRS_${target} CACHE) @@ -1643,7 +1643,7 @@ macro(vp_get_all_includes _includes_modules _includes_extra _system_include_dirs foreach(m ${VISP_MODULES_BUILD}) list(APPEND ${_includes_extra} ${VISP_MODULE_${m}_INC_DEPS}) - list(APPEND ${_system_include_dirs} ${VISP_MODULE_${m}_SYSTEM_INC_DEPS}) + list(APPEND ${_includes_extra} ${VISP_MODULE_${m}_SYSTEM_INC_DEPS}) if(EXISTS "${VISP_MODULE_${m}_LOCATION}/include") list(INSERT ${_includes_modules} 0 "${VISP_MODULE_${m}_LOCATION}/include")