Skip to content

Commit

Permalink
cmake: set correct soname
Browse files Browse the repository at this point in the history
  • Loading branch information
vicentebolea committed Apr 11, 2023
1 parent 69be5d1 commit b72dc49
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bindings/C/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ set_target_properties(
adios2_c ${maybe_adios2_c_mpi}
PROPERTIES
VERSION ${ADIOS2_LIBRARY_VERSION}
SOVERSION ${ADIOS2_VERSION_MAJOR}
SOVERSION ${ADIOS2_LIBRARY_SOVERSION}
)

install(TARGETS adios2_c ${maybe_adios2_c_mpi} EXPORT adios2CExports
Expand Down
2 changes: 1 addition & 1 deletion bindings/CXX11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ set_target_properties(
adios2_cxx11 ${maybe_adios2_cxx11_mpi}
PROPERTIES
VERSION ${ADIOS2_LIBRARY_VERSION}
SOVERSION ${ADIOS2_VERSION_MAJOR}
SOVERSION ${ADIOS2_LIBRARY_SOVERSION}
)

install(TARGETS adios2_cxx11 ${maybe_adios2_cxx11_mpi} EXPORT adios2CXX11Exports
Expand Down
4 changes: 2 additions & 2 deletions bindings/Fortran/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ endif()
# Set library version information
set_target_properties(adios2_fortran PROPERTIES
VERSION ${ADIOS2_LIBRARY_VERSION}
SOVERSION ${ADIOS2_VERSION_MAJOR}
SOVERSION ${ADIOS2_LIBRARY_SOVERSION}
)

add_library(adios2::fortran ALIAS adios2_fortran)
Expand Down Expand Up @@ -109,7 +109,7 @@ if(ADIOS2_HAVE_MPI)
target_compile_definitions(adios2_fortran_mpi PRIVATE "$<$<COMPILE_LANGUAGE:Fortran>:ADIOS2_HAVE_FORTRAN_SUBMODULES;ADIOS2_HAVE_MPI_F>")
set_target_properties(adios2_fortran_mpi PROPERTIES
VERSION ${ADIOS2_LIBRARY_VERSION}
SOVERSION ${ADIOS2_VERSION_MAJOR}
SOVERSION ${ADIOS2_LIBRARY_SOVERSION}
)
set_property(TARGET adios2_fortran_mpi PROPERTY OUTPUT_NAME adios2${ADIOS2_LIBRARY_SUFFIX}_fortran_mpi)
else()
Expand Down
19 changes: 19 additions & 0 deletions cmake/ADIOSFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ function(setup_version BASE)
endif()

set(ADIOS2_LIBRARY_VERSION ${BASE} PARENT_SCOPE)

string(REGEX MATCH "^([0-9]+\.[0-9]+)" ignore ${BASE})
set(ADIOS2_LIBRARY_SOVERSION ${CMAKE_MATCH_1} PARENT_SCOPE)
endfunction()

function(adios_option name description default)
Expand Down Expand Up @@ -224,3 +227,19 @@ program main
end program
]] ${var} SRC_EXT F90)
endmacro()

# Set VERSION/SOVERSION of every shared library target in the given directory
# to be the same as the ADIOS VERSION/SOVERSION. This is important for the
# third-party libraries bundled with ADIOS2.
function(setup_libversion_dir dir)
get_directory_property(DIR_TARGETS DIRECTORY "${dir}" BUILDSYSTEM_TARGETS)
foreach(target ${DIR_TARGETS})
get_target_property(type ${target} TYPE)
if (${type} STREQUAL "SHARED_LIBRARY")
set_target_properties(${target} PROPERTIES
VERSION ${ADIOS2_LIBRARY_VERSION}
SOVERSION ${ADIOS2_LIBRARY_SOVERSION}
)
endif()
endforeach()
endfunction()
2 changes: 1 addition & 1 deletion source/adios2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ set_target_properties(
adios2_core ${maybe_adios2_core_mpi}
PROPERTIES
VERSION ${ADIOS2_LIBRARY_VERSION}
SOVERSION ${ADIOS2_VERSION_MAJOR}
SOVERSION ${ADIOS2_LIBRARY_SOVERSION}
)

install(FILES common/ADIOSMacros.h common/ADIOSTypes.h common/ADIOSTypes.inl
Expand Down
2 changes: 1 addition & 1 deletion source/adios2/toolkit/sst/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ endif()
set_target_properties(sst PROPERTIES
OUTPUT_NAME adios2${ADIOS2_LIBRARY_SUFFIX}_sst
VERSION ${ADIOS2_LIBRARY_VERSION}
SOVERSION ${ADIOS2_VERSION_MAJOR}
SOVERSION ${ADIOS2_LIBRARY_SOVERSION}
)

#------------------------------------------------------------------------------#
Expand Down
1 change: 1 addition & 0 deletions thirdparty/EVPath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ set(EVPATH_HEADER_COMPONENT adios2_evpath-development)

add_subdirectory(EVPath)
set(EVPath_DIR ${CMAKE_CURRENT_BINARY_DIR}/EVPath CACHE INTERNAL "")
setup_libversion_dir(EVPath)

message_end_thirdparty()
1 change: 1 addition & 0 deletions thirdparty/atl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ set(ATL_HEADER_COMPONENT adios2_atl-development)

add_subdirectory(atl)
set(atl_DIR ${CMAKE_CURRENT_BINARY_DIR}/atl CACHE INTERNAL "")
setup_libversion_dir(atl)

message_end_thirdparty()
1 change: 1 addition & 0 deletions thirdparty/dill/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ set(DILL_HEADER_COMPONENT adios2_dill-development)

add_subdirectory(dill)
set(dill_DIR ${CMAKE_CURRENT_BINARY_DIR}/dill CACHE INTERNAL "")
setup_libversion_dir(dill)

message_end_thirdparty()
1 change: 1 addition & 0 deletions thirdparty/enet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ set(BUILD_DOCS OFF)

add_subdirectory(enet)
set(enet_DIR ${CMAKE_CURRENT_BINARY_DIR}/enet CACHE INTERNAL "")
setup_libversion_dir(enet)

message_end_thirdparty()
1 change: 1 addition & 0 deletions thirdparty/ffs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ set(FFS_HEADER_COMPONENT adios2_ffs-development)

add_subdirectory(ffs)
set(ffs_DIR ${CMAKE_CURRENT_BINARY_DIR}/ffs CACHE INTERNAL "")
setup_libversion_dir(ffs)

message_end_thirdparty()
2 changes: 2 additions & 0 deletions thirdparty/perfstubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ if (PERFSTUBS_USE_TIMERS)
target_link_libraries(perfstubs-interface INTERFACE perfstubs)
endif()

setup_libversion_dir(perfstubs)

message_end_thirdparty()

0 comments on commit b72dc49

Please sign in to comment.