summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2015-04-05 22:52:07 -0700
committerAlan Antonuk <alan.antonuk@gmail.com>2015-04-05 23:37:23 -0700
commita5f7ffb3b6e04304930a22d1a86f89c9fbf713d9 (patch)
tree71da7e91d0b93ba3e6c2c5c7e11f158d4fbc0bc4
parent133dffeec9b991c18b7c5e38cba112c8a9b6ed34 (diff)
downloadrabbitmq-c-a5f7ffb3b6e04304930a22d1a86f89c9fbf713d9.tar.gz
Make tests only link against static rabbitmq
This gets around issues with symbol visibility issues while testing functions that are not declared to be visibile outside the library.
-rw-r--r--CMakeLists.txt7
-rw-r--r--Makefile.am6
-rw-r--r--tests/CMakeLists.txt6
3 files changed, 12 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c067284..bef5262 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -224,7 +224,7 @@ endif()
find_package(Threads)
option(BUILD_SHARED_LIBS "Build rabbitmq-c as a shared library" ON)
-option(BUILD_STATIC_LIBS "Build rabbitmq-c as a static library" OFF)
+option(BUILD_STATIC_LIBS "Build rabbitmq-c as a static library" ON)
option(BUILD_EXAMPLES "Build Examples" ON)
option(BUILD_TOOLS "Build Tools (requires POPT Library)" ${POPT_FOUND})
@@ -278,6 +278,11 @@ if (BUILD_TOOLS)
endif ()
if (BUILD_TESTS)
+ if (NOT BUILD_STATIC_LIBS)
+ message(FATAL_ERROR
+ "Tests can only be built against static libraries "
+ "(set BUILD_STATIC_LIBS=ON)")
+ endif ()
enable_testing()
add_subdirectory(tests)
endif (BUILD_TESTS)
diff --git a/Makefile.am b/Makefile.am
index 5ca61ad..3ffda6f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -84,17 +84,17 @@ check_PROGRAMS = \
TESTS = $(check_PROGRAMS)
tests_test_tables_SOURCES = tests/test_tables.c
-tests_test_tables_LDADD = librabbitmq/librabbitmq.la
+tests_test_tables_LDADD = librabbitmq/librabbitmq.a
tests_test_parse_url_SOURCES = tests/test_parse_url.c
-tests_test_parse_url_LDADD = librabbitmq/librabbitmq.la
+tests_test_parse_url_LDADD = librabbitmq/librabbitmq.a
tests_test_hostcheck_SOURCES = \
tests/test_hostcheck.c \
librabbitmq/amqp_hostcheck.c
tests_test_status_enum_SOURCES = tests/test_status_enum.c
-tests_test_status_enum_LDADD = librabbitmq/librabbitmq.la
+tests_test_status_enum_LDADD = librabbitmq/librabbitmq.a
noinst_LTLIBRARIES =
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c8d96d7..fca99fc 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -11,11 +11,11 @@ endif (MSVC)
add_definitions(-DHAVE_CONFIG_H)
add_executable(test_parse_url test_parse_url.c)
-target_link_libraries(test_parse_url ${RMQ_LIBRARY_TARGET})
+target_link_libraries(test_parse_url rabbitmq-static)
add_test(parse_url test_parse_url)
add_executable(test_tables test_tables.c)
-target_link_libraries(test_tables ${RMQ_LIBRARY_TARGET})
+target_link_libraries(test_tables rabbitmq-static)
add_test(tables test_tables)
configure_file(test_tables.expected ${CMAKE_CURRENT_BINARY_DIR}/tests/test_tables.expected COPY_ONLY)
@@ -26,5 +26,5 @@ add_test(hostcheck test_hostcheck)
add_executable(test_status_enum
test_status_enum.c)
-target_link_libraries(test_status_enum ${RMQ_LIBRARY_TARGET})
+target_link_libraries(test_status_enum rabbitmq-static)
add_test(status_enum test_status_enum)