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.
master
Robert Falkenberg 3 years ago
parent 3620308940
commit c5d5d45574

@ -6,7 +6,7 @@
# the distribution. # 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}) 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) add_executable(rrc_meascfg_test rrc_meascfg_test.cc)

@ -8,7 +8,7 @@
set_directory_properties(PROPERTIES LABELS "sched;nr") 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) 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) add_executable(sched_nr_parallel_test sched_nr_parallel_test.cc)

@ -6,7 +6,7 @@
# the distribution. # 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) 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}) 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})

Loading…
Cancel
Save