Skip to content

Commit

Permalink
build: do not break transitive linking when being used as a subproject
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Dubtsov committed Mar 12, 2019
1 parent 9670998 commit 245b331
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ macro(append_to_windows_path_list path_list path)
endif()
endmacro()

function(target_link_libraries_private target list)
function(target_link_libraries_build target list)
# Foreach is required for compatibility with 2.8.11 ways
foreach(lib ${list})
target_link_libraries(${target} LINK_PRIVATE
target_link_libraries(${target}
"$<BUILD_INTERFACE:${lib}>")
endforeach(lib)
endfunction()

function(target_link_libraries_public target list)
function(target_link_libraries_install target list)
# Foreach is required for compatibility with 2.8.11 ways
foreach(lib ${list})
get_filename_component(base "${lib}" NAME)
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ target_include_directories(${LIB_NAME} PUBLIC
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>
)

target_link_libraries_private(${LIB_NAME}
target_link_libraries_build(${LIB_NAME}
"${EXTRA_SHARED_LIBS};${EXTRA_STATIC_LIBS}")
target_link_libraries_public(${LIB_NAME} "${EXTRA_SHARED_LIBS}")
target_link_libraries_install(${LIB_NAME} "${EXTRA_SHARED_LIBS}")
if(MKLDNN_LIBRARY_TYPE STREQUAL "STATIC")
target_link_libraries_public(${LIB_NAME} "${EXTRA_STATIC_LIBS}")
target_link_libraries_install(${LIB_NAME} "${EXTRA_STATIC_LIBS}")
endif()

set(LIB_EXPORT_NAME "${LIB_NAME}-targets")
Expand Down

0 comments on commit 245b331

Please sign in to comment.