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.
This commit is contained in:
Robert Falkenberg 2022-05-10 09:14:25 +02:00
parent 3620308940
commit c5d5d45574
3 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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)
add_nr_test(sched_nr_test sched_nr_test)

View File

@ -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})