<div dir="ltr"><div>Hi,<br><br>What Thomas said makes sense, I just want to add one more little thing. You can, in the .spec file, add stuff to qmake, like this define. This would make the necessary code shorter and as a bonus, it gives you something you can even ifdef in C++.<br>
<br></div><div># spec file<br></div>qmake DEFINES+=IS_SAILFISH_OS<br><div><br></div><div># pro file<br></div><div>contains(DEFINES, IS_SAILFISH_OS) {<br>  ...<br>}<br><br></div><div>// C++ file<br></div><div>#if defined(IS_SAILFISH_OS)<br>
  ...<br></div><div>#endif<br></div><div><br></div><div>Cheers,<br>Timur<br></div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><br>Timur<br><br></div></div>
<br><br><div class="gmail_quote">On Thu, Jan 2, 2014 at 8:44 PM, Thomas Perl <span dir="ltr"><<a href="mailto:th.perl@gmail.com" target="_blank">th.perl@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<div class="im"><br>
On 02 Jan 2014, at 20:25, Sven Putze <<a href="mailto:sailfish.os@hardcodes.de">sailfish.os@hardcodes.de</a>> wrote:<br>
> There are ways to check for the OS in QtCreator .PRO files, e.g. like<br>
><br>
> unix:symbian{ # do stuff}<br>
> unix:maemo5{ # do stuff}<br>
> macx{ # do stuff}<br>
> win32{ # do stuff}<br>
><br>
> Is there a way to check (or control to be more precise) that some directives are only used when compiling on the MerSDL VM?<br>
> Just checking for the presence of "sailfishapp" does not work, because that is defined for any OS.<br>
<br>
<br>
</div>In general, it might just be easier (and more maintainable) to have a per-platform .pro file for your project and not litter your .pro file with lots of conditionals (been there, done that - it will become hard to read, understand and maintain as the number of platforms grows). If there’s a lot of common things that you need in each file, put that in a .pri file and include it in each platform-specific .pro file. Then, in the sailfish .spec, you can call qmake on the sailfish-specific project file, in the Maemo 5 debian/rules script, you call qmake on the maemo5 .pro file, etc…<br>

<br>
With that said, you can use packagesExist[1] to do sailfish-specific things if you are convinced that a single .pro file really is the way to go:<br>
<br>
packagesExist(sailfishapp) { .. do stuff .. }<br>
<br>
Alternatively, set an environment variable in the qmake call in the .spec file and check for that variable in the .pro file:<br>
<br>
# In the .spec file:<br>
IS_SAILFISH_OS=1 qmake<br>
<br>
# In the .pro file:<br>
IS_SAILFISH_OS = $$(IS_SAILFISH_OS)<br>
contains(IS_SAILFISH_OS, 1) {<br>
    .. do stuff ..<br>
}<br>
<br>
<br>
HTH :)<br>
Thomas<br>
<br>
[1] <a href="http://qt-project.org/doc/qt-4.8/qmake-function-reference.html#packagesexist-packages" target="_blank">http://qt-project.org/doc/qt-4.8/qmake-function-reference.html#packagesexist-packages</a><br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
</div></div></blockquote></div><br></div>