From 59067d41e5a6265fef4547e0045edf8d276c0f38 Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Tue, 31 Jan 2023 07:57:06 -0500 Subject: [PATCH] Use raw literal string to avoid having to escape characters in git commit 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 * Prefer cxx_raw_string_literals compile feature to setting CMAKE_CXX_STANDARD --------- Co-authored-by: Phil Miller --- cmake/Kokkos_Version_Info.cpp.in | 11 ++++++----- cmake/build_env_info.cmake | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cmake/Kokkos_Version_Info.cpp.in b/cmake/Kokkos_Version_Info.cpp.in index e9fabe8177..3665282e7b 100644 --- a/cmake/Kokkos_Version_Info.cpp.in +++ b/cmake/Kokkos_Version_Info.cpp.in @@ -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 diff --git a/cmake/build_env_info.cmake b/cmake/build_env_info.cmake index 2cd169cba4..0eeb637245 100644 --- a/cmake/build_env_info.cmake +++ b/cmake/build_env_info.cmake @@ -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()