summaryrefslogtreecommitdiff
path: root/Source/QtDialog/CMakeLists.txt
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2022-08-21 05:10:11 +0400
committerBrad King <brad.king@kitware.com>2022-09-22 09:24:47 -0400
commit4ff86046048882487d582cf463ce49b0f708223c (patch)
tree23209b8f2fa81b67446902c2e37b77b5c3d612e0 /Source/QtDialog/CMakeLists.txt
parent0aed435b351577681a7cbbd8c542fbe998d1717d (diff)
downloadcmake-4ff86046048882487d582cf463ce49b0f708223c.tar.gz
Build: Do not use variables for sources lists
Instead use `add_library()` with unconditionally compiled sources and conditional `target_sources()` with extra sources to compile.
Diffstat (limited to 'Source/QtDialog/CMakeLists.txt')
-rw-r--r--Source/QtDialog/CMakeLists.txt31
1 files changed, 20 insertions, 11 deletions
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index a635200f01..4f56919183 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -152,7 +152,10 @@ if(APPLE)
get_filename_component(Qt_BIN_DIR "${Qt_BIN_DIR}" PATH)
endif()
-set(SRCS
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+add_library(
+ CMakeGUILib STATIC
AddCacheEntry.cxx
AddCacheEntry.h
CMakeSetupDialog.cxx
@@ -179,6 +182,16 @@ set(SRCS
WarningMessagesDialog.cxx
WarningMessagesDialog.h
)
+# CMake_QT_EXTRA_LIBRARIES have to come before the main libraries on the link line
+target_link_libraries(
+ CMakeGUILib
+ PUBLIC
+ CMakeLib
+ ${CMake_QT_EXTRA_LIBRARIES}
+ Qt${INSTALLED_QT_VERSION}::Core
+ Qt${INSTALLED_QT_VERSION}::Widgets
+ )
+
set(UI_SRCS
CMakeSetupDialog.ui
Compilers.ui
@@ -220,9 +233,12 @@ if(FALSE) # CMake's bootstrap binary does not support automoc
set(CMAKE_AUTORCC 1)
set(CMAKE_AUTOUIC 1)
else()
- list(APPEND SRCS
- ${UI_BUILT_SRCS}
- ${MOC_BUILT_SRCS})
+ target_sources(
+ CMakeGUILib
+ PUBLIC
+ ${UI_BUILT_SRCS}
+ ${MOC_BUILT_SRCS}
+ )
endif()
if(USE_LGPL)
@@ -233,13 +249,6 @@ if(USE_LGPL)
PROPERTY COMPILE_DEFINITIONS USE_LGPL="${USE_LGPL}")
endif()
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-add_library(CMakeGUILib STATIC ${SRCS})
-# CMake_QT_EXTRA_LIBRARIES have to come before the main libraries on the link line
-target_link_libraries(CMakeGUILib PUBLIC CMakeLib ${CMake_QT_EXTRA_LIBRARIES}
- Qt${INSTALLED_QT_VERSION}::Core Qt${INSTALLED_QT_VERSION}::Widgets)
-
add_library(CMakeGUIMainLib STATIC CMakeSetup.cxx)
target_link_libraries(CMakeGUIMainLib PUBLIC CMakeGUILib)