diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-09-14 18:47:41 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2020-09-23 18:10:40 (GMT) |
commit | 41e223deb37767d9beb8c4462b8b8df88ba2dedf (patch) | |
tree | 707701518f1431d17e683092987245639e0d387e | |
parent | b7995b62f0270a505f10c5eb625b531024189ada (diff) | |
download | CMake-41e223deb37767d9beb8c4462b8b8df88ba2dedf.zip CMake-41e223deb37767d9beb8c4462b8b8df88ba2dedf.tar.gz CMake-41e223deb37767d9beb8c4462b8b8df88ba2dedf.tar.bz2 |
CMake GUI: Split up into libraries, add test shim
-rw-r--r-- | Source/QtDialog/CMakeGUIExec.cxx | 15 | ||||
-rw-r--r-- | Source/QtDialog/CMakeLists.txt | 16 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 7 |
3 files changed, 31 insertions, 7 deletions
diff --git a/Source/QtDialog/CMakeGUIExec.cxx b/Source/QtDialog/CMakeGUIExec.cxx new file mode 100644 index 0000000..1572112 --- /dev/null +++ b/Source/QtDialog/CMakeGUIExec.cxx @@ -0,0 +1,15 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#include <QApplication> + +class CMakeSetupDialog; + +void SetupDefaultQSettings() +{ +} + +int CMakeGUIExec(CMakeSetupDialog* /*window*/) +{ + return QApplication::exec(); +} diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index e6d6b17..0ec012c 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -81,7 +81,6 @@ endif() set(SRCS AddCacheEntry.cxx AddCacheEntry.h - CMakeSetup.cxx CMakeSetupDialog.cxx CMakeSetupDialog.h Compilers.h @@ -150,11 +149,18 @@ endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) -add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${MANIFEST_FILE}) -target_link_libraries(cmake-gui CMakeLib Qt5::Core Qt5::Widgets ${CMake_QT_EXTRA_LIBRARIES}) +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} Qt5::Core Qt5::Widgets) + +add_library(CMakeGUIMainLib STATIC CMakeSetup.cxx) +target_link_libraries(CMakeGUIMainLib PUBLIC CMakeGUILib) + +add_executable(cmake-gui WIN32 MACOSX_BUNDLE CMakeGUIExec.cxx ${MANIFEST_FILE}) +target_link_libraries(cmake-gui CMakeGUIMainLib Qt5::Core) if(WIN32) - target_sources(cmake-gui PRIVATE $<TARGET_OBJECTS:CMakeVersion>) + target_sources(CMakeGUILib INTERFACE $<TARGET_OBJECTS:CMakeVersion>) endif() if(CMake_JOB_POOL_LINK_BIN) @@ -163,7 +169,7 @@ endif() # cmake-gui has not been updated for `include-what-you-use`. # Block the tool until this is done. -set_target_properties(cmake-gui PROPERTIES +set_target_properties(CMakeGUILib CMakeGUIMainLib cmake-gui PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "" ) diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 7ef5a72..37c1f15 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -21,7 +21,6 @@ #include "cmDocumentationEntry.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" // IWYU pragma: keep -#include "cmVersion.h" #include "cmake.h" static const char* cmDocumentationName[][2] = { { nullptr, @@ -55,6 +54,9 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin); # endif #endif +int CMakeGUIExec(CMakeSetupDialog* window); +void SetupDefaultQSettings(); + int main(int argc, char** argv) { cmSystemTools::EnsureStdPipes(); @@ -108,6 +110,7 @@ int main(int argc, char** argv) QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif + SetupDefaultQSettings(); QApplication app(argc, argv); setlocale(LC_NUMERIC, "C"); @@ -215,7 +218,7 @@ int main(int argc, char** argv) } } - return QApplication::exec(); + return CMakeGUIExec(&dialog); } #if defined(Q_OS_MAC) |