From e0a662a3ddfe3c906f81b0a070e4de169e46646e Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 5 Oct 2006 16:30:47 -0400 Subject: [PATCH] ENH: Adding version number to the name of a DLL built in cygwin but not the import library. This addresses bug#3571. --- Modules/Platform/CYGWIN.cmake | 3 +++ Source/cmTarget.cxx | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index 0d508f00b..fe34bfc56 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -28,6 +28,9 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY SET(CMAKE_CXX_CREATE_SHARED_LIBRARY " -o -Wl,--out-implib, ") +# Shared libraries on cygwin can be named with their version number. +SET(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1) + # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links # to other libraries to select whether to use the static or shared diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 24e196a9d..9ac85eead 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1255,6 +1255,17 @@ void cmTarget::GetFullNameInternal(TargetType type, // Append the per-configuration postfix. outBase += configPostfix?configPostfix:""; + // Name shared libraries with their version number on some platforms. + if(const char* version = this->GetProperty("VERSION")) + { + if(type == cmTarget::SHARED_LIBRARY && !implib && + this->Makefile->IsOn("CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION")) + { + outBase += "-"; + outBase += version; + } + } + // Append the suffix. outSuffix = targetSuffix?targetSuffix:""; }