Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Add SOVERSION when build shared libmxnet.so library
Browse files Browse the repository at this point in the history
  • Loading branch information
sl1pkn07 committed Mar 11, 2020
1 parent 713d962 commit c212d7c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
cmake_minimum_required(VERSION 3.13)

file(READ "include/mxnet/base.h" ver)
string(REGEX MATCH "MXNET_MAJOR ([0-9]*)" _ ${ver})
set(ver_major ${CMAKE_MATCH_1})
string(REGEX MATCH "MXNET_MINOR ([0-9]*)" _ ${ver})
set(ver_minor ${CMAKE_MATCH_1})
string(REGEX MATCH "MXNET_PATCH ([0-9]*)" _ ${ver})
set(ver_patch ${CMAKE_MATCH_1})
set(_PROJECT_VERSION "${ver_major}.${ver_minor}.${ver_patch}")

# workaround to store CMAKE_CROSSCOMPILING because is getting reset by the project command
if(CMAKE_CROSSCOMPILING)
set(__CMAKE_CROSSCOMPILING ${CMAKE_CROSSCOMPILING})
Expand Down Expand Up @@ -704,6 +713,8 @@ if(UNIX)
target_link_libraries(mxnet PRIVATE mxnet_static)
target_link_libraries(mxnet_static PUBLIC ${CMAKE_DL_LIBS})
set_target_properties(mxnet_static PROPERTIES OUTPUT_NAME mxnet)
set_target_properties(mxnet PROPERTIES VERSION "${ver_major}.${ver_minor}.${ver_patch}")
set_target_properties(mxnet PROPERTIES SOVERSION "${ver_major}")
if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
target_compile_options(mxnet_static PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Werror>")
# Ignore erroneous compiler warnings:
Expand Down

0 comments on commit c212d7c

Please sign in to comment.