commit 2c7546c7f2bdc30f3df2b5a0c09da4e1aa5f6d3c Author: Sebastian Hahn sebastian@torproject.org Date: Thu May 17 15:43:18 2012 +0200
Link with ws2_32.lib and zlib on Windows with -static
The build system doesn't figure out how to correctly set the library dependencies, so let's give it a little help. --- changes/win_static_ws32 | 4 ++++ src/common/CMakeLists.txt | 5 ++++- src/tools/po2nsh/CMakeLists.txt | 4 ++++ src/tools/po2ts/CMakeLists.txt | 4 ++++ src/tools/po2wxl/CMakeLists.txt | 4 ++++ src/tools/ts2po/CMakeLists.txt | 4 ++++ src/tools/wixtool/CMakeLists.txt | 4 ++++ 7 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/changes/win_static_ws32 b/changes/win_static_ws32 new file mode 100644 index 0000000..5cb5067 --- /dev/null +++ b/changes/win_static_ws32 @@ -0,0 +1,4 @@ + o Build fixes: + - For static builds on windows, correctly link with zlib and + ws32_2.lib. + diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 92ec489..1404b1b 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -31,10 +31,13 @@ if(WIN32) ) endif(WIN32)
- add_library(common STATIC ${common_SRCS}) target_link_libraries(common ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} )
+if (WIN32 AND QT_CONFIG MATCHES "static") + target_link_libraries(common z) +endif(WIN32 AND QT_CONFIG MATCHES "static") + diff --git a/src/tools/po2nsh/CMakeLists.txt b/src/tools/po2nsh/CMakeLists.txt index 45b291f..ebe027a 100644 --- a/src/tools/po2nsh/CMakeLists.txt +++ b/src/tools/po2nsh/CMakeLists.txt @@ -23,6 +23,10 @@ target_link_libraries(po2nsh ${QT_QTCORE_LIBRARY} )
+if (WIN32 AND QT_CONFIG MATCHES "static") + target_link_libraries(po2nsh ws2_32 z) +endif(WIN32 AND QT_CONFIG MATCHES "static") + ## Remember the location of po2nsh so we can use it in custom commands get_target_property(PO2NSH_EXECUTABLE po2nsh LOCATION) set(VIDALIA_PO2NSH_EXECUTABLE ${PO2NSH_EXECUTABLE} diff --git a/src/tools/po2ts/CMakeLists.txt b/src/tools/po2ts/CMakeLists.txt index fff76bc..87d1f1b 100644 --- a/src/tools/po2ts/CMakeLists.txt +++ b/src/tools/po2ts/CMakeLists.txt @@ -25,6 +25,10 @@ target_link_libraries(po2ts ${QT_QTXML_LIBRARY} )
+if (WIN32 AND QT_CONFIG MATCHES "static") + target_link_libraries(po2ts z) +endif(WIN32 AND QT_CONFIG MATCHES "static") + ## Remember the location of po2ts so we can use it in custom commands get_target_property(PO2TS_EXECUTABLE po2ts LOCATION) set(VIDALIA_PO2TS_EXECUTABLE ${PO2TS_EXECUTABLE} diff --git a/src/tools/po2wxl/CMakeLists.txt b/src/tools/po2wxl/CMakeLists.txt index 5e8e547..94bf40e 100644 --- a/src/tools/po2wxl/CMakeLists.txt +++ b/src/tools/po2wxl/CMakeLists.txt @@ -24,6 +24,10 @@ target_link_libraries(po2wxl ${QT_QTXML_LIBRARY} )
+if (WIN32 AND QT_CONFIG MATCHES "static") + target_link_libraries(po2wxl ws2_32 z) +endif(WIN32 AND QT_CONFIG MATCHES "static") + ## Remember the location of po2wxl so we can use it in custom commands get_target_property(PO2WXL_EXECUTABLE po2wxl LOCATION) set(VIDALIA_PO2WXL_EXECUTABLE ${PO2WXL_EXECUTABLE} diff --git a/src/tools/ts2po/CMakeLists.txt b/src/tools/ts2po/CMakeLists.txt index b98725c..d826e2e 100644 --- a/src/tools/ts2po/CMakeLists.txt +++ b/src/tools/ts2po/CMakeLists.txt @@ -46,6 +46,10 @@ target_link_libraries(ts2po ${QT_QTXML_LIBRARY} )
+if (WIN32 AND QT_CONFIG MATCHES "static") + target_link_libraries(ts2po z) +endif(WIN32 AND QT_CONFIG MATCHES "static") + ## Remember the location of ts2po so we can use it in custom commands get_target_property(TS2PO_EXECUTABLE ts2po LOCATION) set(VIDALIA_TS2PO_EXECUTABLE ${TS2PO_EXECUTABLE} diff --git a/src/tools/wixtool/CMakeLists.txt b/src/tools/wixtool/CMakeLists.txt index f205a46..349bc7a 100644 --- a/src/tools/wixtool/CMakeLists.txt +++ b/src/tools/wixtool/CMakeLists.txt @@ -20,6 +20,10 @@ target_link_libraries(wixtool ${QT_QTXML_LIBRARY} )
+if (WIN32 AND QT_CONFIG MATCHES "static") + target_link_libraries(wixtool ws2_32 z) +endif(WIN32 AND QT_CONFIG MATCHES "static") + ## Remember location so we can use it in custom commands get_target_property(WIXTOOL_EXECUTABLE wixtool LOCATION) set(VIDALIA_WIXTOOL_EXECUTABLE ${WIXTOOL_EXECUTABLE}