summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2017-02-21 17:01:53 +0100
committerChristian Beier <dontmind@freeshell.org>2017-02-21 17:01:53 +0100
commita6c599a5fcd9e3a5c8f4a77e77b7af37c4f43707 (patch)
tree70721268c03c6f3704994cd97453203f9310ddd8 /CMakeLists.txt
parentebbbc8bd1b6cc5c831a5621c1cd0859e5dab0829 (diff)
downloadlibtdevnc-a6c599a5fcd9e3a5c8f4a77e77b7af37c4f43707.tar.gz
libtdevnc-a6c599a5fcd9e3a5c8f4a77e77b7af37c4f43707.zip
CMake: build the tests
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt57
1 files changed, 57 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6620b39..3afb28a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,7 @@ set(COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)
set(LIBVNCCLIENT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libvncclient)
set(LIBVNCSRVEXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/examples)
set(LIBVNCCLIEXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/client_examples)
+set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
@@ -467,7 +468,63 @@ foreach(e ${LIBVNCCLIENT_EXAMPLES})
target_link_libraries(client_examples_${e} vncclient ${CMAKE_THREAD_LIBS_INIT} ${SDL_LIBRARY} ${FFMPEG_LIBRARIES})
endforeach(e ${LIBVNCCLIENT_EXAMPLES})
+
+#
+# them tests
+#
+set(SIMPLETESTS
+ cargstest
+ copyrecttest
+)
+
+if(CMAKE_USE_PTHREADS_INIT)
+ set(SIMPLETESTS
+ ${SIMPLETESTS}
+ encodingstest
+ )
+endif(CMAKE_USE_PTHREADS_INIT)
+
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
+foreach(t ${SIMPLETESTS})
+ add_executable(test_${t} ${TESTS_DIR}/${t}.c)
+ set_target_properties(test_${t} PROPERTIES OUTPUT_NAME ${t})
+ set_target_properties(test_${t} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
+ target_link_libraries(test_${t} vncserver vncclient m)
+endforeach(t ${SIMPLETESTS})
+
+if(FOUND_LIBJPEG_TURBO)
+ add_executable(test_tjunittest
+ ${TESTS_DIR}/tjunittest.c
+ ${TESTS_DIR}/tjutil.c
+ ${TESTS_DIR}/tjutil.h
+ ${COMMON_DIR}/turbojpeg.c
+ ${COMMON_DIR}/turbojpeg.h
+ )
+ set_target_properties(test_tjunittest PROPERTIES OUTPUT_NAME tjunittest)
+ set_target_properties(test_tjunittest PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
+ target_link_libraries(test_tjunittest vncserver vncclient m)
+
+ add_executable(test_tjbench
+ ${TESTS_DIR}/tjbench.c
+ ${TESTS_DIR}/tjutil.c
+ ${TESTS_DIR}/tjutil.h
+ ${TESTS_DIR}/bmp.c
+ ${TESTS_DIR}/bmp.h
+ ${COMMON_DIR}/turbojpeg.c
+ ${COMMON_DIR}/turbojpeg.h
+ )
+ set_target_properties(test_tjbench PROPERTIES OUTPUT_NAME tjbench)
+ set_target_properties(test_tjbench PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
+ target_link_libraries(test_tjbench vncserver vncclient m)
+
+endif(FOUND_LIBJPEG_TURBO)
+
+
+
+
+#
# this gets the libraries needed by TARGET in "-libx -liby ..." form
+#
function(get_link_libraries OUT TARGET)
set(RESULT "")
get_target_property(LIBRARIES ${TARGET} INTERFACE_LINK_LIBRARIES)