cmake_minimum_required(VERSION 3.5.0)
project(sendreceive)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(simple REQUIRED)

include_directories(
	# assure that generated .h files are found
	${PROJECT_SOURCE_DIR}/src
	${PROJECT_SOURCE_DIR}/src-gen
)

add_library(SendClient_comp SHARED
	src-gen/sendReceive/SendClient.cpp)
target_compile_definitions(SendClient_comp
	PRIVATE "SendClient_shared_library")
ament_target_dependencies(SendClient_comp
	rclcpp
	rclcpp_components
	rclcpp_lifecycle
	simple
)
rclcpp_components_register_nodes(SendClient_comp "sendreceive::SendClient")

add_executable(SendClient_main src-gen/sendReceive/SendClient_main.cpp)
target_link_libraries(SendClient_main SendClient_comp)
ament_target_dependencies(SendClient_main rclcpp)

add_library(SendServer_comp SHARED
	src-gen/sendReceive/SendServer.cpp)
target_compile_definitions(SendServer_comp
	PRIVATE "SendServer_shared_library")
ament_target_dependencies(SendServer_comp
	rclcpp
	rclcpp_components
	rclcpp_lifecycle
	simple
)
rclcpp_components_register_nodes(SendServer_comp "sendreceive::SendServer")

add_executable(SendServer_main src-gen/sendReceive/SendServer_main.cpp)
target_link_libraries(SendServer_main SendServer_comp)
ament_target_dependencies(SendServer_main rclcpp)


# Start of user code dependencies
# End of user code

install(TARGETS
	SendClient_main
	SendClient_comp
	DESTINATION lib/${PROJECT_NAME}
)
install(TARGETS
	SendServer_main
	SendServer_comp
	DESTINATION lib/${PROJECT_NAME}
)

# Install launch files.
install(DIRECTORY
	launch
	DESTINATION share/${PROJECT_NAME}/
)
ament_package()
