Fixed c samples build (#2278)

* Fixed c samples build

fixed CVS-38816 - Failure to build samples in C

* Fixed issue with gflags
This commit is contained in:
Mikhail Ryzhov 2020-09-17 13:51:23 +03:00 committed by GitHub
parent 383152db28
commit dbf8fbf9c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 2 deletions

View File

@ -145,6 +145,8 @@ endif()
# exactly the same OpenCV_DIR path which was used for the InferenceEngine build
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/format_reader")
add_subdirectory(common/format_reader)
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/opencv_c_wraper")
add_subdirectory(common/opencv_c_wraper)
endif()
# samples build can be switched off during whole IE build
@ -216,6 +218,7 @@ macro(ie_add_sample)
set(folder_name cpp_samples)
if(IE_SAMPLE_NAME MATCHES ".*_c$")
set(c_sample ON)
set(folder_name c_samples)
endif()
@ -228,7 +231,11 @@ macro(ie_add_sample)
target_include_directories(${IE_SAMPLE_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../common")
target_link_libraries(${IE_SAMPLE_NAME} PRIVATE ${OpenCV_LIBRARIES} ${InferenceEngine_LIBRARIES}
${IE_SAMPLE_DEPENDENCIES} gflags)
${IE_SAMPLE_DEPENDENCIES})
if(NOT c_sample)
target_link_libraries(${IE_SAMPLE_NAME} PRIVATE gflags)
endif()
# create global target with all samples / demo apps
if(NOT TARGET ie_samples)
@ -237,7 +244,7 @@ macro(ie_add_sample)
add_dependencies(ie_samples ${IE_SAMPLE_NAME})
if(COMMAND add_cpplint_target AND NOT IE_SAMPLE_EXCLUDE_CPPLINT)
if(folder_name STREQUAL "c_samples")
if(c_sample)
set(custom_filters "-readability/casting")
endif()
add_cpplint_target(${IE_SAMPLE_NAME}_cpplint FOR_TARGETS ${IE_SAMPLE_NAME}