From 1cb6ce6057f751d927e64e191072da0a96c8cb5b Mon Sep 17 00:00:00 2001 From: OatmealDome Date: Sun, 21 Apr 2024 13:24:58 -0400 Subject: [PATCH] ScmRevGen: Refactor file configuration into a function --- CMake/ScmRevGen.cmake | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/CMake/ScmRevGen.cmake b/CMake/ScmRevGen.cmake index 5ec3041134..928e9ac4e0 100644 --- a/CMake/ScmRevGen.cmake +++ b/CMake/ScmRevGen.cmake @@ -42,11 +42,15 @@ if(NOT DOLPHIN_WC_REVISION) set(DOLPHIN_WC_COMMITS_AHEAD_MASTER 0) endif() -configure_file( - "${PROJECT_SOURCE_DIR}/Source/Core/Common/scmrev.h.in" - "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h.tmp" -) +function(configure_source_file path) + configure_file( + "${PROJECT_SOURCE_DIR}/${path}.in" + "${PROJECT_BINARY_DIR}/${path}.tmp" + ) -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h.tmp" "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h") + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_BINARY_DIR}/${path}.tmp" "${PROJECT_BINARY_DIR}/${path}") -file(REMOVE "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h.tmp") + file(REMOVE "${PROJECT_BINARY_DIR}/${path}.tmp") +endfunction() + +configure_source_file("Source/Core/Common/scmrev.h")