File tree 5 files changed +34
-31
lines changed
5 files changed +34
-31
lines changed Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 2.8.3)
2
2
project (serial)
3
3
4
- # Find catkin
5
- find_package (catkin REQUIRED)
6
-
7
4
if (APPLE )
8
5
find_library (IOKIT_LIBRARY IOKit)
9
6
find_library (FOUNDATION_LIBRARY Foundation)
10
7
endif ()
11
8
12
- if (UNIX AND NOT APPLE )
13
- # If Linux, add rt and pthread
14
- set (rt_LIBRARIES rt)
15
- set (pthread_LIBRARIES pthread)
16
- catkin_package(
17
- LIBRARIES ${PROJECT_NAME}
18
- INCLUDE_DIRS include
19
- DEPENDS rt pthread
20
- )
21
- else ()
22
- # Otherwise normal call
23
- catkin_package(
24
- LIBRARIES ${PROJECT_NAME}
25
- INCLUDE_DIRS include
26
- )
27
- endif ()
28
-
29
9
## Sources
30
10
set (serial_SRCS
31
11
src/serial.cc
@@ -66,15 +46,25 @@ include_directories(include)
66
46
67
47
## Install executable
68
48
install (TARGETS ${PROJECT_NAME}
69
- ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
70
- LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
49
+ ARCHIVE DESTINATION lib
50
+ LIBRARY DESTINATION lib
71
51
)
72
52
73
53
## Install headers
74
54
install (FILES include /serial/serial.h include /serial/v8stdint.h
75
- DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION} /serial)
55
+ DESTINATION include /serial)
56
+
57
+ ## Install CMake config
58
+ install (FILES cmake/serialConfig.cmake
59
+ DESTINATION share/serial/cmake)
60
+
61
+
62
+ ## Install package.xml
63
+ install (FILES package.xml
64
+ DESTINATION share/serial)
76
65
77
66
## Tests
78
- if (CATKIN_ENABLE_TESTING)
67
+ include (CTest)
68
+ if (BUILD_TESTING)
79
69
add_subdirectory (tests)
80
70
endif ()
Original file line number Diff line number Diff line change 56
56
@mkdir -p build
57
57
cd build && cmake $(CMAKE_FLAGS ) ..
58
58
ifneq ($(MAKE ) ,)
59
- cd build && $(MAKE) run_tests
59
+ cd build && $(MAKE) all test
60
60
else
61
- cd build && make run_tests
61
+ cd build && make all test
62
62
endif
Original file line number Diff line number Diff line change
1
+ get_filename_component (SERIAL_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE} " PATH )
2
+ set (SERIAL_INCLUDE_DIRS "${SERIAL_CMAKE_DIR} /../../../include" )
3
+ find_library (SERIAL_LIBRARIES serial PATHS ${SERIAL_CMAKE_DIR} /../../../lib/serial)
Original file line number Diff line number Diff line change 19
19
<
author email =
" [email protected] " >William Woodall</
author >
20
20
<
author email =
" [email protected] " >John Harrison</
author >
21
21
22
- <buildtool_depend >catkin </buildtool_depend >
22
+ <buildtool_depend >cmake </buildtool_depend >
23
23
24
24
<test_depend >boost</test_depend >
25
+ <test_depend >gtest</test_depend >
25
26
27
+ <export >
28
+ <build_type >cmake</build_type >
29
+ </export >
26
30
</package >
Original file line number Diff line number Diff line change 1
1
if (UNIX )
2
- catkin_add_gtest(${PROJECT_NAME} -test unix_serial_tests.cc)
3
- target_link_libraries (${PROJECT_NAME} -test ${PROJECT_NAME} ${Boost_LIBRARIES} )
2
+ find_package (Boost REQUIRED)
3
+ find_package (GTest REQUIRED)
4
+ include_directories (${GTEST_INCLUDE_DIRS} )
5
+
6
+ add_executable (${PROJECT_NAME} -test unix_serial_tests.cc)
7
+ target_link_libraries (${PROJECT_NAME} -test ${PROJECT_NAME} ${Boost_LIBRARIES} ${GTEST_LIBRARIES} )
4
8
if (NOT APPLE )
5
9
target_link_libraries (${PROJECT_NAME} -test util)
6
10
endif ()
11
+ add_test ("${PROJECT_NAME} -test-gtest" ${PROJECT_NAME} -test )
7
12
8
13
if (NOT APPLE ) # these tests are unreliable on macOS
9
- catkin_add_gtest(${PROJECT_NAME} -test -timer unit/unix_timer_tests.cc)
10
- target_link_libraries (${PROJECT_NAME} -test -timer ${PROJECT_NAME} )
14
+ add_executable (${PROJECT_NAME} -test -timer unit/unix_timer_tests.cc)
15
+ target_link_libraries (${PROJECT_NAME} -test -timer ${PROJECT_NAME} ${GTEST_LIBRARIES} )
16
+ add_test ("${PROJECT_NAME} -test-timer-gtest" ${PROJECT_NAME} -test -timer)
11
17
endif ()
12
18
endif ()
You can’t perform that action at this time.
0 commit comments