From 15a338e89ba9336038e836c7fb086cdd4fed1d7a Mon Sep 17 00:00:00 2001 From: helmutg Date: Mon, 12 Oct 2020 22:24:24 +0200 Subject: [PATCH] add build option USE_SYSTEM_PUGIXML (#2502) It allows skipping inference-engine/thirdparty/pugixml and using the system copy instead. Thanks to @Osse for helping understand cmake scoping rules. Co-authored-by: Helmut Grohne --- inference-engine/cmake/features_ie.cmake | 2 ++ inference-engine/thirdparty/CMakeLists.txt | 25 +++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/inference-engine/cmake/features_ie.cmake b/inference-engine/cmake/features_ie.cmake index 71947495cf9e90..b4936f4fdbef5d 100644 --- a/inference-engine/cmake/features_ie.cmake +++ b/inference-engine/cmake/features_ie.cmake @@ -109,3 +109,5 @@ ie_option(ENABLE_CLANG_FORMAT "Enable clang-format checks during the build" ON) set(IE_EXTRA_PLUGINS "" CACHE STRING "Extra paths for plugins to include into DLDT build tree") ie_dependent_option(ENABLE_TBB_RELEASE_ONLY "Only Release TBB libraries are linked to the Inference Engine binaries" ON "THREADING MATCHES TBB;LINUX" OFF) + +ie_option (USE_SYSTEM_PUGIXML "use the system copy of pugixml" OFF) diff --git a/inference-engine/thirdparty/CMakeLists.txt b/inference-engine/thirdparty/CMakeLists.txt index a2550bfaa7cbf3..86b0dad79660d9 100644 --- a/inference-engine/thirdparty/CMakeLists.txt +++ b/inference-engine/thirdparty/CMakeLists.txt @@ -55,22 +55,31 @@ function(build_with_lto) set(BUILD_TESTS ${BUILD_TESTS_current} CACHE BOOL "Build tests" FORCE) endfunction() - ie_build_pugixml() + if (USE_SYSTEM_PUGIXML) + find_package(PugiXML REQUIRED) + set_property(TARGET pugixml PROPERTY IMPORTED_GLOBAL TRUE) + else() + ie_build_pugixml() + target_include_directories(pugixml INTERFACE "$") + endif() add_subdirectory(stb_lib) add_subdirectory(ade) add_subdirectory(fluid/modules/gapi) - target_include_directories(pugixml INTERFACE "$") - - set_target_properties(pugixml ade fluid stb_image + set_target_properties(ade fluid stb_image PROPERTIES FOLDER thirdparty) # developer package - ie_developer_export_targets(ade fluid pugixml) - if(TARGET pugixml_mt) - ie_developer_export_targets(pugixml_mt) - set_target_properties(pugixml_mt PROPERTIES FOLDER thirdparty) + ie_developer_export_targets(ade fluid) + + if (NOT USE_SYSTEM_PUGIXML) + set_target_properties(pugixml PROPERTIES FOLDER thirdparty) + ie_developer_export_targets(pugixml) + if(TARGET pugixml_mt) + ie_developer_export_targets(pugixml_mt) + set_target_properties(pugixml_mt PROPERTIES FOLDER thirdparty) + endif() endif() if(ENABLE_MKL_DNN)