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

Toralf Lund toralf.lund at pgs.com
Fri Apr 12 11:28:58 CEST 2019


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? 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



More information about the Qt-creator mailing list