Skip to content

Commit

Permalink
Use raw literal string to avoid having to escape characters in git co…
Browse files Browse the repository at this point in the history
…mmit message (#5823)

* Use raw literal string to avoid having to escape characters (such as ") in git commit message

* Fixup cxx standard for library with the git info

* Use raw literal string got git branch as well

Co-Authored-By: Phil Miller <[email protected]>

* Prefer cxx_raw_string_literals compile feature to setting CMAKE_CXX_STANDARD

---------

Co-authored-by: Phil Miller <[email protected]>
  • Loading branch information
dalg24 and PhilMiller authored Jan 31, 2023
1 parent 333157f commit 59067d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmake/Kokkos_Version_Info.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
namespace Kokkos {
namespace Impl {

std::string GIT_BRANCH = "@GIT_BRANCH@";
std::string GIT_COMMIT_HASH = "@GIT_COMMIT_HASH@";
std::string GIT_CLEAN_STATUS = "@GIT_CLEAN_STATUS@";
std::string GIT_COMMIT_DESCRIPTION = "@GIT_COMMIT_DESCRIPTION@";
std::string GIT_COMMIT_DATE = "@GIT_COMMIT_DATE@";
std::string GIT_BRANCH = R"branch(@GIT_BRANCH@)branch";
std::string GIT_COMMIT_HASH = "@GIT_COMMIT_HASH@";
std::string GIT_CLEAN_STATUS = "@GIT_CLEAN_STATUS@";
std::string GIT_COMMIT_DESCRIPTION =
R"message(@GIT_COMMIT_DESCRIPTION@)message";
std::string GIT_COMMIT_DATE = "@GIT_COMMIT_DATE@";

} // namespace Impl

Expand Down
1 change: 1 addition & 0 deletions cmake/build_env_info.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ FUNCTION(check_git_setup)

add_library(impl_git_version ${CMAKE_BINARY_DIR}/generated/Kokkos_Version_Info.cpp)
target_include_directories(impl_git_version PUBLIC ${CMAKE_BINARY_DIR}/generated)
target_compile_features(impl_git_version PRIVATE cxx_raw_string_literals)
add_dependencies(impl_git_version AlwaysCheckGit)

check_git_version()
Expand Down

0 comments on commit 59067d4

Please sign in to comment.