summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-02-20 11:07:09 +0100
committerKai Koehne <kai.koehne@theqtcompany.com>2015-03-11 09:26:37 +0000
commitfdb7fa937a58900e3966adc765975785d0a9f0da (patch)
tree620094b14e13d679d17ab846cb8f02a6d7591e01 /tools
parentaad3c089023652844a3898fa0b7cbf1db966ef3c (diff)
Windows: Add -static-runtime configure option
Support statically linking the MSVC/mingw runtime libraries without manually tweaking mkspecs. This is helpful for projects like the installer framework. MSVC does not support mixing MT[d]/MD[d] flags in different compilation units. The static_runtime option is therefore added to both QT_CONFIG and CONFIG. Change-Id: Ifd6dc9c362090457de8e2c62477d0445f9479722 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/configure/configureapp.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index ca2a5b1769..a263d44f29 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -245,6 +245,8 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "SHARED" ] = "yes";
+ dictionary[ "STATIC_RUNTIME" ] = "no";
+
dictionary[ "ZLIB" ] = "auto";
dictionary[ "PCRE" ] = "auto";
@@ -464,6 +466,8 @@ void Configure::parseCmdLine()
dictionary[ "SHARED" ] = "yes";
else if (configCmdLine.at(i) == "-static")
dictionary[ "SHARED" ] = "no";
+ else if (configCmdLine.at(i) == "-static-runtime")
+ dictionary[ "STATIC_RUNTIME" ] = "yes";
else if (configCmdLine.at(i) == "-developer-build")
dictionary[ "BUILDDEV" ] = "yes";
else if (configCmdLine.at(i) == "-opensource") {
@@ -1775,6 +1779,8 @@ bool Configure::displayHelp()
desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries.");
desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n");
+ desc("STATIC_RUNTIME", "no", "-static-runtime","Statically link the C/C++ runtime library.\n");
+
desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)");
desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n");
@@ -2499,6 +2505,11 @@ bool Configure::verifyConfiguration()
dictionary["C++11"] = "auto";
}
+ if (dictionary["STATIC_RUNTIME"] == "yes" && dictionary["SHARED"] == "yes") {
+ cout << "ERROR: -static-runtime requires -static" << endl << endl;
+ dictionary[ "DONE" ] = "error";
+ }
+
if (dictionary["SEPARATE_DEBUG_INFO"] == "yes") {
if (dictionary[ "SHARED" ] == "no") {
cout << "ERROR: -separate-debug-info is incompatible with -static" << endl << endl;
@@ -2644,6 +2655,9 @@ void Configure::generateOutputVars()
else
qtConfig += "shared";
+ if (dictionary[ "STATIC_RUNTIME" ] == "yes")
+ qtConfig += "static_runtime";
+
if (dictionary[ "GUI" ] == "no") {
qtConfig += "no-gui";
dictionary [ "WIDGETS" ] = "no";
@@ -3362,6 +3376,8 @@ void Configure::generateQConfigPri()
configStream << dictionary[ "BUILD" ];
configStream << (dictionary[ "SHARED" ] == "no" ? " static" : " shared");
+ if (dictionary["STATIC_RUNTIME"] == "yes")
+ configStream << " static_runtime";
if (dictionary[ "LTCG" ] == "yes")
configStream << " ltcg";
if (dictionary[ "RTTI" ] == "yes")