blob: 3d6d376b60f43d28a0b71786d22ebe92e652780e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#
# Generate uncrustify_version.h from uncrustify_version.h.in
#
# This script is meant to be executed with `cmake -P` from a custom target,
# and expects the variables `PYTHON_EXECUTABLE`, `SOURCE_DIR`, `INPUT`,
# `OUTPUT` and `UNCRUSTIFY_VERSION` to be set.
#
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${SOURCE_DIR}/scripts/make_version.py
WORKING_DIRECTORY ${SOURCE_DIR}
RESULT_VARIABLE make_version_error
OUTPUT_VARIABLE make_version_output
)
if (make_version_error)
# It's normal for make_version.py to fail when building from a tarball, so we
# want to avoid anything that looks too much like a scary error. Thus, report
# the error in an innocuous-looking fashion.
#
# If make_version.py is failing unexpectedly and needs to be debugged,
# uncomment the next few lines.
# string(STRIP "${make_version_output}" make_version_output)
# message(STATUS
# "scripts/make_version.py exited with code ${make_version_error}: "
# "${make_version_output}")
message(STATUS
"Unable to determine version from source tree; "
"fallback version '${UNCRUSTIFY_VERSION}' will be used")
message(STATUS
"(This is normal if you are building from a zip / tarball)")
else()
string(STRIP ${make_version_output} UNCRUSTIFY_VERSION)
message(STATUS "Version: '${UNCRUSTIFY_VERSION}'")
endif()
configure_file("${INPUT}" "${OUTPUT}" @ONLY)
|