aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2021-05-18 13:41:02 +0200
committerEike Ziller <eike.ziller@qt.io>2021-05-18 14:31:36 +0000
commit509e7eb5aabd30808d669add22790806ef5f7de8 (patch)
tree8673a6908e5e4ce8daa54b8568d0e0ef1e80335b
parent287311ed774a86ef9ce053dd42e947cd28b48495 (diff)
CMake: Don't add dummy target if it already is there
For example because the Qt Creator build system created it. Amends 287311ed774a86ef9ce053dd42e947cd28b48495 Change-Id: Ifba330c53d37ab44c9c6b6479dd744f11f89fbef Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
-rw-r--r--CMakeLists.txt8
1 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 441454b10..a2db6949e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,10 +39,14 @@ find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Script)
if (Qt6_FOUND)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat REQUIRED)
- set_property(TARGET Qt6::Core5Compat PROPERTY IMPORTED_GLOBAL TRUE) # hack for CMake < 1.18
- add_library(Qt6Core5Compat ALIAS Qt6::Core5Compat)
+ if(NOT TARGET Qt6Core5Compat)
+ set_property(TARGET Qt6::Core5Compat PROPERTY IMPORTED_GLOBAL TRUE) # hack for CMake < 1.18
+ add_library(Qt6Core5Compat ALIAS Qt6::Core5Compat)
+ endif()
else()
+ if(NOT TARGET Qt6Core5Compat)
add_library(Qt6Core5Compat INTERFACE)
+ endif()
endif()
add_subdirectory(src)