-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
ocv_target_link_libraries could not handle the keyword rightly #20430
Copy link
Copy link
Closed
Milestone
Description
System information (version)
- OpenCV => 4.5.2
- Operating System / Platform => CentOS 7.5.1
- Compiler => gcc
Detailed description
I am porting OpenCV-4.5.2 to another OS, and the compiler does not support rpath. So transitively propagates to dependents is a simple way to solve the depends question, but ocv_target_link_libraries doesn't work. After looking into this function, I found a little bug with logic.
Steps to reproduce
if I write code like below:
ocv_target_link_libraries (target PUBLIC lib1 PRIVATE lib2) ----> the keyword PUBLIC does not work.
function(ocv_target_link_libraries target)
set(LINK_DEPS ${ARGN})
_ocv_fix_target(target)
set(LINK_MODE "PRIVATE")
set(LINK_PENDING "")
foreach(dep ${LINK_DEPS})
if(" ${dep}" STREQUAL " ${target}")
# prevent "link to itself" warning (world problem)
elseif(" ${dep}" STREQUAL " LINK_PRIVATE" OR " ${dep}" STREQUAL " LINK_PUBLIC" # deprecated
OR " ${dep}" STREQUAL " PRIVATE" OR " ${dep}" STREQUAL " PUBLIC" OR " ${dep}" STREQUAL " INTERFACE"
)
if(NOT LINK_PENDING STREQUAL "") -------------> if PUBLIC is the first word after target, the program is out of this branch, so the keyword PUBLIC is missed.
__ocv_push_target_link_libraries(${LINK_MODE} ${LINK_PENDING})
set(LINK_PENDING "")
set(LINK_MODE "${dep}") --------------------> if I move this line out of branch, this function work well.
endif()
else()
if it is a bug, I would like to fix it.
Reactions are currently unavailable