[Interest] QMake contains and include
Jérôme Godbout
godboutj at amotus.ca
Wed May 20 18:30:41 CEST 2020
It kinda work, it’s really weird, but all the project get display, the .pri and the include/source no matter the condition, but they are grey out if the include condition is false, so it does scan the .pri no matter what but doesn’t really include them to be used only for display!?! So I got all the optional part display but not really used. The compile seem to work. This leave an horrible UX view for developer to see part that aren’t used but source is display and searchable for the project!
I think I can live with it but this is an horrible UX to display those include no matter the condition that include them or not, here what it does (image in attachment) with:
if(true) {
include(Amotus_Qt_GUI.pri)
}
if(false){
include(Amotus_Qt_Commands.pri)
}
From: gmail at ratijas.tk <gmail at ratijas.tk>
Sent: May 20, 2020 11:41 AM
To: Jérôme Godbout <godboutj at amotus.ca>; interest at qt-project.org
Subject: Re: [Interest] QMake contains and include
qmake is strange, it implements custom syntax and grammar. Don't search for any deep logic there. It will be superseded by CMake soon anyway.
About your issue, I looked it up on DuckDuckGo, and the first result is the discussion on StackOverflow which looks like it:
https://stackoverflow.com/questions/46078270/qmake-scope-syntax-with-contains-function
Hope that helps somehow~
20.05.2020, 18:29, "Jérôme Godbout" <godboutj at amotus.ca<mailto:godboutj at amotus.ca>>:
Sorry for the noise, but I did found a way simpler example to test this:
if(false){
message(“Pass here”)
include(“myfile.pri”)
}
myfile.pri is always included no matter what, but the message is not printed! this is really counter intuitive. Any way to make a conditional include?!?
From: Interest <interest-bounces at qt-project.org<mailto:interest-bounces at qt-project.org>> On Behalf Of Jérôme Godbout
Sent: May 20, 2020 11:17 AM
To: interest at qt-project.org<mailto:interest at qt-project.org>
Subject: [Interest] QMake contains and include
Hi,
QMAKE question: anybody manage to use an include inside a contains(){} into QMake? the include is processed no matter what!?!
message("list: '$$AMOTUS_SUBREPOS_OPTIONAL_NAMES' ")
contains(AMOTUS_SUBREPOS_OPTIONAL_NAMES, i18n){
message("Using i18n...")
HEADERS += $$AMOTUS_Qt_PATH/i18n.h
SOURCES += $$AMOTUS_Qt_PATH/i18n.cpp
include(i18n.pri)
}contains(AMOTUS_SUBREPOS_OPTIONAL_NAMES, Amotus_Qt_Network){
message("Using Amotus_Qt_Network...")
include(Amotus_Qt_Network.pri)
}
If I put AMOTUS_SUBREPOS_OPTIONAL_NAMES = i18n
The message print:
Project MESSAGE: list: 'i18n'
Project MESSAGE: Using i18n...
The message is correct. But I get both the i18n.pri and the Amotus_Qt_Network.pri include anyway!? if I remove the i18n entry from the variable AMOTUS_SUBREPOS_OPTIONAL_NAMES =
I get the following:
Project MESSAGE: list: ''
The include for i18n.pri and Amotus_Qt_Network.pri are still included, but the i18n.h and i18n.cpp are grey out which seem to work for HEADERS and SOURCES but not include!?! is include special or parsed without any consideration of the scope?! I did try to close QtCreator and reopen without luck (using QtCreator 4.12.0 on Mac OS)
,
_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200520/eb9075c6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 52513 bytes
Desc: image.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200520/eb9075c6/attachment-0001.png>
More information about the Interest
mailing list