mirror of
https://github.com/gbdev/rgbds.git
synced 2026-03-25 06:13:03 +00:00
Harmonise passing build version
Avoid running some configure step, instead pass it as a define like the Makefile
This commit is contained in:
2
src/.gitignore
vendored
2
src/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
# Generated by CMake
|
|
||||||
/.version.cpp
|
|
||||||
@@ -9,8 +9,9 @@ add_library(common OBJECT
|
|||||||
"style.cpp"
|
"style.cpp"
|
||||||
"usage.cpp"
|
"usage.cpp"
|
||||||
"util.cpp"
|
"util.cpp"
|
||||||
"_version.cpp"
|
"version.cpp"
|
||||||
)
|
)
|
||||||
|
target_compile_definitions(common PRIVATE "BUILD_VERSION_STRING=\"${GIT_REV}\"")
|
||||||
|
|
||||||
find_package(BISON 3.0.0 REQUIRED)
|
find_package(BISON 3.0.0 REQUIRED)
|
||||||
set(BISON_FLAGS "-Wall -Dlr.type=ielr")
|
set(BISON_FLAGS "-Wall -Dlr.type=ielr")
|
||||||
|
|||||||
@@ -25,13 +25,6 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This variable is passed via `-D` from the Makefile, but not from CMake
|
|
||||||
// (in which `configure_file()` is used on this file to replace some syntax)
|
|
||||||
#ifndef BUILD_VERSION_STRING
|
|
||||||
// CMake-specific syntax here
|
|
||||||
#define BUILD_VERSION_STRING "@GIT_REV@"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char const *get_package_version_string() {
|
char const *get_package_version_string() {
|
||||||
if constexpr (literal_strlen(BUILD_VERSION_STRING) > 0) {
|
if constexpr (literal_strlen(BUILD_VERSION_STRING) > 0) {
|
||||||
return BUILD_VERSION_STRING;
|
return BUILD_VERSION_STRING;
|
||||||
|
|||||||
Reference in New Issue
Block a user