Skip to content

Commit

Permalink
Switch to one_value_keywords for INCLUDE_COMMIT_PARENTS (TriBITSPub#597)
Browse files Browse the repository at this point in the history
This allows the calling code to be more compact.  Since this function is not
really called by any external users (perhaps ever), this seems like a good
trade-off.
  • Loading branch information
bartlettroscoe committed Jan 24, 2024
1 parent 628b27e commit ce4728b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
8 changes: 4 additions & 4 deletions tribits/core/package_arch/TribitsGitRepoVersionInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ endfunction()
# Usage:
#
# tribits_generate_single_repo_version_string(<gitRepoDir>
# <repoVersionStringOut> INCLUDE_PARENT_COMMITS [ON|OFF])
# <repoVersionStringOut> [INCLUDE_PARENT_COMMITS ON|OFF])
#
# If the optional argument ``INCLUDE_PARENT_COMMITS`` is passed,
# If the optional argument ``INCLUDE_PARENT_COMMITS <val>`` is passed,
# then the head commit's parent(s) info will be be included in
# the repo version output string formatted.
#
Expand All @@ -124,8 +124,8 @@ function(tribits_generate_single_repo_version_string gitRepoDir
)

cmake_parse_arguments( PARSE_ARGV 2
PARSE "INCLUDE_COMMIT_PARENTS" # prefix, optional
"" "" # one_value_keywords, multi_value_keyword
PARSE "" # prefix, optional
"INCLUDE_COMMIT_PARENTS" "" # one_value_keywords, multi_value_keyword
)
tribits_check_for_unparsed_arguments()
tribits_assert_parse_arg_zero_or_one_value(PARSE INCLUDE_COMMIT_PARENTS)
Expand Down
15 changes: 5 additions & 10 deletions tribits/core/package_arch/TribitsGlobalMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1219,14 +1219,9 @@ function(tribits_generate_repo_version_file_string PROJECT_REPO_VERSION_FILE_ST

set(REPO_VERSION_FILE_STR "")

if (${${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS})
tribits_generate_single_repo_version_string(
${CMAKE_CURRENT_SOURCE_DIR}
SINGLE_REPO_VERSION INCLUDE_COMMIT_PARENTS)
else()
tribits_generate_single_repo_version_string(
${CMAKE_CURRENT_SOURCE_DIR} SINGLE_REPO_VERSION)
endif()
tribits_generate_single_repo_version_string(
${CMAKE_CURRENT_SOURCE_DIR} SINGLE_REPO_VERSION
INCLUDE_COMMIT_PARENTS ${${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS})
string(APPEND REPO_VERSION_FILE_STR
"*** Base Git Repo: ${PROJECT_NAME}\n"
"${SINGLE_REPO_VERSION}\n" )
Expand All @@ -1249,8 +1244,8 @@ function(tribits_generate_repo_version_file_string PROJECT_REPO_VERSION_FILE_ST
#print_var(EXTRAREPO_DIR)

tribits_generate_single_repo_version_string(
"${CMAKE_CURRENT_SOURCE_DIR}/${EXTRAREPO_DIR}"
SINGLE_REPO_VERSION)
"${CMAKE_CURRENT_SOURCE_DIR}/${EXTRAREPO_DIR}" SINGLE_REPO_VERSION
INCLUDE_COMMIT_PARENTS ${${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS})
string(APPEND REPO_VERSION_FILE_STR
"*** Git Repo: ${EXTRAREPO_DIR}\n"
"${SINGLE_REPO_VERSION}\n" )
Expand Down

0 comments on commit ce4728b

Please sign in to comment.