ENH: Using separate CMAKE_SHARED_LIBRARY_SONAME flags for C and CXX.
This commit is contained in:
parent
9a096e8488
commit
c1add9106c
|
@ -43,7 +43,7 @@
|
||||||
# create a shared C++ library
|
# create a shared C++ library
|
||||||
IF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
|
IF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
|
||||||
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
|
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
|
||||||
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||||
ENDIF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
|
ENDIF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
|
||||||
|
|
||||||
# create a c++ shared module copy the shared library rule by default
|
# create a c++ shared module copy the shared library rule by default
|
||||||
|
@ -54,7 +54,7 @@ ENDIF(NOT CMAKE_CXX_CREATE_SHARED_MODULE)
|
||||||
# create a C shared library
|
# create a C shared library
|
||||||
IF(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
|
IF(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
|
||||||
SET(CMAKE_C_CREATE_SHARED_LIBRARY
|
SET(CMAKE_C_CREATE_SHARED_LIBRARY
|
||||||
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||||
ENDIF(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
|
ENDIF(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
|
||||||
|
|
||||||
# create a C shared module just copy the shared library rule
|
# create a C shared module just copy the shared library rule
|
||||||
|
|
|
@ -7,4 +7,5 @@ SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
|
||||||
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-rdynamic")
|
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-rdynamic")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
|
||||||
SET(CMAKE_SHARED_LIBRARY_SONAME_FLAG "-Wl,-soname,")
|
SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
|
||||||
|
SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,")
|
||||||
|
|
|
@ -3,7 +3,8 @@ IF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
|
||||||
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r")
|
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-R")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-R")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
|
||||||
SET(CMAKE_SHARED_LIBRARY_SONAME_FLAG "-h")
|
SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h")
|
||||||
|
SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h")
|
||||||
ENDIF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
|
ENDIF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
|
||||||
|
|
||||||
IF(CMAKE_SYSTEM MATCHES "SunOS-5*.")
|
IF(CMAKE_SYSTEM MATCHES "SunOS-5*.")
|
||||||
|
@ -11,7 +12,8 @@ IF(CMAKE_SYSTEM MATCHES "SunOS-5*.")
|
||||||
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G")
|
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-R")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-R")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
|
||||||
SET(CMAKE_SHARED_LIBRARY_SONAME_FLAG "-h")
|
SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h")
|
||||||
|
SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h")
|
||||||
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC")
|
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC")
|
||||||
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G")
|
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R")
|
||||||
|
@ -21,20 +23,21 @@ IF(CMAKE_SYSTEM MATCHES "SunOS-5*.")
|
||||||
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
|
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-R")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-R")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
|
||||||
SET(CMAKE_SHARED_LIBRARY_SONAME_FLAG "-Wl,-h")
|
SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-h")
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC")
|
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC")
|
||||||
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared")
|
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-R")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-R")
|
||||||
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":")
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":")
|
||||||
|
SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-h")
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
ENDIF(CMAKE_SYSTEM MATCHES "SunOS-5*.")
|
ENDIF(CMAKE_SYSTEM MATCHES "SunOS-5*.")
|
||||||
|
|
||||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
|
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
|
||||||
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||||
ELSE(CMAKE_COMPILER_IS_GNUCC)
|
ELSE(CMAKE_COMPILER_IS_GNUCC)
|
||||||
# Take default rule from CMakeDefaultMakeRuleVariables.cmake.
|
# Take default rule from CMakeDefaultMakeRuleVariables.cmake.
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
|
|
@ -935,7 +935,8 @@ static RuleVariables ruleReplaceVars[] =
|
||||||
|
|
||||||
{"<CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS>", "CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS"},
|
{"<CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS>", "CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS"},
|
||||||
{"<CMAKE_SHARED_MODULE_CREATE_C_FLAGS>", "CMAKE_SHARED_MODULE_CREATE_C_FLAGS"},
|
{"<CMAKE_SHARED_MODULE_CREATE_C_FLAGS>", "CMAKE_SHARED_MODULE_CREATE_C_FLAGS"},
|
||||||
{"<CMAKE_SHARED_LIBRARY_SONAME_FLAG>", "CMAKE_SHARED_LIBRARY_SONAME_FLAG"},
|
{"<CMAKE_SHARED_LIBRARY_SONAME_C_FLAG>", "CMAKE_SHARED_LIBRARY_SONAME_C_FLAG"},
|
||||||
|
{"<CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG>", "CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG"},
|
||||||
{"<CMAKE_C_LINK_FLAGS>", "CMAKE_C_LINK_FLAGS"},
|
{"<CMAKE_C_LINK_FLAGS>", "CMAKE_C_LINK_FLAGS"},
|
||||||
|
|
||||||
{"<CMAKE_AR>", "CMAKE_AR"},
|
{"<CMAKE_AR>", "CMAKE_AR"},
|
||||||
|
@ -1020,7 +1021,7 @@ cmLocalUnixMakefileGenerator::ExpandRuleVariables(std::string& s,
|
||||||
}
|
}
|
||||||
if(targetSOName)
|
if(targetSOName)
|
||||||
{
|
{
|
||||||
if(m_Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_SONAME_FLAG"))
|
if(m_Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_SONAME_C_FLAG"))
|
||||||
{
|
{
|
||||||
cmSystemTools::ReplaceString(s, "<TARGET_SONAME>", targetSOName);
|
cmSystemTools::ReplaceString(s, "<TARGET_SONAME>", targetSOName);
|
||||||
}
|
}
|
||||||
|
@ -3114,7 +3115,7 @@ void cmLocalUnixMakefileGenerator::GetLibraryNames(const char* n,
|
||||||
const char* soversion = t.GetProperty("SOVERSION");
|
const char* soversion = t.GetProperty("SOVERSION");
|
||||||
if((t.GetType() != cmTarget::SHARED_LIBRARY &&
|
if((t.GetType() != cmTarget::SHARED_LIBRARY &&
|
||||||
t.GetType() != cmTarget::MODULE_LIBRARY) ||
|
t.GetType() != cmTarget::MODULE_LIBRARY) ||
|
||||||
!m_Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_SONAME_FLAG"))
|
!m_Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_SONAME_C_FLAG"))
|
||||||
{
|
{
|
||||||
// Versioning is supported only for shared libraries and modules,
|
// Versioning is supported only for shared libraries and modules,
|
||||||
// and then only when the platform supports an soname flag.
|
// and then only when the platform supports an soname flag.
|
||||||
|
|
Loading…
Reference in New Issue