From cfc3609a4efc3528314e371073881128b2534d01 Mon Sep 17 00:00:00 2001 From: BtbN Date: Sat, 25 Jan 2014 21:35:44 +0100 Subject: [PATCH] Fix/Workaround a cmake path seperator escaping bug on Windows --- CMakeLists.txt | 43 ++++++++++++++++++++++++---------- cmake/Modules/ObsHelpers.cmake | 8 +++++++ 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c30ae0cdb..592ba5f57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,8 +73,10 @@ obs_install_additional() # CPack Configuration -if(APPLE) +if(APPLE AND NOT CPACK_GENERATOR) set(CPACK_GENERATOR "Bundle") +elseif(WIN32 AND NOT CPACK_GENERATOR) + set(CPACK_GENERATOR "NSIS" "ZIP") endif() set(CPACK_PACKAGE_NAME "OBS Studio") @@ -86,15 +88,27 @@ set(CPACK_PACKAGE_VERSION_PATCH "1") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OBS Studio - Multi-platform broadcasting software") if(INSTALLER_RUN) + file(TO_NATIVE_PATH "${OBS_EXECUTABLE32_DESTINATION}/obs" _obs32) + file(TO_NATIVE_PATH "${OBS_EXECUTABLE64_DESTINATION}/obs" _obs64) + + #Workaround a cmake bug, remove when fixed + string(REPLACE "\\" "\\\\" _obs32 "${_obs32}") + string(REPLACE "\\" "\\\\" _obs64 "${_obs64}") + set(CPACK_PACKAGE_EXECUTABLES - "${OBS_EXECUTABLE32_DESTINATION}/obs" "OBS Studio (32bit)" - "${OBS_EXECUTABLE64_DESTINATION}/obs" "OBS Studio (64bit)") + "${_obs32}" "OBS Studio (32bit)" + "${_obs64}" "OBS Studio (64bit)") set(CPACK_CREATE_DESKTOP_LINKS - "${OBS_EXECUTABLE32_DESTINATION}/obs" - "${OBS_EXECUTABLE64_DESTINATION}/obs") + "${_obs32}" + "${_obs64}") else() - set(CPACK_PACKAGE_EXECUTABLES "${OBS_EXECUTABLE_DESTINATION}/obs;OBS Studio") - set(CPACK_CREATE_DESKTOP_LINKS "${OBS_EXECUTABLE_DESTINATION}/obs") + file(TO_NATIVE_PATH "${OBS_EXECUTABLE_DESTINATION}/obs" _obs) + + #Workaround a cmake bug, remove when fixed + string(REPLACE "\\" "\\\\" _obs "${_obs}") + + set(CPACK_PACKAGE_EXECUTABLES "${_obs}" "OBS Studio") + set(CPACK_CREATE_DESKTOP_LINKS "${_obs}") endif() set(CPACK_BUNDLE_NAME "OBS Studio") @@ -107,20 +121,23 @@ set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") set(CPACK_NSIS_MODIFY_PATH ON) if(INSTALLER_RUN) - SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OBSStudio") - SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") + set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OBSStudio") + set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") + set(CPACK_PACKAGE_FILE_NAME "obs-studio") elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) if(WIN32) set(CPACK_PACKAGE_NAME "OBS Studio (64bit)") endif() - SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OBSStudio64") - SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") + set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OBSStudio64") + set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") + set(CPACK_PACKAGE_FILE_NAME "obs-studio-x64") else() if(WIN32) set(CPACK_PACKAGE_NAME "OBS Studio (32bit)") endif() - SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OBSStudio32") - SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES32") + set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OBSStudio32") + set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES32") + set(CPACK_PACKAGE_FILE_NAME "obs-studio-x86") endif() include(CPack) diff --git a/cmake/Modules/ObsHelpers.cmake b/cmake/Modules/ObsHelpers.cmake index 7ad5e4110..afe1c4149 100644 --- a/cmake/Modules/ObsHelpers.cmake +++ b/cmake/Modules/ObsHelpers.cmake @@ -19,6 +19,14 @@ if(INSTALLER_RUN AND NOT DEFINED ENV{obsInstallerTempDir}) message(FATAL_ERROR "Environment variable obsInstallerTempDir is needed for multiarch installer generation") endif() +if(DEFINED ENV{obsInstallerTempDir}) + file(TO_CMAKE_PATH "$ENV{obsInstallerTempDir}" ENV{obsInstallerTempDir}) +endif() + +if(DEFINED ENV{obsAdditionalInstallFiles}) + file(TO_CMAKE_PATH "$ENV{obsAdditionalInstallFiles}" ENV{obsAdditionalInstallFiles}) +endif() + if(NOT UNIX_STRUCTURE) set(OBS_DATA_DESTINATION "data") if(APPLE)