CMakeLists.txt,win32: match naming convention used by nmake

Change-Id: Ib4d5c256b8c90afd54b4d7bcdee8df532095422d
This commit is contained in:
H. Vetinari 2022-07-21 23:57:06 +02:00 committed by James Zern
parent 5000de5435
commit 9ac25bcb39

View File

@ -127,6 +127,13 @@ set(includedir "\$\{prefix\}/include")
set(PTHREAD_LIBS ${CMAKE_THREAD_LIBS_INIT}) set(PTHREAD_LIBS ${CMAKE_THREAD_LIBS_INIT})
set(INSTALLED_LIBRARIES) set(INSTALLED_LIBRARIES)
if(MSVC)
# match the naming convention used by nmake
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
set(CMAKE_IMPORT_LIBRARY_PREFIX "lib")
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
endif()
set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_C_VISIBILITY_PRESET hidden)
# ############################################################################## # ##############################################################################
@ -775,6 +782,13 @@ include(CMakePackageConfigHelpers)
# compatibility purposes, but the library mentioned in WebPConfig.cmake should # compatibility purposes, but the library mentioned in WebPConfig.cmake should
# be the unprefixed version. # be the unprefixed version.
list(TRANSFORM INSTALLED_LIBRARIES REPLACE "libwebpmux" "webpmux") list(TRANSFORM INSTALLED_LIBRARIES REPLACE "libwebpmux" "webpmux")
if(MSVC)
# For compatibility with nmake, MSVC builds use a custom prefix (lib) that
# needs to be included in the library name.
list(TRANSFORM INSTALLED_LIBRARIES
REPLACE "[A-Za-z0-9_]+" "${CMAKE_STATIC_LIBRARY_PREFIX}\\0")
endif()
configure_package_config_file( configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/WebPConfig.cmake.in ${CMAKE_CURRENT_SOURCE_DIR}/cmake/WebPConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/WebPConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/WebPConfig.cmake