Converting a Unix path to windows in QMake Script

In any case, in order to get the Windows style path to the directory containing .pro, or convert what is stored in _PRO_FILE_PWD_to a Windows style path?


I have a problem with a variable _PRO_FILE_PWD_in Qmake where it returns the unix style path in windows.

eg c:/foo/barinsteadc:\foo\bar

This proves the problem when the path is used as part of the post link stage.

QMAKE_POST_LINK += copy /y $$[QT_INSTALL_BINS]\\QtCore4.dll  $${_PRO_FILE_PWD_}/bin/;

I use the file .proto create a Visual Studio project, and I can see that if I manually changed the fast slash to backslashes in VS, everything was copied perfectly without any errors.

I get the following error in Visual Studio if I do not fix the path.

PostBuildEvent:
1>  Description: copy /y C:\Qt\4.8.3\bin\QtCore4.dll E:/foo/build/win32//bin//;
1>  The syntax of the command is incorrect.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "copy /y C:\Qt\4.8.3\bin\QtCore4.dll E:/foo/build/win32/bin/;
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 1.

Decision

Roku /.

MAKE_POST_LINK += 
    copy /y $$[QT_INSTALL_BINS]\\QtCore4.dll \"$${_PRO_FILE_PWD_}/bin/\";  

, .

.

 MAKE_POST_LINK += 
        copy /y $$[QT_INSTALL_BINS]\\QtCore4.dll \"$${_PRO_FILE_PWD_}/bin/\" &
    MAKE_POST_LINK += 
        copy /y $$[QT_INSTALL_BINS]\\QtGui4.dll \"$${_PRO_FILE_PWD_}/bin/\";  
+5
3

, , /characters:

QMAKE_POST_LINK += 
    copy /y $$[QT_INSTALL_BINS]\\QtCore4.dll \"$${_PRO_FILE_PWD_}/bin/\";
+1

$$shell_path() , :

QMAKE_POST_LINK += copy /y "$$shell_path($$QT_INSTALL_BINS/QtCore4.dll)" "$$shell_path($$_PROD_FILE_PWD_/bin)"
+11

, , .

. :

copy C:\dev\playground\qt\SampleProject\debug_qt.conf "C:/dev/playground/qt/build-SampleProject-Qt_8_4_6_Desktop-Debug/qt.conf"

:

copy "C:/dev/playground/qt/SampleProject/debug_qt.conf" "C:/dev/playground/qt/build-SampleProject-Qt_8_4_6_Desktop-Debug/qt.conf"

, $$shell_path(path) Qt5.

Qt4, $$replace(string, old_string, new_string) .

:

MY_PATH = $$PWD
message($$replace(MY_PATH, /, \\))
+3

All Articles