[Qt-creator] Running "install" on one sub directory for CMake (variable/substitution issue)

Toralf Lund toralf.lund at pgs.com
Fri Apr 12 12:18:57 CEST 2019


On 12/04/2019 11:53, Eike Ziller wrote:
>
>> On 12. Apr 2019, at 11:28, Toralf Lund <toralf.lund at pgs.com> wrote:
>>
>> Hei
>>
>> In my CMake project, I'm trying to set up a configuration that does and "install" type build only on the directory of the current document or possibly of the current executable. Technically, I can achieve what I want by running
>>
>> cmake --build . --target install -- -C <relative path>
>>
>> on the "top" build directory, where <relative path> is the file's directory relative to the "project directory", but how do I express that in Qt Creator?
> %{JS: Util.relativeFilePath(‘%{CurrentDocument:Path}’, ‘%{CurrentProject:Path}’) }
>
> should work :)

It looks like it wants double quotes rather than single, but other than 
that, it works.

I never noticed the JavaScript option. Thanks!


>
>> I can't seem to find variables for relative paths, or a reliable and general way to remove the initial path components. I mean, the path I want is something like
>>
>> %{CurrentDocument:Path/%{CurrentProject:Path}/}
>>
>> but that substitution won't work because %{CurrentProject:Path} also contains '/'. (This is on a Linux system.)
>>
>> I've actually managed to set up a working config for my source code tree via pattern containing hard-coded path components, but that does not seem entirely ideal.
>>
>> So, is there a way I can get "project-relative" paths? Or can anyone think of a better way to achieve what I want? I know there is special support for building the current executable, but that's not exactly what I'm looking for - I'd like to build and install everything on its directory.
>>
>> - Toralf
>>
>> _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at qt-project.org
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.qt-2Dproject.org_listinfo_qt-2Dcreator&d=DwIGaQ&c=KV_I7O14pmwRcmAVyJ1eg4Jwb8Y2JAxuL5YgMGHpjcQ&r=Q0oqxzgUp3xCCIiJDwS-RbNDndQ-KZDhj8wwveNoqU4&m=US6JivPqbFDv-_wtqEws_Swh7nJcHNV--WwXaj-PKKY&s=CKxIvSM-msST_FTNKFVy_LjWckNvgTzN22XO3-nasj4&e=




More information about the Qt-creator mailing list