Hello Brad, I finally solved all remaining problems (there's only a cosmetic one left). Turns out there's a bug in the msvc 2017 compiler:
https://developercommunity.visualstudio.com/content/problem/76198/vs-2017-compiler-creates-broken-debug-build-using.html There is some discussion going on on the Qt side and a workaround for Qt is also available (though they don't want it in the master because it's a compiler and not a Qt issue): https://bugreports.qt.io/browse/QTBUG-56620 https://codereview.qt-project.org/#/c/207772/ For future reference I'd like to share my current solution of a Full-Static-Build of CMake: Toolchain: - Visual Studio 15.5.5 - Qt 5.10.1 Qt configure paramters: -platform win32-msvc2017 -opensource -confirm-license -static -static-runtime -mp -debug-and-release -nomake examples -nomake tests -nomake tools -no-gif -no-icu -no-pch -no-sql-sqlite -no-angle -no-opengl -no-dbus -no-qml-debug -no-harfbuzz -no-accessibility -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtremoteobjects -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtsvg -skip qttranslations -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebglplugin -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns -no-feature-testlib -no-feature-sql-odbc -no-feature-style-fusion -feature-style-windowsvista -feature-style-windows -feature-directwrite -feature-direct2d -feature-sql -feature-network -qt-pcre -qt-zlib -qt-libjpeg -qt-libpng CMake configuration: 1) Qt static link additional libs: set QT_S_LIB="%QT_BASE_DIR%/lib/qtpcre2$<$<CONFIG:Debug>:d>.lib" set QT_S_LIB=%QT_S_LIB%;"%QT_BASE_DIR%/lib/qtlibpng$<$<CONFIG:Debug>:d>.lib" set QT_S_LIB=%QT_S_LIB%;"%QT_BASE_DIR%/lib/qtfreetype$<$<CONFIG:Debug>:d>.lib" set QT_S_LIB=%QT_S_LIB%;"%QT_BASE_DIR%/lib/Qt5FontDatabaseSupport$<$<CONFIG:Debug>:d>.lib" set QT_S_LIB=%QT_S_LIB%;"%QT_BASE_DIR%/lib/Qt5ThemeSupport$<$<CONFIG:Debug>:d>.lib" set QT_S_LIB=%QT_S_LIB%;"%QT_BASE_DIR%/lib/Qt5EventDispatcherSupport$<$<CONFIG:Debug>:d>.lib" set QT_S_LIB=%QT_S_LIB%;"%QT_BASE_DIR%/plugins/platforms/qwindows$<$<CONFIG:Debug>:d>.lib" set QT_S_LIB=%QT_S_LIB%;"%QT_BASE_DIR%/plugins/styles/qwindowsvistastyle$<$<CONFIG:Debug>:d>.lib" set QT_S_LIB=%QT_S_LIB%;imm32.lib;version.lib;netapi32.lib;uxtheme.lib;dwmapi.lib 2) configure command: "%CMAKE_CMAKE_COMMAND%" ^ -G "Visual Studio 15" -A x64 -T v141,host=x64 ^ -D CMAKE_INSTALL_PREFIX:STRING="%CMAKE_INSTALL_PREFIX%" ^ -D BUILD_QtDialog:BOOL=ON ^ -D QT_QMAKE_EXECUTABLE:FILEPATH=%QT_BASE_DIR%/bin/qmake.exe ^ -D Qt5Widgets_DIR:PATH=%QT_BASE_DIR%/lib/cmake/Qt5Widgets ^ -D BUILD_DOCUMENTATION:BOOL=ON ^ -D CMAKE_USE_OPENSSL:BOOL=OFF ^ -D CMAKE_C_FLAGS_RELEASE:STRING="/MT /O2 /Ob2 /DNDEBUG" ^ -D CMAKE_CXX_FLAGS_RELEASE:STRING="/MT /O2 /Ob2 /DNDEBUG" ^ -D CMAKE_C_FLAGS_DEBUG:STRING="/MTd /Zi /Ob0 /Od /RTC1" ^ -D CMAKE_CXX_FLAGS_DEBUG:STRING="/MTd /Zi /Ob0 /Od /RTC1" ^ -D CMAKE_C_FLAGS_MINSIZEREL:STRING="/MT /O1 /Ob1 /DNDEBUG" ^ -D CMAKE_CXX_FLAGS_MINSIZEREL:STRING="/MT /O1 /Ob1 /DNDEBUG" ^ -D CMAKE_C_FLAGS_RELWITHDEBINFO:STRING="/MT /Zi /O2 /Ob1 /DNDEBUG" ^ -D CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="/MT /Zi /O2 /Ob1 /DNDEBUG" ^ -D SPHINX_HTML:BOOL=ON ^ -D CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES:STRING="!QT_S_LIB!" ^ "%CMAKE_SOURCE_DIR%" Qt patch to fix compiler error: https://codereview.qt-project.org/#/c/207772/ Maybe this helps someone else trying to do a full static build of CMake for Windows. Best regards, Michael > -----Ursprüngliche Nachricht----- > Von: cmake-developers [mailto:cmake-developers-boun...@cmake.org] Im > Auftrag von Stuermer, Michael SP/HZA-ZSEP > Gesendet: Freitag, 16. Februar 2018 16:23 > An: Brad King > Cc: cmake-developers@cmake.org > Betreff: Re: [cmake-developers] CMake build with static crt and static > QtDialog not linking > > > > > On 2/16/2018 7:43 AM, Stuermer, Michael SP/HZA-ZSEP wrote: > > > 1) The debug version crashes in > > > > I don't know if we've ever built a debug configuration against this Qt. > > > > > This application failed to start because it could not find or load > > > the Qt platform plugin "windows" in "". > > > > We statically link that plugin. See our release build settings here: > > > > https://gitlab.kitware.com/cmake/cmake/blob/v3.11.0- > > rc1/Utilities/Release/win64_release.cmake > > > > Thanks for this hint, now it crashes in debug when loading the plugin, but it > works well for release. So I guess it's fine for now. > > I'll investigate this a bit further and come back here if I find some > solutions > for the debug crashes or get later Qt versions working as well. > > > In particular, CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES > > in the initial cache file configures use of the static plugin. > > > > > @brad: could you please provide a config.summary from the kitware > > > Qt- > > build? > > > Maybe I need to change the windows sdk version or so to fix my > problem. > > > > We use a custom environment to use the VS 2017 toolchain but still > > support Windows XP: > > > > ``` > > Environment: > > INCLUDE= > > C:\Program Files (x86)\Microsoft Visual > > Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\include > > C:\Program Files (x86)\Microsoft Visual > > Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\atlmfc\include > > C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt > > c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include > > LIB= > > C:\Program Files (x86)\Microsoft Visual > > Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\atlmfc\lib\x64 > > C:\Program Files (x86)\Microsoft Visual > > Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\lib\x64 > > C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64 > > c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\lib\x64 > > PATH= > > C:\Program Files (x86)\Microsoft Visual > > Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64 > > C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64 > > C:\Program Files (x86)\Microsoft Visual > > Studio\2017\Professional\MSBuild\15.0\bin > > C:\Windows\Microsoft.NET\Framework64\v4.0.30319 > > C:\Program Files (x86)\Microsoft Visual > > Studio\2017\Professional\Common7\IDE > > C:\Program Files (x86)\Microsoft Visual > > Studio\2017\Professional\Common7\Tools > > C:\Windows\system32 > > C:\Windows > > Configuration: > > pcre > > release > > compile_examples > > msvc_mp > > Qt Configuration: > > minimal-config > > small-config > > medium-config > > large-config > > full-config > > release > > static > > static_runtime > > zlib > > no-gif > > jpeg > > png > > freetype > > audio-backend > > no-qml-debug > > directwrite > > native-gestures > > qpa > > concurrent > > > > QMAKESPEC...................win32-msvc2017 (commandline) > > Architecture................x86_64, features: sse sse2 Host > > Architecture...........x86_64, features: sse sse2 > > Maketool....................nmake Debug.......................no Force > > debug info............no > > C++ language standard.......auto > > Link Time Code Generation...no > > Using PCH ..................no > > Accessibility support.......no > > RTTI support................yes > > SSE2 support................yes > > SSE3 support................yes > > SSSE3 support...............yes > > SSE4.1 support..............yes > > SSE4.2 support..............yes > > AVX support.................yes > > AVX2 support................yes > > NEON support................no > > OpenGL support..............no > > Large File support..........yes > > NIS support.................no > > Iconv support...............no > > Evdev support...............no > > Mtdev support...............no > > Inotify support.............no > > eventfd(7) support..........no > > Glib support................no > > CUPS support................no > > OpenVG support..............no > > SSL support.................no > > OpenSSL support.............no > > libproxy support............no > > Qt D-Bus support............no > > Qt Widgets module support...yes > > Qt GUI module support.......yes > > QML debugging...............no > > DirectWrite support.........yes > > Use system proxies..........no > > > > QPA Backends: > > GDI.....................yes > > Direct2D................no > > > > Third Party Libraries: > > ZLIB support............qt > > GIF support.............no > > JPEG support............yes > > PNG support.............yes > > FreeType support........yes > > Fontconfig support......no > > HarfBuzz support........no > > PCRE support............qt > > ICU support.............no > > ANGLE...................no > > Dynamic OpenGL..........no > > > > Styles: > > Windows.................yes > > Windows XP..............yes > > Windows Vista...........yes > > Fusion..................yes > > Windows CE..............no > > Windows Mobile..........no > > > > Sql Drivers: > > ODBC....................no > > MySQL...................no > > OCI.....................no > > PostgreSQL..............no > > TDS.....................no > > DB2.....................no > > SQLite..................no (qt) > > SQLite2.................no > > InterBase...............no > > ``` > > > > > I'm doing a temporary hack in QtDialog CMakeLists.txt at the moment > > > to > > link to qtpcre: > > > > That's due to the static library dependencies problem I mentioned > > previously. > > See my earlier message about hacking _Qt5Core_LIB_DEPENDENCIES in > Qt's > > files. > > > > -Brad > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake-developers -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake-developers