Skip to content

Commit 51cdabf

Browse files
authored
fix: Allow to disable so-version (#32)
1 parent 0600a3c commit 51cdabf

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [0.5.5](https://github.com/rdkcentral/firebolt-cpp-client/compare/v0.5.4...v0.5.5)
2+
3+
### Changed
4+
- Allow building without a SONAME
5+
16
## [0.5.4](https://github.com/rdkcentral/firebolt-cpp-client/compare/v0.5.3...v0.5.4)
27

38
### Fixed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ option(DISCOVER_UT "Discover all Unit Tests" ON)
3030
option(DISCOVER_CT "Discover all Component Tests" OFF)
3131
option(ENABLE_DEMO_APP "Build demo app" OFF)
3232
option(BUILD_WITH_INSTALLED_TRANSPORT "Build the library with the transport that is installed, even if its version mismatches" ON)
33+
option(DISABLE_SO_VERSION "Disable SONAME/SOVERSION of shared library" OFF)
3334

3435
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
3536
set(CMAKE_INSTALL_PREFIX "${SYSROOT_PATH}/usr" CACHE INTERNAL "" FORCE)

build.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,21 @@ while [[ ! -z $1 ]]; do
5151
esac; shift
5252
done
5353

54-
[ ! -z $SYSROOT_PATH ] || { echo "SYSROOT_PATH not set" >/dev/stderr; exit 1; }
55-
[ -e $SYSROOT_PATH ] || { echo "SYSROOT_PATH not exist ($SYSROOT_PATH)" >/dev/stderr; exit 1; }
54+
[[ ! -z $SYSROOT_PATH ]] || { echo "SYSROOT_PATH not set" >/dev/stderr; exit 1; }
55+
[[ -e $SYSROOT_PATH ]] || { echo "SYSROOT_PATH not exist ($SYSROOT_PATH)" >/dev/stderr; exit 1; }
5656

5757
$cleanFirst && rm -rf $bdir
5858

59-
if [ ! -e "$bdir" ]; then
59+
if [[ ! -e "$bdir" || -n "$@" ]]; then
60+
params+=" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
61+
command -v ccache >/dev/null 2>&1 && params+=" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
6062
cmake -B $bdir \
6163
-DCMAKE_BUILD_TYPE=$buildType \
6264
-DSYSROOT_PATH=$SYSROOT_PATH \
6365
$params \
6466
"$@" || exit $?
6567
fi
6668
cmake --build $bdir --parallel || exit $?
67-
if $do_install && [ $bdir = 'build' ]; then
69+
if $do_install && [[ $bdir == 'build' ]]; then
6870
cmake --install $bdir || exit $?
6971
fi

src/CMakeLists.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ target_link_libraries(${TARGET}
5454
PRIVATE
5555
nlohmann_json::nlohmann_json
5656
PUBLIC
57-
$<IF:$<TARGET_EXISTS:FireboltTransport::FireboltTransport>,FireboltTransport::FireboltTransport,FireboltTransport>
57+
FireboltTransport::FireboltTransport
5858
)
5959

6060
target_include_directories(${TARGET}
@@ -69,10 +69,20 @@ target_include_directories(${TARGET}
6969
set_target_properties(${TARGET} PROPERTIES
7070
CXX_STANDARD 17
7171
CXX_STANDARD_REQUIRED YES
72-
VERSION ${PROJECT_VERSION}
73-
SOVERSION ${PROJECT_VERSION_MAJOR}
7472
POSITION_INDEPENDENT_CODE ON
7573
)
74+
if(DISABLE_SO_VERSION)
75+
set_target_properties(${TARGET} PROPERTIES
76+
NO_SONAME ON
77+
VERSION ""
78+
SOVERSION ""
79+
)
80+
else()
81+
set_target_properties(${TARGET} PROPERTIES
82+
VERSION ${PROJECT_VERSION}
83+
SOVERSION ${PROJECT_VERSION_MAJOR}
84+
)
85+
endif()
7686

7787
write_basic_package_version_file(
7888
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"

test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ target_link_options(${UNIT_TESTS_APP} PRIVATE --coverage)
4141
target_link_libraries(${UNIT_TESTS_APP}
4242
PRIVATE
4343
FireboltClient
44-
$<IF:$<TARGET_EXISTS:FireboltTransport::FireboltTransport>,FireboltTransport::FireboltTransport,FireboltTransport>
44+
FireboltTransport::FireboltTransport
4545
nlohmann_json::nlohmann_json
4646
nlohmann_json_schema_validator::validator
4747
GTest::gtest
@@ -86,7 +86,7 @@ add_executable(${COMPONENT_TESTS_APP}
8686
target_link_libraries(${COMPONENT_TESTS_APP}
8787
PRIVATE
8888
FireboltClient
89-
$<IF:$<TARGET_EXISTS:FireboltTransport::FireboltTransport>,FireboltTransport::FireboltTransport,FireboltTransport>
89+
FireboltTransport::FireboltTransport
9090
nlohmann_json::nlohmann_json
9191
nlohmann_json_schema_validator::validator
9292
CURL::libcurl

0 commit comments

Comments
 (0)