File tree Expand file tree Collapse file tree 3 files changed +37
-14
lines changed Expand file tree Collapse file tree 3 files changed +37
-14
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ include_directories(SYSTEM third_party/toml11)
49
49
50
50
include (cmake/compile-options .cmake)
51
51
include (cmake/cpack.cmake)
52
+ include (cmake/bin.cmake)
52
53
53
54
add_subdirectory (lib)
54
55
add_subdirectory (bin)
Original file line number Diff line number Diff line change 15
15
16
16
cmake_minimum_required (VERSION 2.7)
17
17
18
- add_executable (servo_array_bin servo_array.cpp)
19
- set_target_properties (servo_array_bin PROPERTIES OUTPUT_NAME "servo_array" )
20
- target_link_libraries (servo_array_bin servoarray_lib)
21
- sa_set_compile_options(servo_array_bin)
22
- install (TARGETS servo_array_bin RUNTIME DESTINATION bin)
18
+ sa_add_bin(servo_array INSTALL )
23
19
24
- add_executable (servo_map_bin servo_map.cpp)
25
- set_target_properties (servo_map_bin PROPERTIES OUTPUT_NAME "servo_map" )
26
- target_link_libraries (servo_map_bin servoarray_lib)
27
- sa_set_compile_options(servo_map_bin)
28
- install (TARGETS servo_map_bin RUNTIME DESTINATION bin)
20
+ sa_add_bin(servo_map INSTALL )
29
21
30
- add_executable (bench_bin bench.cpp)
31
- set_target_properties (bench_bin PROPERTIES OUTPUT_NAME "bench" )
32
- target_link_libraries (bench_bin servoarray_lib)
33
- sa_set_compile_options(bench_bin)
22
+ sa_add_bin(bench)
Original file line number Diff line number Diff line change
1
+ # This file is part of servoarray.
2
+ #
3
+ # servoarray is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # servoarray is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with servoarray. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ function (sa_add_bin target )
17
+ cmake_parse_arguments (ARG "INSTALL" "NAME" "" ${ARGN} )
18
+
19
+ if (ARG_NAME)
20
+ set (name ${ARG_NAME} )
21
+ else ()
22
+ set (name ${target} )
23
+ endif ()
24
+
25
+ add_executable (${target} _bin ${target} .cpp)
26
+ set_target_properties (${target} _bin PROPERTIES OUTPUT_NAME "${name} " )
27
+ target_link_libraries (${target} _bin servoarray_lib)
28
+ sa_set_compile_options(${target} _bin)
29
+
30
+ if (${ARG_INSTALL} )
31
+ install (TARGETS ${target} _bin RUNTIME DESTINATION bin)
32
+ endif ()
33
+ endfunction ()
You can’t perform that action at this time.
0 commit comments