qmake

How to generate .sln/.vcproj using qmake

送分小仙女□ 提交于 2019-11-27 05:36:13
问题 I have main.cpp in c:\test folder and do the following: qmake -project qmake -tp vc test.pro The answer is: WARNING: Unable to generate output for: C:/test//Makefile.Debug [TEMPLATE vcapp] WARNING: Unable to generate output for: C:/test//Makefile.Release [TEMPLATE vcapp] But, I don't need make files. I need .vcproj! Environment: Windows XP Pro SP3, MSVC 7.1 and 8.0. Qt is installed in C:\Qt\2010.02 (LGPL version). Commands are run from Qt Command Prompt. What's wrong with it? How to generate

Add a define to qmake WITH a value?

做~自己de王妃 提交于 2019-11-27 03:53:08
How do I add a define with qmake WITH a value: For example, this does not work (as I expected) in my .pro file: DEFINES += WINVER 0x0500 nor DEFINES += "WINVER 0x0500" How do I define WINVER as 0x0500 before anything starts compiling so it's definition is not affected in any way by compilation or include order? DEFINES += "WINVER=0x0500" works for me. This way, -DWINVER=0x0500 is added to the command line of the compiler, which is the syntax GCC/mingw expects for command line preprocessor definitions (see here for the details). shrikantd DEFINES += MY_DEF=\\\"String\\\" This format is to be

QTCreator copy files to output directory with INSTALLS

冷暖自知 提交于 2019-11-27 03:18:40
问题 I have two sub directories docroot and config in my Qt project. Files in these directories shall be copied to the build directory whenever I build / debug the project. As of https://stackoverflow.com/a/3991210/356726 this is possible by using INSTALLS (QtDoc), which seems to be much easier than running copy command (e.g here). A similar approach is described here. config.path = $${DESTDIR}/config config.files = config/* docroot.path = $${DESTDIR}/docroot docroot.files = docroot/* INSTALLS +=

Copy a file to the build directory after compiling project with Qt

 ̄綄美尐妖づ 提交于 2019-11-27 02:17:54
问题 I have a file "settings.ini" which needs to reside next to the Qt executable. I can add a custom build step for this in Qt Creator which calls something like this: copy %{sourceDir}/settings.ini %{buildDir}/settings.ini This works great so far, but I'd like to include this in the *.pro file so I can put this up in our SVN too. How can I do this using qmake/.pro-files only? 回答1: You probably want to use the INSTALLS keyword in QMake. It will require you to run make install after your build,

How to detect target architecture using CMake?

房东的猫 提交于 2019-11-27 01:13:20
问题 I've done a lot of research and been unable to find an answer to this... how can I reliably find the target architecture I'm compiling for, using CMake? Basically, the equivalent to QMAKE_TARGET.arch in qmake. Most sources seem to suggest CMAKE_SYSTEM_PROCESSOR, but that's a bad solution because that will always return i386 on OS X for example, no matter whether you're compiling for i386, x86_64, ppc or ppc64. Similarly, CMAKE_SIZEOF_VOID_P gives the pointer size of the system , not the

Linking with a debug/release lib with qmake/Qt Creator

徘徊边缘 提交于 2019-11-27 00:54:55
问题 I am using Qt Creator and have a Qt GUI project that depends on a C++ static library project. I want to link the release version of the GUI app with the release build of the .lib and the debug release of the GUI app with the debug .lib. I have found out how to add additional libraries to the project by including a line like the following in my .pro file: LIBS += -L./libfolder -lmylib.lib But I cannot see how I can use a different -L command for release and debug builds. Is there support in

Why does Qt use its own make tool, qmake?

≯℡__Kan透↙ 提交于 2019-11-27 00:33:24
问题 I just started using Qt and noticed that it uses its own make tool, qmake. Why does Qt use its own make tool? Is there something special that prevents it from using a standard make tool? Does qmake call the GCC C++ compiler? 回答1: Qt uses qmake to transparently support Qt's various addons, including "moc, the meta-object compiler" (which provides signals & slots), "uic, the ui compiler" (which creates header files from .ui designer files), "rcc, the resource compiler" (which compiles resources

Running a program/script from QMake

一个人想着一个人 提交于 2019-11-26 23:14:16
问题 We have a fairly large code-base. The vast majority of the code is compiled using qmake to produce the makefiles. However, there are some sub-projects that get produced by running batch files or running other programs. I'd like to be able to have everything compiled using qmake, but I can't figure out how to get qmake to simply run a script. One thing that I've tried is using QMAKE_EXTRA_TARGETS in my pro file, like so: TEMPLATE = lib SOURCES = placeholder.cpp CONFIG += no_link staticlib

QMake - How to add and use a variable into the .pro file

﹥>﹥吖頭↗ 提交于 2019-11-26 22:19:40
问题 I have a qmake file generated by Qt creator. I am modifying it but I do not manage to understand how to create a variable. For example, I want to declare the library MYPATH as I did here: MYPATH = /lib/aaa/bbb unix:!macx:!symbian: LIBS += -L$(MYPATH) When I run qmake I find in the generated makefile LIBS = ....... -L$(MYPATH) ..... But the MYPATH variable is not declared anywhere. Does anyone know how to declare such a variable properly? 回答1: QMake uses its own syntax for variable references.

qmake pre-build step before ANY compilation

狂风中的少年 提交于 2019-11-26 22:16:59
问题 There are several questions on SO regarding how to create a pre-build step for qmake , I can do that with this in my .pro file: versionTarget.target = ../VersionData/versioning.h versionTarget.depends = FORCE win32: versionTarget.commands = cd $$PWD; python.exe ./version_getter.py -p $$TARGET else: versionTarget.commands = cd $$PWD; python ./version_getter.py -p $$TARGET PRE_TARGETDEPS += ../VersionData/versioning.h QMAKE_EXTRA_TARGETS += versionTarget Now, the problem is that this approach