Gtest errors when compiling workspace
For some time now (due to some update, probably), I have problems with GTest when compiling a workspace.
When installing GTest on the system, libgtest.so and libgtest_main.so are created, and cmake finds them. They are static or dynamic depending on how it is installed. Everithing is OK (I suppose)
When compiling a workspace, I always have the same error:
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/paco/ros_ws/tests_ws/build/test_results
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found gtest: gtests will be built
CMake Error at /opt/ros/kinetic/share/catkin/cmake/test/gtest.cmake:372 (add_library): add_library cannot create imported target "gtest" because another target with the same name already exists. Call Stack (most recent call first): /opt/ros/kinetic/share/catkin/cmake/all.cmake:147 (include) /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include) CMakeLists.txt:52 (find_package)
CMake Error at /opt/ros/kinetic/share/catkin/cmake/test/gtest.cmake:374 (add_library): add_library cannot create imported target "gtest_main" because another target with the same name already exists. Call Stack (most recent call first): /opt/ros/kinetic/share/catkin/cmake/all.cmake:147 (include) /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include) CMakeLists.txt:52 (find_package)
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.11
This is caused because in /opt/ros/kinetic/share/catkin/cmake/test/gtest.cmake:363, libgtest.so is required to be built, even if it exists in the system, producing that error.
Is there something I'm doing wrong, or is it misconfigured in my system?
What version of the package
ros-kinetic-catkin
do you have installed?0.7.11-0xenial-20180222-175501-0800