From e2f170ddd522715e83fc0b1345200f61adfc95e4 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 10 Oct 2020 16:45:58 +0200 Subject: [PATCH] Fix install-mingw-w64-strip (and underlying targets) * Fix escaping issues with Ninja * Use `$` to avoid hard-coding library extensions --- cmake/modules/LibraryTarget.cmake | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/cmake/modules/LibraryTarget.cmake b/cmake/modules/LibraryTarget.cmake index c81ab69..4e13a86 100644 --- a/cmake/modules/LibraryTarget.cmake +++ b/cmake/modules/LibraryTarget.cmake @@ -545,25 +545,20 @@ if (NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS) else () message(STATUS "Using strip binary under \"${STRIP_BINARY_PATH}\".") endif () - if (BUILD_SHARED_LIBS AND NOT META_HEADER_ONLY_LIB) + if (NOT META_HEADER_ONLY_LIB) + if (CMAKE_GENERATOR STREQUAL "Ninja") + set(DESTDIR "\$\$\{DESTDIR\}\$\$\{DESTDIR:+/\}") + else () + set(DESTDIR "\$\{DESTDIR\}\$\{DESTDIR:+/\}") + endif () add_custom_target( - install-${META_TARGET_NAME}-mingw-w64-importlib-strip + install-${META_TARGET_NAME}-mingw-w64-linker-file-strip COMMAND "${STRIP_BINARY_PATH}" -g - "\$\{DESTDIR\}\$\{DESTDIR:+/\}${CMAKE_INSTALL_FULL_LIBDIR}${SELECTED_LIB_SUFFIX}/lib${META_TARGET_NAME}.dll.a" + "${DESTDIR}${CMAKE_INSTALL_FULL_LIBDIR}${SELECTED_LIB_SUFFIX}/$" ) - add_dependencies(install-${META_TARGET_NAME}-mingw-w64-importlib-strip install-binary-strip) - add_dependencies(install-mingw-w64-strip install-${META_TARGET_NAME}-mingw-w64-importlib-strip) - endif () - if (BUILD_STATIC_LIBS AND NOT META_HEADER_ONLY_LIB) - add_custom_target( - install-${META_TARGET_NAME}-mingw-w64-staticlib-strip - COMMAND - "${STRIP_BINARY_PATH}" -g - "\$\{DESTDIR\}\$\{DESTDIR:+/\}${CMAKE_INSTALL_FULL_LIBDIR}${SELECTED_LIB_SUFFIX}/lib${META_TARGET_NAME}.a" - ) - add_dependencies(install-${META_TARGET_NAME}-mingw-w64-staticlib-strip install-binary-strip) - add_dependencies(install-mingw-w64-strip install-${META_TARGET_NAME}-mingw-w64-staticlib-strip) + add_dependencies(install-${META_TARGET_NAME}-mingw-w64-linker-file-strip install-binary-strip) + add_dependencies(install-mingw-w64-strip install-${META_TARGET_NAME}-mingw-w64-linker-file-strip) endif () endif () endif ()