vinipsmaker / tufao

An asynchronous web framework for C++ built on top of Qt

Home Page:http://vinipsmaker.github.io/tufao/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't link apps in debug mode on VS

hmoffatt opened this issue · comments

I've built Tufao 1.3.7 on Windows with Visual Studio 2013, using
cmake -DCMAKE_INSTALL_PREFIX=c:/dev/tufao/install ..
cmake --build . --target install

This generates tufao1d.lib/dll, but the tufao1.prf file added to the Qt install only looks for a release build (tufao1.lib/dll), so it's impossible to build anything in debug mode.

Added -DCMAKE_BUILD_TYPE=Debug at the first cmake run did not help, cmake output:

CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_BUILD_TYPE

I can't help you with Windows issues. We'll have to wait until another issue fix this problem or you'll have to fix it yourself.

However, if you find a problem in source code portability, I'll be very intrigued and I'll find a way to help you.

Here is a patch that fixes this for me with VS. I'm not sure exactly what will happen with MinGW though.

Something like this might be needed on Mac too, where CMAKE_DEBUG_POSTFIX is also non-empty.

diff --git a/pkg/tufao.prf.in b/pkg/tufao.prf.in
index 8fa53d9..4a1a488 100644
--- a/pkg/tufao.prf.in
+++ b/pkg/tufao.prf.in
@@ -2,4 +2,10 @@ QT += network

 DEFINES += TUFAO_VERSION_MAJOR=@TUFAO_VERSION_MAJOR@
 INCLUDEPATH += "@CMAKE_INSTALL_PREFIX@/@includedir@"
-LIBS += -L"@CMAKE_INSTALL_PREFIX@/@libdir@" -l@TUFAO_LIBRARY@
+
+win32 {
+       CONFIG(debug, debug|release): LIBS += -L"@CMAKE_INSTALL_PREFIX@/@libdir@" -l@TUFAO_LIBRARY@@CMAKE_DEBUG_POSTFIX@
+       CONFIG(release, debug|release): LIBS += -L"@CMAKE_INSTALL_PREFIX@/@libdir@" -l@TUFAO_LIBRARY@
+} else {
+       LIBS += -L"@CMAKE_INSTALL_PREFIX@/@libdir@" -l@TUFAO_LIBRARY@
+}

Your patch looks okay. I'll accept it.

Do you want to do a PR so your name goes on the git log or do you prefer that I apply the patch as is?

I don't really mind. I wouldn't have time for a few days to do the PR.

Patch applied. I'll release a new version when I fix another issue that is on my backlog. Thanks for the contribution.