summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Maltese <michaeljosephmaltese@gmail.com>2017-02-05 22:26:44 -0800
committerMichael Maltese <michaeljosephmaltese@gmail.com>2017-02-05 22:26:49 -0800
commitacc8dae2b33c24ffe6ff445b7ba387c82af10aa2 (patch)
tree2b5a4f303802b2ced244705059daecd2e47b1628
parentb9fc79020d16e264b8b5215c801a828f32c93cbc (diff)
CMake: use configure_file to generate scmrev.h
The built-in `configure_file` command correctly handles the case where none of the variables change and scmrev.h doesn't need to be rebuilt. This saves a full re-link of Dolphin any time CMake is re-run.
-rw-r--r--CMakeLists.txt11
-rw-r--r--Source/Core/Common/scmrev.h.in5
2 files changed, 9 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7090cea516..25ad0a3584 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -941,13 +941,10 @@ else()
set(DOLPHIN_WC_IS_STABLE "0")
endif()
-file(WRITE ${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h
- "#define SCM_REV_STR \"" ${DOLPHIN_WC_REVISION} "\"\n"
- "#define SCM_DESC_STR \"" ${DOLPHIN_WC_DESCRIBE} "\"\n"
- "#define SCM_BRANCH_STR \"" ${DOLPHIN_WC_BRANCH} "\"\n"
- "#define SCM_IS_MASTER " ${DOLPHIN_WC_IS_STABLE} "\n"
- "#define SCM_DISTRIBUTOR_STR \"" ${DISTRIBUTOR} "\"\n"
- )
+configure_file(
+ "${PROJECT_SOURCE_DIR}/Source/Core/Common/scmrev.h.in"
+ "${PROJECT_BINARY_DIR}/Source/Core/Common/scmrev.h"
+)
include_directories("${PROJECT_BINARY_DIR}/Source/Core")
########################################
diff --git a/Source/Core/Common/scmrev.h.in b/Source/Core/Common/scmrev.h.in
new file mode 100644
index 0000000000..6be4c461bb
--- /dev/null
+++ b/Source/Core/Common/scmrev.h.in
@@ -0,0 +1,5 @@
+#define SCM_REV_STR "${DOLPHIN_WC_REVISION}"
+#define SCM_DESC_STR "${DOLPHIN_WC_DESCRIBE}"
+#define SCM_BRANCH_STR "${DOLPHIN_WC_BRANCH}"
+#define SCM_IS_MASTER ${DOLPHIN_WC_IS_STABLE}
+#define SCM_DISTRIBUTOR_STR "${DISTRIBUTOR}"