Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/InstallationHelper.cmake
Show All 26 Lines | if(_target_type STREQUAL "SHARED_LIBRARY") | ||||
target_sources(${NAME} PRIVATE ${_sources}) | target_sources(${NAME} PRIVATE ${_sources}) | ||||
else() | else() | ||||
set(_shared_name "${NAME}-shared") | set(_shared_name "${NAME}-shared") | ||||
add_library(${_shared_name} SHARED ${_sources}) | add_library(${_shared_name} SHARED ${_sources}) | ||||
target_link_libraries(${_shared_name} ${NAME}) | target_link_libraries(${_shared_name} ${NAME}) | ||||
endif() | endif() | ||||
if(ARG_PUBLIC_HEADER) | if(ARG_PUBLIC_HEADER) | ||||
list(APPEND _properties PUBLIC_HEADER ${ARG_PUBLIC_HEADER}) | set_property(TARGET ${_shared_name} PROPERTY PUBLIC_HEADER ${ARG_PUBLIC_HEADER}) | ||||
endif() | endif() | ||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||||
# FIXME For compatibility reason with autotools, the version is set | # FIXME For compatibility reason with autotools, the version is set | ||||
# to 0.0.0 (major being actually 0). This is obviously wrong and the | # to 0.0.0 (major being actually 0). This is obviously wrong and the | ||||
# version of the library should reflect the version of the release. | # version of the library should reflect the version of the release. | ||||
# On platforms other than linux, only the major version (0) is used. | # On platforms other than linux, only the major version (0) is used. | ||||
# Replace the VERSION line with the statement below to set the | # Replace the VERSION line with the statement below to set the | ||||
# correct version: | # correct version: | ||||
# set(_properties VERSION "${bitcoin-abc_VERSION}") | # set(_properties VERSION "${CMAKE_PROJECT_VERSION}") | ||||
list(APPEND _properties VERSION "${bitcoin-abc_VERSION_MAJOR}.0.0") | list(APPEND _properties VERSION "${CMAKE_PROJECT_VERSION_MAJOR}.0.0") | ||||
else() | else() | ||||
list(APPEND _properties VERSION "${bitcoin-abc_VERSION_MAJOR}") | list(APPEND _properties VERSION "${CMAKE_PROJECT_VERSION_MAJOR}") | ||||
endif() | endif() | ||||
# For autotools compatibility, rename the library to ${OUTPUT_NAME}-0.dll | # For autotools compatibility, rename the library to ${OUTPUT_NAME}-0.dll | ||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | ||||
list(APPEND _properties OUTPUT_NAME "${NAME}-${bitcoin-abc_VERSION_MAJOR}") | list(APPEND _properties OUTPUT_NAME "${NAME}-${CMAKE_PROJECT_VERSION_MAJOR}") | ||||
# DLL_EXPORT is defined by libtool, and is expected by some sources. | # DLL_EXPORT is defined by libtool, and is expected by some sources. | ||||
target_compile_definitions(${_shared_name} PRIVATE DLL_EXPORT) | target_compile_definitions(${_shared_name} PRIVATE DLL_EXPORT) | ||||
else() | else() | ||||
list(APPEND _properties OUTPUT_NAME "${NAME}") | list(APPEND _properties OUTPUT_NAME "${NAME}") | ||||
endif() | endif() | ||||
list(APPEND _properties SOVERSION "${bitcoin-abc_VERSION_MAJOR}") | list(APPEND _properties SOVERSION "${CMAKE_PROJECT_VERSION_MAJOR}") | ||||
set_target_properties(${_shared_name} PROPERTIES ${_properties}) | set_target_properties(${_shared_name} PROPERTIES ${_properties}) | ||||
install_target(${_shared_name}) | install_target(${_shared_name}) | ||||
endfunction() | endfunction() |