Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: set correct soname #3585

Merged
merged 1 commit into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
6 changes: 5 additions & 1 deletion thirdparty/perfstubs/perfstubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ configure_file(

add_library(perfstubs perfstubs_api/timer.c)

set_property(TARGET perfstubs PROPERTY OUTPUT_NAME adios2${ADIOS2_LIBRARY_SUFFIX}_perfstubs)
set_target_properties(perfstubs PROPERTIES
OUTPUT_NAME adios2${ADIOS2_LIBRARY_SUFFIX}_perfstubs
VERSION ${ADIOS2_LIBRARY_VERSION}
SOVERSION ${ADIOS2_LIBRARY_SOVERSION}
)

target_link_libraries(perfstubs INTERFACE dl m)

Expand Down