Skip to content

Commit

Permalink
use regex to detect if returned url ends with .git
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Jun 7, 2021
1 parent 5def5e4 commit 5109a13
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmake/GetLibInfo.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# get lib info from the git cmds
execute_process(COMMAND git config --get remote.origin.url OUTPUT_VARIABLE CMAKE_PROJECT_HOMEPAGE_URL)
string(STRIP CMAKE_PROJECT_HOMEPAGE_URL ${CMAKE_PROJECT_HOMEPAGE_URL})
message("URL = ${CMAKE_PROJECT_HOMEPAGE_URL}")

# use URL to get repo owner as Contact/Maintainer name
string(REGEX REPLACE "^http[s]?://github.com/(.+)/.+\\.git" "\\1" CPACK_PACKAGE_CONTACT "${CMAKE_PROJECT_HOMEPAGE_URL}")
string(REGEX REPLACE "^http[s]?://github.com/(.+)/.+[\\.git]?.*&" "\\1" CPACK_PACKAGE_CONTACT "${CMAKE_PROJECT_HOMEPAGE_URL}")
string(STRIP "${CPACK_PACKAGE_CONTACT}" CPACK_PACKAGE_CONTACT)

# use URL to get the repo name as the Lib Name. Note that we don't use the folder name for this
string(REGEX REPLACE "^http[s]?://github.com/.+/(.+)\\.git" "\\1" LibName "${CMAKE_PROJECT_HOMEPAGE_URL}")
string(REGEX REPLACE "^http[s]?://github.com/.+/(.+)[\\.git]?.*&" "\\1" LibName "${CMAKE_PROJECT_HOMEPAGE_URL}")
string(STRIP "${LibName}" LibName)

# convert the LibName to lower case
Expand Down

0 comments on commit 5109a13

Please # to comment.