Fix problems with CMake install target

Handle DESDIR and spaces in the installation path correctly.

Closes #22610.

(cherry picked from commit 43d0eb48c15ab87ecb8d20a145f9f374f4ff745e)
This commit is contained in:
Vadim Zeitlin 2022-07-24 17:09:32 +02:00
parent 34ab0ac7f0
commit 664d1617be
2 changed files with 7 additions and 6 deletions

View File

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

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} \
\"${CMAKE_INSTALL_PREFIX}/bin/${wxrc_output_name}${EXE_SUFFIX}\" \
\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX}\" \
)"
)
endif()