From 30878fab07d2870d24ad3552166da2669b8cd9d0 Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 4 Feb 2020 17:09:47 +0100 Subject: [PATCH] Prevent duplicated LIB_SUFFIX Some build system macros might pass CMAKE_INSTALL_LIBDIR/LIB_INSTALL_DIR and LIB_SUFFIX at the same time. I suppose in this case the LIB_SUFFIX should not be added if it is already present to avoid `lib6464`. --- cmake/modules/BasicConfig.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/modules/BasicConfig.cmake b/cmake/modules/BasicConfig.cmake index d7e0c75..1413385 100644 --- a/cmake/modules/BasicConfig.cmake +++ b/cmake/modules/BasicConfig.cmake @@ -538,6 +538,13 @@ if (LIB_SUFFIX_64 AND CMAKE_SIZEOF_VOID_P MATCHES "8") elseif (LIB_SUFFIX_32 AND CMAKE_SIZEOF_VOID_P MATCHES "4") set(SELECTED_LIB_SUFFIX "${LIB_SUFFIX_32}") endif () + +# ignore LIB_SUFFIX variables if CMAKE_INSTALL_LIBDIR ends with that suffix anyways (%cmake RPM macro apparently passes +# LIB_SUFFIX and CMAKE_INSTALL_LIBDIR/LIB_INSTALL_DIR at the same time) +if (CMAKE_INSTALL_LIBDIR MATCHES ".*${SELECTED_LIB_SUFFIX}$") + set(SELECTED_LIB_SUFFIX "") +endif () + set(BIN_INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") set(LIB_INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${SELECTED_LIB_SUFFIX}")