Move git info in CMake to loader_common_options
authorCharles Giessen <charles@lunarg.com>
Wed, 3 Nov 2021 20:09:50 +0000 (14:09 -0600)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Wed, 9 Mar 2022 22:06:30 +0000 (15:06 -0700)
Make the GIT_BRANCH_NAME and GIT_TAG_INFO apart of the loader_common_options
target so it doesn't apply globally to the C_FLAGS and CXX_FLAGS.
Note that this commit is a part of a series of commits and is not meant to
work by itself.

CMakeLists.txt
loader/CMakeLists.txt

index 03fc7c9a50c7e2f87cf696825e9edb783e3ddf4c..bfe08902d83f0af130e4186578345e4471614513 100644 (file)
@@ -322,6 +322,10 @@ if(MSVC)
     string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
 endif()
 
+# DEBUG enables runtime loader ICD verification
+# Add git branch and tag info in debug mode
+target_compile_definitions(loader_common_options INTERFACE $<$<CONFIG:DEBUG>:DEBUG;GIT_BRANCH_NAME=${GIT_BRANCH_NAME};GIT_TAG_INFO=${GIT_TAG_INFO}>)
+
 # Optional codegen target
 if(PYTHONINTERP_FOUND)
     add_custom_target(VulkanLoader_generated_source
index 9621840b4a360954a1dcbe9990b67d88a4ad1c08..6c31a4a1528356c6edb23cd8e5caa60610c6a657 100644 (file)
@@ -43,12 +43,6 @@ if(WIN32)
     endif()
 endif()
 
-# DEBUG enables runtime loader ICD verification
-set(CMAKE_C_FLAGS_DEBUG
-        "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -DGIT_BRANCH_NAME=${GIT_BRANCH_NAME} -DGIT_TAG_INFO=${GIT_TAG_INFO}")
-set(CMAKE_CXX_FLAGS_DEBUG
-        "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DGIT_BRANCH_NAME=${GIT_BRANCH_NAME} -DGIT_TAG_INFO=${GIT_TAG_INFO}")
-
 if(WIN32)
     if(MSVC)
     # Use static MSVCRT libraries