Use -Bstatic compiler option rather than find_library
This commit is contained in:
parent
8e0b71c049
commit
8e0b1aa26c
1 changed files with 4 additions and 8 deletions
|
|
@ -16,17 +16,13 @@ function(target_link_static_libraries target_name)
|
|||
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
|
||||
set(writing_now ${entry})
|
||||
else()
|
||||
find_library(static_lib_${entry} lib${entry}.a)
|
||||
set(full_path "${static_lib_${entry}}")
|
||||
if (${full_path} STREQUAL static_lib_${entry}-NOTFOUND)
|
||||
message(FATAL_ERROR "Could not find static library lib${entry}.a")
|
||||
endif()
|
||||
set(link_option "-Wl,--push-state,-Bstatic,-l${entry},--pop-state")
|
||||
if ("${writing_now}" STREQUAL "PRIVATE")
|
||||
list(APPEND private_libs ${full_path})
|
||||
list(APPEND private_libs ${link_option})
|
||||
elseif ("${writing_now}" STREQUAL "PUBLIC")
|
||||
list(APPEND public_libs ${full_path})
|
||||
list(APPEND public_libs ${link_option})
|
||||
elseif ("${writing_now}" STREQUAL "INTERFACE")
|
||||
list(APPEND interface_libs ${full_path})
|
||||
list(APPEND interface_libs ${link_option})
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown frameworks scope for target ${target_name}")
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue