Skip to content

Commit

Permalink
Fix imported location target property when target contains dashes and…
Browse files Browse the repository at this point in the history
… CORROSION_RESPECT_OUTPUT_DIRECTORY is true

The regex to determine the name of the actual library target tries to
strip the -static or -shared suffix did not allow for dashes in the
name. Since the regexp closes with a $, the suffix should only match at
the very end and we can allow any character before the last dash.

Fixes #321
  • Loading branch information
tronical authored and jschwe committed Feb 17, 2023
1 parent d605f2c commit 67232bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/Corrosion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ endfunction()
function(_corrosion_set_imported_location_deferred target_name base_property output_directory_property filename)
# The output directory property is expected to be set on the exposed target (without postfix),
# but we need to set the imported location on the actual library target with postfix.
if("${target_name}" MATCHES "^([^-]+)-(static|shared)$")
if("${target_name}" MATCHES "^(.+)-(static|shared)$")
set(output_dir_prop_target_name "${CMAKE_MATCH_1}")
else()
set(output_dir_prop_target_name "${target_name}")
Expand Down

0 comments on commit 67232bc

Please sign in to comment.