Linking libraries to a QT project using pkg-config output
CONFIG += link_pkgconfig PKGCONFIG += opencv (I got this answer from http://beaufour.dk/blog/2008/02/using-pkgconfig.html)
CONFIG += link_pkgconfig PKGCONFIG += opencv (I got this answer from http://beaufour.dk/blog/2008/02/using-pkgconfig.html)
The option you need is “CONFIG+=debug”. See General Configuration in qmake Manual. #!/bin/bash qmake CONFIG+=debug ${qmake_options} make ${make_options}
Filesystem layout: MyProject |_ myproject.pro |_ core |_ core.cpp |_ core.h |_ core.pro |_ app |_ main.cpp |_ app.pro myproject.pro: TEMPLATE = subdirs CONFIG += ordered SUBDIRS = core \ app app.depends = core core.pro: TEMPLATE = lib CONFIG += staticlib HEADERS = core.h SOURCES = core.cpp app.pro: TEMPLATE = app SOURCES = main.cpp LIBS … Read more
OK, here’s an ugly hack: # Copy required DLLs to output directory CONFIG(debug, debug|release) { QtCored4.commands = copy /Y %QTDIR%\\bin\\QtCored4.dll debug QtCored4.target = debug/QtCored4.dll QtGuid4.commands = copy /Y %QTDIR%\\bin\\QtGuid4.dll debug QtGuid4.target = debug/QtGuid4.dll QMAKE_EXTRA_TARGETS += QtCored4 QtGuid4 PRE_TARGETDEPS += debug/QtCored4.dll debug/QtGuid4.dll } else:CONFIG(release, debug|release) { QtCore4.commands = copy /Y %QTDIR%\\bin\\QtCore4.dll release QtCore4.target = release/QtCore4.dll QtGui4.commands … Read more
Old question, I know. But nowadays, you can simply use CONFIG += force_debug_info to get debug symbols even in release mode. When you use QMake via the command line, I usually do this to get a release build with debug info: qmake CONFIG+=release CONFIG+=force_debug_info path/to/sources this will enable below conditions of Qt5/mkspecs/features/default_post.prf: force_debug_info|debug: CONFIG += … Read more
One way of doing it is to have a .pro file per subdirectory. appsuite.pro: TEMPLATE = subdirs SUBDIRS = common app1 app2 app3 app1.depends = common app2.depends = common app3.depends = common app1/app1.pro: TARGET = app1 SOURCES = main.cpp INCLUDEPATH += ../common LIBS += -L../common -lcommon The common.pro file should build a static library you … Read more
I do it like this win32 { ## Windows common build here !contains(QMAKE_TARGET.arch, x86_64) { message(“x86 build”) ## Windows x86 (32bit) specific build here } else { message(“x86_64 build”) ## Windows x64 (64bit) specific build here } }
The selected answer is correct but it requires to call make install, which in my opinion is annoying or error prone. Instead, to copy files to the build directory use: copydata.commands = $(COPY_DIR) $$PWD/required_files $$OUT_PWD first.depends = $(first) copydata export(first.depends) export(copydata.commands) QMAKE_EXTRA_TARGETS += first copydata Where required_files must be replaced with your correct path. $$PWD … Read more
QMake: The required libraries. QT += core QT -= gui QT += network CMake: only the add is necessary. An exclude (QT -= gui) is not required. find_package(Qt5Core REQUIRED) find_package(Qt5Network REQUIRED) QMake: Additional Compiler flags: CONFIG += c++11 CMake: Extend the list of compiler flags as required. set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -std=c++0x”) QMake: The source files SOURCES … Read more
QMake: The required libraries. QT += core QT -= gui QT += network CMake: only the add is necessary. An exclude (QT -= gui) is not required. find_package(Qt5Core REQUIRED) find_package(Qt5Network REQUIRED) QMake: Additional Compiler flags: CONFIG += c++11 CMake: Extend the list of compiler flags as required. set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -std=c++0x”) QMake: The source files SOURCES … Read more