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.
This commit is contained in:
Maarten Bent 2022-07-19 17:52:39 +02:00 committed by Vadim Zeitlin
parent e4f230a3e1
commit 600bf54a06
2 changed files with 5 additions and 4 deletions

View file

@ -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()

View file

@ -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()