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`.
This commit is contained in:
Martchus 2020-02-04 17:09:47 +01:00
parent fe43824c98
commit 30878fab07
1 changed files with 7 additions and 0 deletions

View File

@ -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}")