Skip to content

Commit

Permalink
Support project names starting with gz- (#246)
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters authored May 4, 2022
1 parent 33492e4 commit 7d95a11
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmake/IgnConfigureProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,15 @@ macro(ign_configure_project)
# Extract the designation
#============================================================================
set(IGN_DESIGNATION ${PROJECT_NAME})
# Remove the leading "ignition-"
string(REGEX REPLACE "ignition-" "" IGN_DESIGNATION ${IGN_DESIGNATION})
# Remove the leading project prefix ("gz-" by default)
set(PROJECT_PREFIX "gz")
# Also support "ignition-"
# TODO: remove this `if` block once all package names start with gz
if(${IGN_DESIGNATION} MATCHES "^ignition-")
set(PROJECT_PREFIX "ignition")
endif()
string(REGEX REPLACE "${PROJECT_PREFIX}-" "" IGN_DESIGNATION ${IGN_DESIGNATION})

# Remove the trailing version number
string(REGEX REPLACE "[0-9]+" "" IGN_DESIGNATION ${IGN_DESIGNATION})

Expand All @@ -68,7 +75,7 @@ macro(ign_configure_project)
if(ign_configure_project_NO_IGNITION_PREFIX)
set(PROJECT_NAME_NO_VERSION ${IGN_DESIGNATION})
else()
set(PROJECT_NAME_NO_VERSION "ignition-${IGN_DESIGNATION}")
set(PROJECT_NAME_NO_VERSION "${PROJECT_PREFIX}-${IGN_DESIGNATION}")
endif()
string(TOLOWER ${PROJECT_NAME_NO_VERSION} PROJECT_NAME_NO_VERSION_LOWER)
string(TOUPPER ${PROJECT_NAME_NO_VERSION} PROJECT_NAME_NO_VERSION_UPPER)
Expand Down

0 comments on commit 7d95a11

Please sign in to comment.