summaryrefslogtreecommitdiff
path: root/src/console/CMakeLists.txt
diff options
context:
space:
mode:
authorVo Trung Chi <chi.votrung@vn.bosch.com>2019-07-03 09:41:38 +0700
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2019-07-03 11:41:38 +0900
commitb757183f51920e8445ed0ea0bbdb490d99781ec6 (patch)
treeab984058504593f58a842f79b945dd6c6f12751f /src/console/CMakeLists.txt
parentc232148a950c536b99bf91033a78ada6ee6f1771 (diff)
downloadDLT-daemon-b757183f51920e8445ed0ea0bbdb490d99781ec6.tar.gz
cmake-improvements (#135)
1. Allow building as a subproject of another cmake project (CMAKE_* vs PROJECT_* variables) 2. Do not generate header files within source – bad practice, use build directory for that(e.g. change location where dlt_version.h is being generated) 3. Use add_compile_options() instead of *_C/CXX_FLAGS variables for proper compile environment definition, also bad practice, also see p.2 4. Add WITH_DLT_PKGCONFIG – add generate pkgconfig .pc files as switchable option, should probably be part of headers install routine. Signed-off-by: Radoslaw Kaczorowski <external.radoslaw.kaczorowski@bosch-softtec.com>
Diffstat (limited to 'src/console/CMakeLists.txt')
-rw-r--r--src/console/CMakeLists.txt48
1 files changed, 21 insertions, 27 deletions
diff --git a/src/console/CMakeLists.txt b/src/console/CMakeLists.txt
index c2e5586..8bda257 100644
--- a/src/console/CMakeLists.txt
+++ b/src/console/CMakeLists.txt
@@ -15,33 +15,27 @@
# @licence end@
#######
-set(dlt_sortbytimestamp_SRCS dlt-sortbytimestamp.c)
-add_executable(dlt-sortbytimestamp ${dlt_sortbytimestamp_SRCS} ${dlt_most_SRCS})
-target_link_libraries(dlt-sortbytimestamp dlt ${EXPAT_LIBRARIES})
-set_target_properties(dlt-sortbytimestamp PROPERTIES LINKER_LANGUAGE C)
-
-set(dlt_convert_SRCS dlt-convert.c)
-add_executable(dlt-convert ${dlt_convert_SRCS} ${dlt_most_SRCS})
-target_link_libraries(dlt-convert dlt ${EXPAT_LIBRARIES})
-set_target_properties(dlt-convert PROPERTIES LINKER_LANGUAGE C)
-
-set(dlt_receive_SRCS dlt-receive.c)
-add_executable(dlt-receive ${dlt_receive_SRCS} ${dlt_most_SRCS})
-target_link_libraries(dlt-receive dlt ${EXPAT_LIBRARIES})
-set_target_properties(dlt-receive PROPERTIES LINKER_LANGUAGE C)
-
-set(dlt_control_SRCS dlt-control.c dlt-control-common.c)
-add_executable(dlt-control ${dlt_control_SRCS} ${dlt_most_SRCS})
-target_link_libraries(dlt-control dlt ${EXPAT_LIBRARIES})
-set_target_properties(dlt-control PROPERTIES LINKER_LANGUAGE C)
-
set(dlt_control_common_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/dlt-control-common.c)
-add_subdirectory( logstorage )
+add_subdirectory(logstorage)
+
+set(dlt-sortbytimestamp_SRCS dlt-sortbytimestamp.c)
+set(dlt-convert_SRCS dlt-convert.c)
+set(dlt-receive_SRCS dlt-receive.c)
+set(dlt-control_SRCS dlt-control.c ${dlt_control_common_SRCS})
+set(dlt-passive-node-ctrl_SRCS dlt-passive-node-ctrl.c ${dlt_control_common_SRCS})
-set(dlt_passive_node_ctrl_SRCS dlt-passive-node-ctrl.c dlt-control-common.c)
-add_executable(dlt-passive-node-ctrl ${dlt_passive_node_ctrl_SRCS} ${dlt_most_SRCS})
-target_link_libraries(dlt-passive-node-ctrl dlt ${EXPAT_LIBRARIES})
+foreach(target
+ dlt-sortbytimestamp
+ dlt-convert
+ dlt-receive
+ dlt-control
+ dlt-passive-node-ctrl
+ )
+ add_executable(${target} ${${target}_SRCS})
+ target_link_libraries(${target} dlt)
+ set_target_properties(${target} PROPERTIES LINKER_LANGUAGE C)
-install(TARGETS dlt-sortbytimestamp dlt-convert dlt-receive dlt-control dlt-passive-node-ctrl
- RUNTIME DESTINATION bin
- COMPONENT base)
+ install(TARGETS ${target}
+ RUNTIME DESTINATION bin
+ COMPONENT base)
+endforeach()