Skip to content

Commit

Permalink
Generate valid visibility macros by avoiding hyphens (#135)
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Luis Rivero <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
j-rivero authored Dec 30, 2020
1 parent aaf3435 commit 07b793f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmake/IgnUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,8 @@ function(ign_add_component component_name)
# Create an upper case version of the component name, to be used as an export
# base name.
string(TOUPPER ${component_name} component_name_upper)
# hyphen is not supported as macro name, replace it by underscore
string(REPLACE "-" "_" component_name_upper ${component_name_upper})

#------------------------------------
# Create the target for this component, and configure it to be installed
Expand Down Expand Up @@ -1349,6 +1351,14 @@ macro(_ign_add_library_or_component)
_ign_add_library_or_component_arg_error(EXPORT_BASE)
endif()

# check that export_base has no invalid symbols
string(REPLACE "-" "_" export_base_replaced ${export_base})
if(NOT ${export_base} STREQUAL ${export_base_replaced})
message(FATAL_ERROR
"export_base has a hyphen which is not"
"supported by macros used for visibility")
endif()

#------------------------------------
# Create the library target

Expand Down

0 comments on commit 07b793f

Please sign in to comment.