I have modified the CMake_Lists.txt file like this:
Compile and install cpp source file
add_executable(simple_publisher_node src/simple_topic_publisher)
ament_target_dependencies(simple_publisher_node rclcpp std_msgs)
but when I compiled the topic_publisher_pkg but failed, the error occurred as following :
CMake Error at CMakeLists.txt:12 (ament_target_dependencies):
** Unknown CMake command “ament_target_dependencies”.**