qmake

test if a variable is empty and give default value during qmake

时光总嘲笑我的痴心妄想 提交于 2019-12-05 19:31:14
问题 How can you test if a variable is empty or not defined in a qmake .pro file? I want to be able to set up a default value if the variable is not defined. I tried eval("VARIABLE" = ""){ VARIABLE = test } eval("VARIABLE" = ""){ message(variable is empty) } but I still get the message "variable is empty". 回答1: there is already the function isEmpty I didn't spot: isEmpty(VARIABLE){ VARIABLE = test } isEmpty(VARIABLE ){ message(variable is empty) } I don't understand why eval didnt work thought...

How to build qtwayland?

▼魔方 西西 提交于 2019-12-05 19:29:13
I spent whole day trying to use QtWayland.Compositor 1.0 in Qt creator. I have followed all the steps from there https://wiki.qt.io/QtWayland but I get the following error. I don't know what does it mean, that is my first contact with linux. I have the newest linux mint on a vm. $ sudo make install cd src/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/emil/wayland/qtwayland/src/src.pro -o Makefile ) && make -f Makefile install make[1]: Entering directory '/home/emil/wayland/qtwayland/src' make[1]: Nothing to be done for 'install'. make[1]: Leaving directory '/home/emil

Qt and QMake build dir

限于喜欢 提交于 2019-12-05 17:38:35
I would like to build qt and qt application out of the source tree. Do you know how to set from the command line the .obj directory both with configure and qmake? If I understand question correctly you should set OBJECTS_DIR variable in *.pro file for any directory you want. If you don't want to change *.pro file try qmake "OBJECTS_DIR=some_dir" *.pro 来源: https://stackoverflow.com/questions/1741877/qt-and-qmake-build-dir

How to automate Qt moc?

旧街凉风 提交于 2019-12-05 15:26:36
I have to run the following commands from Qt command prompt: qmake -project then make and this gives me the debug folder with the Moc file. This is strangely the only way my PC will generate the moc_.cpp file. So how can I automate the task of these commands so I don't have to use these commands again? You should not run qmake -project multiple times. The -project option is meant to provide you a template project file for you to edit. An equivalent of what you are doing in an IDE would be creating a "New Project" every time you want to build. After you have the initial project, you should edit

VS2015编译QGC,提示筛选器下已存在"*.qrc"

扶醉桌前 提交于 2019-12-05 15:05:43
qt creator 可以正常编译qgc,vs2015打开提示错误。 解决:把qgroundcontrol目录下的.qrc删除, mkdir build cd build qmake -tp vc ../qgroundcontrol.pro 接着vs打开qgc生成的.vcxproj工程。 此时,把刚刚删除的.qrc都恢复。 再次使用qt creator编译,运行,确保程序可以正常执行。 此时vs2015工程应该是可以打开了。编译,解决遇到的问题。 如,宏定义找不到等问题 setOrganizationName(QGC_ORG_NAME); // QGC_ORG_NAME找不到 setOrganizationDomain(QGC_ORG_DOMAIN); //QGC_ORG_DOMAIN找不到 this->setApplicationVersion(QString(GIT_VERSION));//GIT_VERSION找不到 ######################################### QGC_APPLICATION_NAME=""QGroundControl"" QGC_ORG_NAME=""QGroundControl.org"" QGC_ORG_DOMAIN=""org.qgroundcontrol"" GIT_VERSION=""Development

How to use qmake with two source files which have the same name?

岁酱吖の 提交于 2019-12-05 14:05:13
问题 My Qt project have two source files with the same name but in different folder. The pro file is: SOURCES = A/Test.cpp SOURCES += B/Test.cpp It can generate Visual Studio solution file via Qt Visual Studio addon, but it won't work because the generated object file have the same name: Test.obj. That will cause LNK2001 unresolved external symbol because one of Test.obj is overwritten. How to write proper pro file to deal with that? 回答1: You can try adding that line to your .pro file: CONFIG +=

QMake: Referencing a library using relative paths

别等时光非礼了梦想. 提交于 2019-12-05 11:18:16
I have a Qt project using SQLite, so I have the following directory structure: C:\Workspace\MyProject\MyProject.pro C:\Workspace\MyProject\sqlite3\sqlite3.lib Adding sqlite3.lib with absolute paths works fine: LIBS += -L"c:/Workspace/MyProject/sqlite3" -lsqlite3 But I can't make it work with relative paths. I try with: LIBS += -L"sqlite3" -lsqlite3 But that fails with: :-1: error: LNK1104: cannot open file 'sqlite3\sqlite3.lib' I tried but LIBS += -L"../sqlite3" or even LIBS += -L"../../sqlite3" , but that didn't work either. I'm using MSVC 2008 for the compiler toolchain. hluk Since it's

Manually configuring shadow build in qmake

旧街凉风 提交于 2019-12-05 10:47:57
问题 There is a feature I really like in qt creator and it is the Shadow build. When the Shadow Build is on, all the generated files (*.moc, Makefile, *.o) will be generated in a given source directory, so the sources directory is kept clean. I am moving from qt creator to kdevelop and I am trying to figure out how this feature works, so far I can create the resulting binary, the moc files and object files to the extra directory using the variables DESTDIR , OBJECTS_DIR and MOC_DIR but I cannot

Using conditions when customize qt project

混江龙づ霸主 提交于 2019-12-05 10:29:29
Good day! I have a qt project and I want to customize it using .pro-file conditions. Notably, I want to use one .pro-file to get several outputs, something like that: DEFINES += APP1=0 APP2=1 DEFINES += TYPE=APP1 if(TYPE == APP1) { LIBS += <LIB1> DESTDIR = <DIR1> } else { LIBS += <LIB2> DESTDIR = <DIR2> } But when I try to build my project I get the following error when running qmake: Parse Error('else') How to do it correctly? The values stored in the CONFIG variable are treated specially by qmake . Each of the possible values can be used as the condition for a scope. So, your project file

How to quell qmake's “WARNING: Failure to find:”?

喜欢而已 提交于 2019-12-05 07:21:34
I'm using PRE_TARGETDEPS to generate source files, and I'm adding the generated source files to SOURCES for compilation. The output of my generator obviously doesn't exist at the time qmake is run, so qmake outputs WARNING: Failure to find: for each of the to-be-created source files. How can I quell this warning, since I know my PRE_TARGETDEPS is going to produce those files? Or, is there a better way to generate intermediate files using qmake? Example Here's a complete test.pro file that exhibits the problem: TEMPLATE = lib preprocess.commands += cat test.cc.in | sed 's/a/0/g' > test.0.cc ;