Skip to content

Commit

Permalink
export simple libs from OPENCV_LINKER_LIBS (fix opencv#5541)
Browse files Browse the repository at this point in the history
(cherry picked from commit 937a096)
  • Loading branch information
alalek authored and asmorkalov committed Oct 26, 2015
1 parent 2e78a3e commit 60eda6f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmake/OpenCVModule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,10 @@ macro(ocv_create_module)
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS})
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${OPENCV_MODULE_${the_module}_DEPS})
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
set(extra_deps ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
ocv_extract_simple_libs(extra_deps _simple_deps _other_deps)
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${_simple_deps}) # this list goes to "export"
target_link_libraries(${the_module} ${extra_deps})
endif()

add_dependencies(opencv_modules ${the_module})
Expand Down
18 changes: 18 additions & 0 deletions cmake/OpenCVUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -630,3 +630,21 @@ function(ocv_source_group group)
file(GLOB srcs ${OCV_SOURCE_GROUP_GLOB})
source_group(${group} FILES ${srcs})
endfunction()

# build the list of simple dependencies, that links via "-l"
# _all_libs - name of variable with input list
# _simple - name of variable with output list of simple libs
# _other - name of variable with _all_libs - _simple
macro(ocv_extract_simple_libs _all_libs _simple _other)
set(${_simple} "")
set(${_other} "")
foreach(_l ${${_all_libs}})
if(TARGET ${_l})
list(APPEND ${_other} ${_l})
elseif(EXISTS "${_l}")
list(APPEND ${_other} ${_l})
else()
list(APPEND ${_simple} ${_l})
endif()
endforeach()
endmacro()

0 comments on commit 60eda6f

Please sign in to comment.