66cmake_minimum_required (VERSION 3.13)
77project (vSomeIPHelloWorld)
88
9+ include (GNUInstallDirs)
10+
911find_package (Threads REQUIRED)
1012
11- include (GNUInstallDirs)
13+ # This will get us acces to
14+ # VSOMEIP_INCLUDE_DIRS - include directories for vSomeIP
15+ # VSOMEIP_LIBRARIES - libraries to link against
16+ find_package (vsomeip3 REQUIRED)
1217
1318# create_target("executable")
1419function (create_target executable)
@@ -19,33 +24,32 @@ function(create_target executable)
1924 target_compile_features (vsomeip_hello_world_${executable} INTERFACE cxx_std_17)
2025
2126 target_include_directories (vsomeip_hello_world_${executable} INTERFACE
22- ${CMAKE_CURRENT_SOURCE_DIR }
27+ ${PROJECT_SOURCE_DIR }
2328 )
24-
25- if (ENABLE_SIGNAL_HANDLING)
26- target_compile_definitions (vsomeip_hello_world_example INTERFACE VSOMEIP_ENABLE_SIGNAL_HANDLING)
27- endif ()
2829endfunction ()
2930
3031# link_target("executable")
3132function (link_target executable)
3233 add_executable (hello_world_${executable} )
3334 target_sources (hello_world_${executable} PRIVATE hello_world_${executable} _main.cpp)
3435 target_link_libraries (hello_world_${executable} PRIVATE vsomeip_hello_world_${executable} vsomeip3 Threads::Threads)
36+ if (ENABLE_SIGNAL_HANDLING)
37+ target_compile_definitions (vsomeip_hello_world_${executable} PRIVATE VSOMEIP_ENABLE_SIGNAL_HANDLING)
38+ endif ()
3539endfunction ()
3640
3741create_target("service" )
3842create_target("client" )
3943
4044if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android" )
41- # This will get us acces to
42- # VSOMEIP_INCLUDE_DIRS - include directories for vSomeIP
43- # VSOMEIP_LIBRARIES - libraries to link against
44- find_package (${VSOMEIP_NAME} )
45- if (NOT ${VSOMEIP_NAME} _FOUND)
46- message ("${VSOMEIP_NAME} was not found. Please specify vsomeip_DIR" )
47- endif ()
4845
4946 link_target("client" )
5047 link_target("service" )
48+
49+ install (
50+ TARGETS
51+ hello_world_client hello_world_service RUNTIME
52+ DESTINATION "${INSTALL_BIN_DIR} "
53+ COMPONENT example-hello_world
54+ )
5155endif ()
0 commit comments