Skip to content

cmake --build <path> --target help does not list the "tests" target when using Ninja generator #118

@alexwpitt

Description

@alexwpitt

The "help" target is used to check if a particular target exists:

output = subprocess.check_output([
CMAKE_EXECUTABLE, '--build', path, '--target', 'help'], cwd=path)

But when using the Ninja generator, the "tests" target does not seem to appear in the output of that command, and therefore is not built by a colcon build on a ROS package containing cmake such as:

if(CATKIN_ENABLE_TESTING)
  find_package(rostest REQUIRED)
  add_rostest_gtest(dummy_node_test test/dummy_node.test test/DummyNodeTest.cpp)
  target_include_directories(dummy_node_test SYSTEM PRIVATE ${catkin_INCLUDE_DIRS})
  target_link_libraries(dummy_node_test ${catkin_LIBRARIES})
endif()

This causes colcon test failures if rostest tries to launch the unbuilt test binary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions