aboutsummaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-09-26 10:17:16 -0700
committerGarrett D'Amore <garrett@damore.org>2017-09-26 12:45:47 -0700
commit52118e4dcbc105d2b83c774e001926aceb978488 (patch)
tree57c65eeb732be3dc7c442f99be1aa8a0e463d886 /tests/CMakeLists.txt
parent97824a96b06f294476c6e1cabb3216282e86a308 (diff)
downloadnng-52118e4dcbc105d2b83c774e001926aceb978488.tar.gz
nng-52118e4dcbc105d2b83c774e001926aceb978488.tar.bz2
nng-52118e4dcbc105d2b83c774e001926aceb978488.zip
Add C++ test program, proving C++ consumers work.
We fixed up the coverage flags for GNU C, but are not going to run the C++ tests when doing coverage (they fail linking gcov for reasons unknown.)
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c6f6872c..0c0973b2 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -76,9 +76,32 @@ if (NNG_TESTS)
math (EXPR TEST_PORT "${TEST_PORT}+10")
endmacro (add_nng_compat_test)
+ macro (add_nng_cpp_test NAME TIMEOUT)
+ if (NOT NNG_ENABLE_COVERAGE)
+ enable_language (CXX)
+ list (APPEND all_tests ${NAME})
+ add_executable (${NAME} ${NAME}.cc)
+ target_link_libraries (${NAME} ${PROJECT_NAME}_static)
+ target_link_libraries (${NAME} ${NNG_REQUIRED_LIBRARIES})
+ target_compile_definitions(${NAME} PUBLIC -DNNG_STATIC_LIB)
+ if (CMAKE_THREAD_LIBS_INIT)
+ target_link_libraries (${NAME} "${CMAKE_THREAD_LIBS_INIT}")
+ endif()
+
+ add_test (NAME ${NAME} COMMAND ${NAME} ${TEST_PORT})
+ set_tests_properties (${NAME} PROPERTIES TIMEOUT ${TIMEOUT})
+ math (EXPR TEST_PORT "${TEST_PORT}+10")
+ endif()
+ endmacro (add_nng_cpp_test)
+
+
else ()
macro (add_nng_test NAME TIMEOUT)
endmacro (add_nng_test)
+ macro (add_nng_compat_test NAME TIMEOUT)
+ endmacro (add_nng_compat_test)
+ macro (add_nng_cpp_test NAME TIMEOUT)
+ endmacro (add_nng_cpp_test)
endif ()
add_nng_test(bus 5)
@@ -120,3 +143,5 @@ add_nng_compat_test(compat_survey 5)
add_nng_compat_test(compat_reqttl 5)
add_nng_compat_test(compat_shutdown 5)
+# c++ tests
+add_nng_cpp_test(cplusplus_pair 5)