diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2023-10-26 16:57:36 +0200 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2023-11-17 22:27:01 +0100 |
commit | f1a9b04f8253c5a3d3bfc4ae8f2a3ec3a0187ba5 (patch) | |
tree | ce09a584b94cd446007faea4d96c109928a58137 /cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt | |
parent | 9f3d6e325f48ad41766f16b33ac2543e09b800fe (diff) |
Use the standalone test directory name as the project name
Using this trick we force CMake xcode generator to give the more
specific project name when configuring standalone tests.
Change-Id: Ic679003c574c0407bdc8df9eecf3762db214fd50
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt')
-rw-r--r-- | cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt b/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt index 09c4dad4bb..766e372666 100644 --- a/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt +++ b/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt @@ -2,11 +2,6 @@ # SPDX-License-Identifier: BSD-3-Clause cmake_minimum_required(VERSION 3.16) -project(qt_single_test VERSION 6.0.0 LANGUAGES C CXX ASM) - -find_package(Qt6 REQUIRED COMPONENTS BuildInternals Core) - -include(${CMAKE_CURRENT_LIST_DIR}/Main.cmake NO_POLICY_SCOPE) # Get the absolute path of the passed-in project dir, relative to the current working directory # of the calling script, rather than relative to this source directory. @@ -30,5 +25,14 @@ if(NOT IS_DIRECTORY "${absolute_project_path}") endif() endif() +# Get the project name base on test directory name +get_filename_component(project_name "${absolute_project_path}" NAME) + +project(${project_name} VERSION 6.0.0 LANGUAGES C CXX ASM) + +find_package(Qt6 REQUIRED COMPONENTS BuildInternals Core) + +include(${CMAKE_CURRENT_LIST_DIR}/Main.cmake NO_POLICY_SCOPE) + # Add the test project path as a subdirectory project. add_subdirectory("${absolute_project_path}" "build_dir") |