pro2cmake: Set a project version for examples
For example projects, change the generated project() call to project(foo VERSION 1.0 LANGUAGES CXX) Some CMake API derives default values from the project version, and it's generally advisable to set a project version number. The version number is read from qmake's VERSION variable. That's actually a target version number, but it might be the right thing in most cases. Fall back to version 1.0 if VERSION is not set. Task-number: QTBUG-96799 Change-Id: Ia0c551cf62621eb217e1dd541dcbd8945f78138e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
2389aaf8c7
commit
dece6f17e6
@ -3795,9 +3795,10 @@ def write_example(
|
||||
"$$[QT_INSTALL_EXAMPLES]", "${INSTALL_EXAMPLESDIR}"
|
||||
)
|
||||
|
||||
project_version = scope.get_string("VERSION", "1.0")
|
||||
cm_fh.write(
|
||||
f"cmake_minimum_required(VERSION {cmake_version_string})\n"
|
||||
f"project({binary_name} LANGUAGES CXX)\n\n"
|
||||
f"project({binary_name} VERSION {project_version} LANGUAGES CXX)\n\n"
|
||||
"set(CMAKE_INCLUDE_CURRENT_DIR ON)\n\n"
|
||||
"set(CMAKE_AUTOMOC ON)\n"
|
||||
"set(CMAKE_AUTOUIC ON)\n\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user