Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic error when test node name start with run_tests_ #961

Closed
masters3d opened this issue Sep 24, 2018 · 4 comments
Closed

Cryptic error when test node name start with run_tests_ #961

masters3d opened this issue Sep 24, 2018 · 4 comments

Comments

@masters3d
Copy link

CMake Error at /opt/ros/kinetic/share/catkin/cmake/test/tests.cmake:114 (add_dependencies):
  Cannot add target-level dependencies to non-existent target
  "_run_tests_mynode".

  The add_dependencies works for top-level logical targets created by the
  add_executable, add_library, or add_custom_target commands.  If you want to
  add file-level dependencies see the DEPENDS option of the add_custom_target
  and add_custom_command commands.
Call Stack (most recent call first):

https://answers.ros.org/question/304047/cannot-add-target-level-dependencies-to-non-existent-target/

@sloretz
Copy link
Contributor

sloretz commented Sep 24, 2018

HI @masters3d, may I ask for the top level CMakeLists.txt where this error message occurred?

@masters3d
Copy link
Author

cmake_minimum_required(VERSION 2.8.3)
project(perception)

add_definitions(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  roscpp
  sensor_msgs
  tf
  pcl_msgs
  pcl_ros
  pcl_conversions
  visualization_msgs
  tf_conversions
)
find_package(PCL REQUIRED)

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES lesson_perception
#  CATKIN_DEPENDS roscpp sensor_msgs tf
#  DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
  ${catkin_INCLUDE_DIRS}
  ${PCL_INCLUDE_DIRS}
)

## Declare a cpp executable
add_executable(perception_node src/perception_node.cpp)

## Specify libraries to link a library or executable target against
target_link_libraries(perception_node ${catkin_LIBRARIES} ${PCL_LIBRARIES})

if(CATKIN_ENABLE_TESTING)
  find_package(rostest REQUIRED)
  # add_rostest_gtest(run_tests_perception_test test/run_tests_perception_test.test test/run_tests_perception_test.cpp)

  add_executable(run_tests_perception_test test/run_tests_perception_test.cpp)
  add_rostest(test/run_tests_perception_test.test)

  target_link_libraries(perception_test ${catkin_LIBRARIES} ${GTEST_LIBRARIES})
endif()

@dirk-thomas
Copy link
Member

The posted CMake code doesn't seem to match the described problem. It doesn't contain anything named mynode.

sloretz added a commit that referenced this issue Oct 8, 2018
@sloretz
Copy link
Contributor

sloretz commented Oct 8, 2018

It looks like the issue isn't that the target started with run_tests_, but that the target was named run_tests_${PROJECT_NAME}. #964 adds a friendlier error message for this case.

clrpackages pushed a commit to clearlinux-pkgs/catkin that referenced this issue Mar 15, 2019
…paces (#976)

Dirk Thomas (11):
      remove CMAKE_MODULE_PATH from list of "forbidden" variables (#951)
      regenerated CMake API
      fix warnings in docs
      add existing catkin logo to README (#959)
      fix PYTHONPATH missing in cached environment (#986)
      generate CTest and dart config to avoid warnings (#987)
      add local_setup files (#993)
      update changelog
      0.7.15
      update changelog
      0.7.16

Eisoku Kuroiwa (1):
      need to sanitize paths before cprint (#969)

James Xu (9):
      correct python macro in cmake files (#977)
      check both IMPORTED_IMPLIB_ and IMPORTED_LOCATION_ in catkin_libraries.cmake (#980)
      add double quotes around cmake_command to handle spaces (#976)
      ensure desired Python path is added into PATH in setup.bat (#983)
      update builder.py to add Windows support (#982)
      update windows.cmake to fix common build issues on Windows (#984)
      normalize paths in CMAKE_PREFIX_PATH for proper comparison (#979)
      add script.bat.in template for general use (#981)
      add win_ros script wrappers to make python scripts executable (#978)

Jochen Sprickerhof (2):
      Use CATKIN_GLOBAL_ETC_DESTINATION instead of etc (#954)
      strip "-l" from "-lpthread" library, to fix a build failure on ros-ros-comm (#975)

Johnson Shih (1):
      Enable catkin build use_nmake on Windows (#949)

Josh Langsfeld (1):
      Document how to install python subpackages (#962)

Leopold Palomo-Avellaneda (1):
      Protection against double -l (#998)

Mike Purvis (1):
      Switch docs to suggest 'test' path instead of 'tests'. (#990)

Paul Bovbel (1):
      Install environment hooks into a package-specific directory (#953)

Robert Haschke (1):
      Fix parallel builds (#955)

Scott K Logan (1):
      Add error message if devel_isolated relocation is attempted (#997)

Sean Yen [MSFT] (1):
      [Windows][kinetic] Fix python_distutils_install.bat.in (#992)

Shane Loretz (1):
      Add friendly error message for ros/catkin#961 (#964)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants