cmake: Generate git-version.cpp in the build dir

This commit is contained in:
orbea 2021-11-29 10:05:13 -08:00
parent 2a9300698e
commit c05c699eaf
2 changed files with 4 additions and 3 deletions

View File

@ -1978,7 +1978,7 @@ add_library(${CoreLibName} ${CoreLinkType}
${CORE_NEON} ${CORE_NEON}
${GPU_SOURCES} ${GPU_SOURCES}
ext/disarm.cpp ext/disarm.cpp
git-version.cpp ${CMAKE_CURRENT_BINARY_DIR}/git-version.cpp
) )
if(ANDROID) if(ANDROID)
@ -2126,10 +2126,11 @@ endif()
add_custom_command(OUTPUT something_that_never_exists add_custom_command(OUTPUT something_that_never_exists
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake
${WIN_VERSION_CMD}) ${WIN_VERSION_CMD})
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cpp set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/git-version.cpp
PROPERTIES GENERATED TRUE PROPERTIES GENERATED TRUE
SKIP_AUTOMOC ON) SKIP_AUTOMOC ON)
add_dependencies(${CoreLibName} GitVersion) add_dependencies(${CoreLibName} GitVersion)

View File

@ -1,4 +1,4 @@
set(GIT_VERSION_FILE "${SOURCE_DIR}/git-version.cpp") set(GIT_VERSION_FILE "${OUTPUT_DIR}/git-version.cpp")
set(GIT_VERSION "unknown") set(GIT_VERSION "unknown")
set(GIT_VERSION_UPDATE "1") set(GIT_VERSION_UPDATE "1")