mirror of
https://github.com/Z3Prover/z3
synced 2025-05-08 08:15:47 +00:00
Fix how the list of linker flags `Z3_DEPENDENT_EXTRA_CXX_LINK_FLAGS
`
is applied to targets. The ``LINK_FLAGS`` property of a target is a string and not a list and so if ``Z3_DEPENDENT_EXTRA_CXX_LINK_FLAGS`` contained more than one flag the linker line would end up being ``-flag1;flag2;flag3;...`` which would not work. Now we use a new function ``z3_append_linker_flag_list_to_target()`` to iterate through the list and update the ``LINK_FLAGS`` property of the specified target correctly.
This commit is contained in:
parent
a2cc6d256a
commit
29901e79e1
5 changed files with 23 additions and 7 deletions
|
@ -0,0 +1,17 @@
|
|||
# The LINK_FLAGS property of a target in CMake is unfortunately a string and
|
||||
# not a list. This function takes a list of linker flags and iterates through
|
||||
# them to append them as strings to the ``LINK_FLAGS`` property of
|
||||
# the specified target.
|
||||
# E.g.
|
||||
# z3_append_linker_flag_list_to_target(mytarget "-fopenmp" "-static")
|
||||
function(z3_append_linker_flag_list_to_target target)
|
||||
if (NOT (TARGET "${target}"))
|
||||
message(FATAL_ERROR "Specified target \"${target}\" is not a target")
|
||||
endif()
|
||||
foreach(flag ${ARGN})
|
||||
#message(STATUS "Appending link flag \"${flag}\" to target ${target}")
|
||||
# Note that space inside the quoted string is required so that the flags
|
||||
# are space separated.
|
||||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${flag}")
|
||||
endforeach()
|
||||
endfunction()
|
Loading…
Add table
Add a link
Reference in a new issue