From 5dcaa11cc26fabc4f4f1336681ac19217a9e0e91 Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Thu, 6 Feb 2020 11:32:48 +0100 Subject: pro2cmake: Honor INSTALL_EXAMPLESDIR if defined When building examples standalone, 'INSTALL_EXAMPLESDIR' may be undefined. The converted .pro files now check whether the variable is set to prevent installation into unexpected locations. Fixes: QTBUG-81797 Change-Id: I9f97568923c8103011a41d9af7cfe02dd1e40b56 Reviewed-by: Alexandru Croitor --- util/cmake/pro2cmake.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'util/cmake/pro2cmake.py') diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 48bb8b7d88..f62d24a15c 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -3287,8 +3287,8 @@ def write_example( example_install_dir = scope.expandString("target.path") if not example_install_dir: - example_install_dir = "examples" - example_install_dir = example_install_dir.replace("$$[QT_INSTALL_EXAMPLES]", "examples") + example_install_dir = "${INSTALL_EXAMPLESDIR}" + example_install_dir = example_install_dir.replace("$$[QT_INSTALL_EXAMPLES]", "${INSTALL_EXAMPLESDIR}") cm_fh.write( "cmake_minimum_required(VERSION 3.14)\n" @@ -3297,6 +3297,9 @@ def write_example( "set(CMAKE_AUTOMOC ON)\n" "set(CMAKE_AUTORCC ON)\n" "set(CMAKE_AUTOUIC ON)\n\n" + "if(NOT DEFINED INSTALL_EXAMPLESDIR)\n" + " set(INSTALL_EXAMPLESDIR \"examples\")\n" + "endif()\n\n" f'set(INSTALL_EXAMPLEDIR "{example_install_dir}")\n\n' ) -- cgit v1.2.3