I'm trying to generate msi-package using CPack WiX Generator.
In my CMakeLists.txt there is CMAKE_INSTALL_PREFIX set to "C:/Program Files/My Project". I need to have the full path, because some significant part of project's source code depends on this path. Also, I split the project into some components, one of which is named core.
I successfully generate Visual Studio solution using cmake-gui. But when I try to build the project PACKAGE, I get the following error:
53>EXEC : CPack error : Problem creating temporary directory: D:/Projects/build-Project-MSVC2015/_CPack_Packages/win64/WIX/project-2.3.0-20.AMD64/coreC:/Program Files/My Project
The same error occurs, when I leave CMAKE_INSTALL_PREFIX empty. In that case this variable is initialized by default to "C:/Program Files/Project_Name" and the rror is:
53>EXEC : CPack error : Problem creating temporary directory: D:/Projects/build-Project-MSVC2015/_CPack_Packages/win64/WIX/project-2.3.0-20.AMD64/coreC:/Program Files/Project_Name
Only when I set CMAKE_INSTALL_PREFIX to just My Project (absent prepending C:/ or /) everything works well. The directory is created as D:/Projects/build-Project-MSVC2015/_CPack_Packages/win64/WIX/project-2.3.0-20.AMD64/coreMy Project and msi-package is created.
It seems, that CPack tries to make DESTDIR="D:/Projects/build-Project-MSVC2015/_CPack_Packages/win64/WIX/project-2.3.0-20.AMD64/core" install as an intermediate step, but as stated at cmake's documentation:
WARNING: DESTDIR may not be used on Windows because installation prefix usually contains a drive letter like in “C:/Program Files” which cannot be prepended with some other prefix.
Do I misunderstand the usage of CMAKE_INSTALL_PREFIX with CPack WiX Generator? Or is this is specific to Visual Studio? Or is there a workaround for this problem, like forcing DESTDIR to be empty (yes, I know that's dangerous)?