From 600bf54a06a0f11fdfa2e2c2607d586446363a26 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 19 Jul 2022 17:52:39 +0200 Subject: [PATCH] Use DESTDIR when creating symlinks in CMake install Prepend $ENV{DESTDIR}, sufficiently escaped to delay its expansion until the execution of "cmake -E create_symlink" command, to the command path arguments. Closes #22653. See #22610. --- build/cmake/install.cmake | 2 +- build/cmake/utils/CMakeLists.txt | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake index 020fa860a2e9..384c6837b814 100644 --- a/build/cmake/install.cmake +++ b/build/cmake/install.cmake @@ -43,7 +43,7 @@ else() 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\" \ + \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wx-config\" \ )" ) endif() diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt index dbfedec79f75..dbed8cc9b3bb 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}\" \ + \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX}\" \ )" ) endif()