Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,21 @@ endif()
######################################
# EXTRACT VERSION
######################################
if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/_version.h")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_version.h" "static char sccsid[] __attribute__((used)) = \"@(#)Version 42.42.42.42424 @Commit: AAA\";\n")
endif()
if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/runtime_version.h")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/runtime_version.h"
"#define RuntimeFileMajorVersion 42\n"
"#define RuntimeFileMinorVersion 42\n"
"#define RuntimeFileBuildVersion 42\n"
"#define RuntimeFileRevisionVersion 42424\n"
"#define RuntimeProductMajorVersion 6\n"
"#define RuntimeProductMinorVersion 0\n"
"#define RuntimeProductPatchVersion 0\n"
)
endif()
Copy link
Member

@akoeplinger akoeplinger Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of writing to these unused header files and reading them back I'd rather do

if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/_version.h" AND NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/runtime_version.h")
  set(VERSION "\"42.42.42.0\"")
  set(FULL_VERSION "42.42.42.42424")
else()
  ... existing code ...
endif()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runtime-version.h is included in some eventpipe files.


if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/_version.h" product_version_string_line REGEX "VER_PRODUCTVERSION_STR ")
string(REGEX REPLACE ".*VER_PRODUCTVERSION_STR *(.*)" "\\1" product_version_string ${product_version_string_line})
Expand Down