CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(IMPLIB C) SET(CMAKE_VERBOSE_MAKEFILE ON) FILE(WRITE ${CMAKE_BINARY_DIR}/f.c "__declspec(dllexport) void f(void){}\n") ADD_LIBRARY(f SHARED f.c) SET_TARGET_PROPERTIES(f PROPERTIES DEBUG_POSTFIX "80") INSTALL(TARGETS f RUNTIME DESTINATION bin ARCHIVE DESTINATION lib) GET_TARGET_PROPERTY(F0 f LOCATION_DEBUG) GET_FILENAME_COMPONENT(F0 "${F0}" NAME_WE) STRING(REGEX REPLACE "80\$" "" F "${F0}") INSTALL(CODE "FILE(RENAME \"${CMAKE_INSTALL_PREFIX}/lib/${F0}.lib\" \"${CMAKE_INSTALL_PREFIX}/lib/${F}.lib\")")