Commit 46d2b395 authored by Nico Schlömer's avatar Nico Schlömer

proper SOVERSION and VERSION setting on libraries

parent 1648a55e
......@@ -14,6 +14,10 @@ endif()
set(XDMF_LIBNAME "Xdmf" CACHE STRING "Name for this xdmf library to avoid collision")
set(XDMF_MAJOR_VERSION 3)
set(XDMF_MINOR_VERSION 0)
set(XDMF_VERSION "${XDMF_MAJOR_VERSION}.${XDMF_MINOR_VERSION}")
if(BUILD_SHARED_LIBS)
set(LIBTYPE SHARED)
set(BUILD_SHARED 1)
......@@ -332,17 +336,29 @@ if(NOT XDMF_BUILD_CORE_ONLY)
if(XDMF_STATIC_AND_SHARED)
add_library(XdmfObjects OBJECT ${XdmfSources})
SET_TARGET_PROPERTIES(
XdmfObjects PROPERTIES
VERSION ${XDMF_VERSION}
SOVERSION ${XDMF_MAJOR_VERSION}
)
set_target_properties(XdmfObjects PROPERTIES
POSITION_INDEPENDENT_CODE True)
add_library(${XDMF_LIBNAME} $<TARGET_OBJECTS:XdmfObjects>)
if (BUILD_SHARED_LIBS)
add_library(Xdmf_Static STATIC $<TARGET_OBJECTS:XdmfObjects>)
set_target_properties(Xdmf_Static PROPERTIES
OUTPUT_NAME "Xdmf")
set_target_properties(
Xdmf_Static PROPERTIES
OUTPUT_NAME "Xdmf"
)
endif (BUILD_SHARED_LIBS)
else()
add_library(${XDMF_LIBNAME} ${LIBTYPE} ${XdmfSources})
endif()
SET_TARGET_PROPERTIES(
${XDMF_LIBNAME} PROPERTIES
VERSION ${XDMF_VERSION}
SOVERSION ${XDMF_MAJOR_VERSION}
)
if(XDMF_BUILD_DSM)
target_link_libraries(${XDMF_LIBNAME} XdmfCore XdmfDSM)
if(XDMF_STATIC_AND_SHARED AND BUILD_SHARED_LIBS)
......@@ -414,7 +430,7 @@ if(NOT XDMF_BUILD_CORE_ONLY)
if(WIN32)
set(XDMF_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/${XDMF_LIBNAME}.lib)
endif()
if(UNIX)
if (BUILD_SHARED_LIBS)
set(XDMF_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/lib${XDMF_LIBNAME}.so)
......@@ -426,11 +442,11 @@ if(NOT XDMF_BUILD_CORE_ONLY)
if(APPLE)
set(XDMF_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/lib${XDMF_LIBNAME}.dylib)
endif()
file(GLOB XdmfHeaders
"*.hpp"
"*.tpp"
"*.i"
file(GLOB XdmfHeaders
"*.hpp"
"*.tpp"
"*.i"
"CMake/VersionSuite/*.hpp"
"${CMAKE_CURRENT_BINARY_DIR}/*.hpp"
)
......
......@@ -163,17 +163,31 @@ endif()
if (XDMF_STATIC_AND_SHARED)
add_library(XdmfCoreObjects OBJECT ${XdmfCoreSources})
set_target_properties(XdmfCoreObjects PROPERTIES
POSITION_INDEPENDENT_CODE True)
SET_TARGET_PROPERTIES(
XdmfCoreObjects PROPERTIES
VERSION ${XDMF_VERSION}
SOVERSION ${XDMF_MAJOR_VERSION}
)
set_target_properties(
XdmfCoreObjects PROPERTIES
POSITION_INDEPENDENT_CODE True
)
add_library(XdmfCore ${LIBTYPE} $<TARGET_OBJECTS:XdmfCoreObjects>)
if (BUILD_SHARED_LIBS)
add_library(XdmfCore_Static STATIC $<TARGET_OBJECTS:XdmfCoreObjects>)
set_target_properties(XdmfCore_Static PROPERTIES
OUTPUT_NAME "XdmfCore")
set_target_properties(
XdmfCore_Static PROPERTIES
OUTPUT_NAME "XdmfCore"
)
endif (BUILD_SHARED_LIBS)
else()
add_library(XdmfCore ${LIBTYPE} ${XdmfCoreSources})
endif()
SET_TARGET_PROPERTIES(
XdmfCore PROPERTIES
VERSION ${XDMF_VERSION}
SOVERSION ${XDMF_MAJOR_VERSION}
)
link_directories(${XDMF_LIBRARY_DIRS})
......
......@@ -90,9 +90,19 @@ if (XDMF_DSM_IS_CRAY)
endif (XDMF_DSM_IS_CRAY)
add_library(XdmfDSMObjects OBJECT ${XdmfDSMSources})
SET_TARGET_PROPERTIES(
XdmfDSMObjects PROPERTIES
VERSION ${XDMF_VERSION}
SOVERSION ${XDMF_MAJOR_VERSION}
)
set_target_properties(XdmfDSMObjects PROPERTIES
POSITION_INDEPENDENT_CODE True)
add_library(XdmfDSM $<TARGET_OBJECTS:XdmfDSMObjects>)
SET_TARGET_PROPERTIES(
XdmfDSM PROPERTIES
VERSION ${XDMF_VERSION}
SOVERSION ${XDMF_MAJOR_VERSION}
)
if (BUILD_SHARED_LIBS)
add_library(XdmfDSM_Static STATIC $<TARGET_OBJECTS:XdmfDSMObjects>)
if (UNIX)
......
......@@ -94,6 +94,11 @@ endif(XDMF_BUILD_PARTITIONER)
if (XDMF_STATIC_AND_SHARED)
add_library(XdmfUtilsObjects OBJECT ${XdmfUtilsSources})
SET_TARGET_PROPERTIES(
XdmfUtilsObjects PROPERTIES
VERSION ${XDMF_VERSION}
SOVERSION ${XDMF_MAJOR_VERSION}
)
set_target_properties(XdmfUtilsObjects PROPERTIES
POSITION_INDEPENDENT_CODE True)
add_library(XdmfUtils $<TARGET_OBJECTS:XdmfUtilsObjects>)
......@@ -107,6 +112,11 @@ if (XDMF_STATIC_AND_SHARED)
else ()
add_library(XdmfUtils ${XdmfUtilsSources})
endif ()
SET_TARGET_PROPERTIES(
XdmfUtils PROPERTIES
VERSION ${XDMF_VERSION}
SOVERSION ${XDMF_MAJOR_VERSION}
)
target_link_libraries(XdmfUtils ${XdmfUtilsLinkLibraries})
if (BUILD_SHARED_LIBS)
......@@ -169,7 +179,7 @@ if(XDMF_BUILD_FORTRAN)
endif(XDMF_BUILD_FORTRAN)
install(FILES ${XdmfUtilsHeaders} DESTINATION include)
install(TARGETS XdmfUtils
install(TARGETS XdmfUtils
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
......@@ -179,7 +189,7 @@ install(TARGETS XdmfUtils_Static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif (BUILD_SHARED_LIBS)
install(TARGETS ${XdmfUtilsExecutables}
install(TARGETS ${XdmfUtilsExecutables}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment