summarylogtreecommitdiffstats
path: root/0001-cmake-fix-build-for-cmake-option-BUILD_SHARED_LIBS-O.patch
blob: 25b73564ba85323ff7474beb0136cd11ea3c7e69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From c5d5d45574ecc3ab86347dbab8fc9d27d1815248 Mon Sep 17 00:00:00 2001
From: Robert Falkenberg <robert.falkenberg@srs.io>
Date: Tue, 10 May 2022 09:14:25 +0200
Subject: [PATCH] cmake: fix build for cmake option BUILD_SHARED_LIBS=ON

The cmake option BUILD_SHARED_LIBS (off by default) causes all
libraries to be built as shared libraries if not unless explicitly
stated otherwise.
Since test-helper libraries do not export their symbols, linking
fails if built as shared library.
Therefore, this change explicitly configures these helpers as STATIC.
---
 srsenb/test/rrc/CMakeLists.txt           | 2 +-
 srsgnb/src/stack/mac/test/CMakeLists.txt | 4 ++--
 srsgnb/src/stack/rrc/test/CMakeLists.txt | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/srsenb/test/rrc/CMakeLists.txt b/srsenb/test/rrc/CMakeLists.txt
index 06ecb4221..fb6694fd4 100644
--- a/srsenb/test/rrc/CMakeLists.txt
+++ b/srsenb/test/rrc/CMakeLists.txt
@@ -6,7 +6,7 @@
 # the distribution.
 #
 
-add_library(test_helpers test_helpers.cc)
+add_library(test_helpers STATIC test_helpers.cc)
 target_link_libraries(test_helpers srsenb_rrc srsenb_common rrc_asn1 rrc_nr_asn1 s1ap_asn1 srsran_common enb_cfg_parser ${LIBCONFIGPP_LIBRARIES})
 
 add_executable(rrc_meascfg_test rrc_meascfg_test.cc)
diff --git a/srsgnb/src/stack/mac/test/CMakeLists.txt b/srsgnb/src/stack/mac/test/CMakeLists.txt
index 6afaccc59..2441f5f8a 100644
--- a/srsgnb/src/stack/mac/test/CMakeLists.txt
+++ b/srsgnb/src/stack/mac/test/CMakeLists.txt
@@ -8,7 +8,7 @@
 
 set_directory_properties(PROPERTIES LABELS "sched;nr")
 
-add_library(sched_nr_test_suite sched_nr_common_test.cc sched_nr_ue_ded_test_suite.cc sched_nr_sim_ue.cc)
+add_library(sched_nr_test_suite STATIC sched_nr_common_test.cc sched_nr_ue_ded_test_suite.cc sched_nr_sim_ue.cc)
 target_link_libraries(sched_nr_test_suite srsgnb_mac srsran_common rrc_nr_asn1)
 
 add_executable(sched_nr_parallel_test sched_nr_parallel_test.cc)
@@ -53,4 +53,4 @@ target_link_libraries(sched_nr_test
         rrc_nr_asn1
         srsran_common ${CMAKE_THREAD_LIBS_INIT}
         ${Boost_LIBRARIES})
-add_nr_test(sched_nr_test sched_nr_test)
\ No newline at end of file
+add_nr_test(sched_nr_test sched_nr_test)
diff --git a/srsgnb/src/stack/rrc/test/CMakeLists.txt b/srsgnb/src/stack/rrc/test/CMakeLists.txt
index 103b1bb38..efca40807 100644
--- a/srsgnb/src/stack/rrc/test/CMakeLists.txt
+++ b/srsgnb/src/stack/rrc/test/CMakeLists.txt
@@ -6,7 +6,7 @@
 # the distribution.
 #
 
-add_library(rrc_nr_test_helpers rrc_nr_test_helpers.cc)
+add_library(rrc_nr_test_helpers STATIC rrc_nr_test_helpers.cc)
 
 add_executable(rrc_nr_test rrc_nr_test.cc)
 target_link_libraries(rrc_nr_test srsgnb_rrc srsgnb_rrc_config_utils srsran_common rrc_nr_asn1 rrc_nr_test_helpers srsgnb_mac ${ATOMIC_LIBS})
-- 
2.36.1