PDA

View Full Version : It is possible to rename file with qmake



themean
20th June 2012, 09:55
Hi
I want to create "make install" for my project. I use INSTALLS variable and all works fine but i want installed file to be renamed. How i can achieve this
I trying this


Install.path = path/for/installation

install.file = file.something

install.name = newname.somthingelse

INSTALLS += install

but this don't work. I know about install.extra but don't know how to use this variable

ChrisW67
23rd June 2012, 06:57
You can do it this way (at the expense of a copy that does not get cleaned up):


TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

unix {
target.path = /tmp/installpath
INSTALLS += target

extra_install.path = /tmp/installpath
extra_install.files = renamed.txt
extra_install.extra = cp test.txt renamed.txt
INSTALLS += extra_install
}

# Input
SOURCES += main.cpp
OTHER_FILES += test.txt

The extra command can be a whole script.

Atlantis70
20th December 2012, 09:00
Hi @all,

the mentioned approach will work fine using unix/linux. However, what if you want to make the same for Windows?
Of course I could add a similar section for win32. But then the pathes need backslashes \ rather than forwar slashes / :( (because of "copy") and if I want to use path-variables, I will have to declare them for unix and win32 separately :crying:

It would be nice, if there would be a possibility to install a (extra) target under a different name, which is not platform dependent ...

Best,

Thorsten





TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

target.path = ../tmp/installpath # will not work for win32
win32: target.path = ..\tmp\installpath # is necessary only due to "copy"

extra_install.path =$$target.path
extra_install.files = renamed.txt

unix {
extra_install.extra = cp test.txt renamed.txt
}
win32 {
extra_install.extra = copy test.txt renamed.txt
}

INSTALLS += target
INSTALLS += extra_install
# Input
SOURCES += main.cpp
OTHER_FILES += test.txt

wysota
20th December 2012, 09:22
You can convert slashes to backslashes using a regular expression in qmake directive if that's the problem.

Atlantis70
20th December 2012, 10:11
Well - that's it exactly ...

[CODE]
$replace(install_gspf.path,'/','\\')\\GSPFKrnl.exe
[CODE]

did the job ... Thx