-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12885af
commit 3bc1f4e
Showing
2 changed files
with
315 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# SPDX-License-Identifier: MIT | ||
if(NOT PRODUCT_NAME OR NOT BUILD_VERSION OR NOT SEARCH_PATHS) | ||
message(FATAL_ERROR "PRODUCT_NAME, BUILD_VERSION and SEARCH_PATHS are required") | ||
endif() | ||
|
||
if(BUILD_VERSION MATCHES "^([0-9]+)\.([0-9]+)\.([0-9]+)") | ||
set(server "${CMAKE_MATCH_1}") | ||
set(major "${CMAKE_MATCH_2}") | ||
set(minor "${CMAKE_MATCH_3}") | ||
|
||
if(version MATCHES "-beta\.([0-9]+)") | ||
set(beta "${CMAKE_MATCH_1}") | ||
else() | ||
set(beta 0) | ||
endif() | ||
|
||
set(PRODUCT_VERSION "${server}.${major}.${minor}.${beta}") | ||
else() | ||
message(FATAL_ERROR "Unable to determine product version from '${BUILD_VERSION}'") | ||
endif() | ||
|
||
find_program(RCEDIT_COMMAND rcedit REQUIRED) | ||
|
||
unset(globs) | ||
foreach(search_path IN LISTS SEARCH_PATHS) | ||
list(APPEND globs "${search_path}/*.dll" "${search_path}/*.exe") | ||
endforeach() | ||
|
||
message(STATUS "Looking for PE files: ${globs}") | ||
file(GLOB_RECURSE pe_paths FOLLOW_SYMLINKS ${globs}) | ||
foreach(pe_path IN LISTS pe_paths) | ||
execute_process( | ||
COMMAND | ||
${RCEDIT_COMMAND} | ||
"${pe_path}" | ||
--set-version-string ProductName "${PRODUCT_NAME}" | ||
--set-version-string ProductVersion "${PRODUCT_VERSION}" | ||
COMMAND_ECHO STDOUT | ||
COMMAND_ERROR_IS_FATAL ANY | ||
) | ||
endforeach() |
Oops, something went wrong.