72 lines
3.2 KiB
Diff
72 lines
3.2 KiB
Diff
From f4c66b4425b64c31bc3ce1a882a513f903b393ab Mon Sep 17 00:00:00 2001
|
|
From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
|
|
Date: Thu, 5 Jan 2017 11:46:57 +0200
|
|
Subject: [PATCH] Build unit tests conditionally
|
|
|
|
Upstream-Status: Accepted [https://github.com/ros-industrial/industrial_core/pull/171]
|
|
|
|
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
|
|
---
|
|
CMakeLists.txt | 32 ++++++++++++++++++--------------
|
|
1 file changed, 18 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 06830d5..e6cb21a 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -101,33 +101,37 @@ add_library(simple_message ${SRC_FILES})
|
|
target_link_libraries(simple_message ${catkin_LIBRARIES})
|
|
add_dependencies(simple_message ${industrial_msgs_EXPORTED_TARGETS})
|
|
|
|
-catkin_add_gtest(utest ${UTEST_SRC_FILES})
|
|
-set_target_properties(utest PROPERTIES COMPILE_DEFINITIONS "TEST_PORT_BASE=11000")
|
|
-target_link_libraries(utest simple_message)
|
|
-
|
|
# ALTERNATIVE LIBRARY (DIFFERENT ENDIAN)
|
|
add_library(simple_message_bswap ${SRC_FILES})
|
|
set_target_properties(simple_message_bswap PROPERTIES COMPILE_DEFINITIONS "BYTE_SWAPPING")
|
|
target_link_libraries(simple_message_bswap ${catkin_LIBRARIES})
|
|
add_dependencies(simple_message_bswap ${industrial_msgs_EXPORTED_TARGETS})
|
|
|
|
-catkin_add_gtest(utest_byte_swapping ${UTEST_SRC_FILES})
|
|
-set_target_properties(utest_byte_swapping PROPERTIES COMPILE_DEFINITIONS "TEST_PORT_BASE=12000")
|
|
-target_link_libraries(utest_byte_swapping simple_message_bswap)
|
|
-
|
|
# ALTERNATIVE LIBRARY (64-bit floats)
|
|
add_library(simple_message_float64 ${SRC_FILES})
|
|
set_target_properties(simple_message_float64 PROPERTIES COMPILE_DEFINITIONS "FLOAT64")
|
|
target_link_libraries(simple_message_float64 ${catkin_LIBRARIES})
|
|
add_dependencies(simple_message_float64 ${industrial_msgs_EXPORTED_TARGETS})
|
|
|
|
-catkin_add_gtest(utest_float64 ${UTEST_SRC_FILES})
|
|
-set_target_properties(utest_float64 PROPERTIES COMPILE_DEFINITIONS "TEST_PORT_BASE=13000;FLOAT64")
|
|
-target_link_libraries(utest_float64 simple_message_float64)
|
|
+if(CATKIN_ENABLE_TESTING)
|
|
+
|
|
+ catkin_add_gtest(utest ${UTEST_SRC_FILES})
|
|
+ set_target_properties(utest PROPERTIES COMPILE_DEFINITIONS "TEST_PORT_BASE=11000")
|
|
+ target_link_libraries(utest simple_message)
|
|
+
|
|
+ catkin_add_gtest(utest_byte_swapping ${UTEST_SRC_FILES})
|
|
+ set_target_properties(utest_byte_swapping PROPERTIES COMPILE_DEFINITIONS "TEST_PORT_BASE=12000")
|
|
+ target_link_libraries(utest_byte_swapping simple_message_bswap)
|
|
+
|
|
+ catkin_add_gtest(utest_float64 ${UTEST_SRC_FILES})
|
|
+ set_target_properties(utest_float64 PROPERTIES COMPILE_DEFINITIONS "TEST_PORT_BASE=13000;FLOAT64")
|
|
+ target_link_libraries(utest_float64 simple_message_float64)
|
|
+
|
|
+ catkin_add_gtest(utest_udp ${UTEST_SRC_FILES})
|
|
+ set_target_properties(utest_udp PROPERTIES COMPILE_DEFINITIONS "TEST_PORT_BASE=15000;UDP_TEST")
|
|
+ target_link_libraries(utest_udp simple_message)
|
|
|
|
-catkin_add_gtest(utest_udp ${UTEST_SRC_FILES})
|
|
-set_target_properties(utest_udp PROPERTIES COMPILE_DEFINITIONS "TEST_PORT_BASE=15000;UDP_TEST")
|
|
-target_link_libraries(utest_udp simple_message)
|
|
+endif()
|
|
|
|
install(
|
|
TARGETS simple_message simple_message_bswap simple_message_float64
|
|
--
|
|
2.7.4
|
|
|