@@ -9,6 +9,8 @@ set(CMAKE_CXX_STANDARD 11)
99
1010option (RUNCPP2_UPDATE_DEFAULT_YAMLS "Update default yaml files" OFF )
1111
12+ set (RUNCPP2_CONFIG_VERSION "1" CACHE STRING "Default Config Version" )
13+
1214if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR )
1315 option (RUNCPP2_WARNINGS_AS_ERRORS "Treat warnings as errors" ON )
1416 option (RUNCPP2_BUILD_TESTS "Build runcpp2 tests" ON )
@@ -55,17 +57,18 @@ function(get_version_from_git OUTPUT_VARIABLE)
5557 )
5658
5759 if (TAG_ON_COMMIT EQUAL 0)
58- set (VERSION ${GIT_TAG} )
60+ set (VERSION " ${GIT_TAG} " )
5961 else ()
6062 set (VERSION "${GIT_TAG} -${GIT_COMMIT_HASH} " )
6163 endif ()
6264 else ()
6365 # No tags found, use v0.0.0 with commit hash
6466 # set(VERSION "v0.0.0-${GIT_COMMIT_HASH}")
67+
6568 message (FATAL_ERROR "Failed to get tag: ${GIT_TAG} " )
6669 endif ()
6770
68- set (${OUTPUT_VARIABLE} ${VERSION} PARENT_SCOPE)
71+ set (${OUTPUT_VARIABLE} " ${VERSION} " PARENT_SCOPE)
6972endfunction ()
7073
7174# Call the function and store the result
@@ -211,8 +214,9 @@ endif()
211214
212215target_compile_options (runcpp2 PRIVATE "${RUNCPP2_STANDARD_COMPILE_FLAGS} " )
213216
214- # Define the version macro
215- target_compile_definitions (runcpp2 PUBLIC RUNCPP2_VERSION="${RUNCPP2_PROJECT_VERSION} " )
217+ # Define the runcpp2 and default config version macro
218+ target_compile_definitions (runcpp2 PUBLIC RUNCPP2_VERSION="${RUNCPP2_PROJECT_VERSION} "
219+ RUNCPP2_CONFIG_VERSION=${RUNCPP2_CONFIG_VERSION} )
216220
217221# =========================================================================
218222# runcpp2 executable
@@ -233,6 +237,7 @@ target_link_libraries(runcpp2_override PRIVATE ${RUNCPP2_PRIVATE_LINK_LIBS})
233237target_link_libraries (runcpp2_override PUBLIC ${RUNCPP2_PUBLIC_LINK_LIBS} )
234238target_compile_options (runcpp2_override PRIVATE "${RUNCPP2_STANDARD_COMPILE_FLAGS} " )
235239target_compile_definitions (runcpp2_override PUBLIC RUNCPP2_VERSION="${RUNCPP2_PROJECT_VERSION} "
240+ RUNCPP2_CONFIG_VERSION=${RUNCPP2_CONFIG_VERSION}
236241 INTERNAL_RUNCPP2_UNIT_TESTS=1)
237242if (RUNCPP2_BUILD_TESTS)
238243 add_subdirectory ("${CMAKE_CURRENT_LIST_DIR} /Src/Tests" )
0 commit comments