From 664d1617be76bbc26f32856aa4fc2a2fc825d00e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 Jul 2022 17:09:32 +0200 Subject: [PATCH] Fix problems with CMake install target Handle DESDIR and spaces in the installation path correctly. Closes #22610. (cherry picked from commit 43d0eb48c15ab87ecb8d20a145f9f374f4ff745e) --- build/cmake/install.cmake | 4 ++-- build/cmake/utils/CMakeLists.txt | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake index 9a2ce91d7f..384c6837b8 100644 --- a/build/cmake/install.cmake +++ b/build/cmake/install.cmake @@ -42,8 +42,8 @@ else() install(DIRECTORY DESTINATION "bin") install(CODE "execute_process( \ COMMAND ${CMAKE_COMMAND} -E create_symlink \ - ${CMAKE_INSTALL_PREFIX}/lib/wx/config/${wxBUILD_FILE_ID} \ - ${CMAKE_INSTALL_PREFIX}/bin/wx-config \ + \"${CMAKE_INSTALL_PREFIX}/lib/wx/config/${wxBUILD_FILE_ID}\" \ + \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wx-config\" \ )" ) endif() diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt index 47bca6f34a..dbed8cc9b3 100644 --- a/build/cmake/utils/CMakeLists.txt +++ b/build/cmake/utils/CMakeLists.txt @@ -30,17 +30,18 @@ if(wxUSE_XRC) BUNDLE DESTINATION "bin" ) - if(NOT WIN32_MSVC_NAMING) + if(NOT WIN32_MSVC_NAMING AND wxBUILD_INSTALL) if(IPHONE) set(EXE_SUFFIX ".app") else() set(EXE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX}) endif() - wx_install(CODE "execute_process( \ + # Don't use wx_install() here to preserve escaping. + install(CODE "execute_process( \ COMMAND ${CMAKE_COMMAND} -E create_symlink \ - ${CMAKE_INSTALL_PREFIX}/bin/${wxrc_output_name}${EXE_SUFFIX} \ - ${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX} \ + \"${CMAKE_INSTALL_PREFIX}/bin/${wxrc_output_name}${EXE_SUFFIX}\" \ + \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX}\" \ )" ) endif()