Skip to content

Commit

Permalink
Merge pull request #15257 from tamiko/fix_shell_escape
Browse files Browse the repository at this point in the history
CMake: also escape linker flags of the form -Wl,-rpath -Wl,/path/
  • Loading branch information
marcfehling committed May 23, 2023
2 parents 5961f50 + 7f927a8 commit 06d48f6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmake/macros/macro_shell_escape_option_groups.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,14 @@ macro(shell_escape_option_groups _variable)
"SHELL:(-Xcudafe [^;]+|-Xlinker [^;]+);SHELL:(-Xcudafe [^;]+|-Xlinker [^;]+)"
"SHELL:\\1 \\2" ${_variable} "${${_variable}}"
)

#
# In addition try to merge options of the form "-Wl,-flag -Wl,/path". We
# do this by detecting all occurences of a flag ("-Wl,-[-]flag") followed
# by an option that doesn't start with a dash ("-Wl,[option]"):
#
string(REGEX REPLACE
"(-Wl,[-]+[^;]*);(-Wl,[^-][^;]+)"
"SHELL:\\1 \\2" ${_variable} "${${_variable}}"
)
endmacro()

0 comments on commit 06d48f6

Please sign in to comment.