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

check target before linking #3

Open
wants to merge 1 commit into
base: kinetic-devel
Choose a base branch
from

Conversation

Hunk86
Copy link

@Hunk86 Hunk86 commented Jun 11, 2019

gmock isn't working with catkin
check if target is build that the linking doesn't fail

@v-lopez
Copy link
Contributor

v-lopez commented Jun 11, 2019

May I ask what error are you having? Do you have google-mock installed?

@Hunk86
Copy link
Author

Hunk86 commented Jun 11, 2019

Of course

Using PYTHON_EXECUTABLE: /usr/bin/python2
Using Debian Python package layout
Using empy: /usr/bin/empy
Using CATKIN_ENABLE_TESTING: ON
Call enable_testing()
Using CATKIN_TEST_RESULTS_DIR: build/ddynamic_reconfigure/test_results
Found gtest: gtests will be built
Using Python nosetests: /usr/bin/nosetests-2.7
catkin 0.7.17
BUILD_SHARED_LIBS is on
[0m at ddynamic_reconfigure/CMakeLists.txt:54 (target_link_libraries):
  Cannot specify link libraries for target "ddynamic_reconfigure-test" which
  is not built by this project.
[0m Configuring incomplete, errors occurred!

I Installed google-mock by source. Which Version do you need ?

#
# Register the launch file with add_rostest() and compile all
# passed files into a GMock binary.
#
# .. note:: The function does nothing if GMock was not found.  The
#   target is only compiled when tests are built and linked against
#   the GMock libraries.
#
# :param target: target name of the GMock executable
# :type target: string
# :param launch_file: the relative path to the roslaunch file
# :type launch_file: string
# :param ARGN: the files to compile into a GMock executable
# :type ARGN: list of files
#
function(add_rostest_gmock target launch_file)
  _add_rostest_google_test("gmock" ${target} ${launch_file} ${ARGN})
endfunction()

-> I think in my case gmock isn't found, but this shouldn't give a linker error.

@v-lopez
Copy link
Contributor

v-lopez commented Jun 11, 2019

It should be installed via rosdep since it's listed on the package.xml as a dependency.

It shuold install a deb package called google-mock on ubuntu.

@Hunk86
Copy link
Author

Hunk86 commented Jun 11, 2019

It is installed

Reading package lists... Done
Building dependency tree       
Reading state information... Done
google-mock is already the newest version (1.8.0-6).
google-mock set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 38 not upgraded.

@v-lopez
Copy link
Contributor

v-lopez commented Jun 11, 2019

You are on melodic I assume.

I just used a melodic docker from osrf and succesfully built the package and the tests.
With the same google-mock version.

I used

docker run -it osrf/ros:melodic-desktop-bionic bash
mkdir ws/src -p
cd ws/src
git clone https://github.com/pal-robotics/ddynamic_reconfigure
catkin_make
catkin_make tests

@Hunk86
Copy link
Author

Hunk86 commented Jun 11, 2019

That is correct

The problem in my case is, that we build gtest by source and set the GTEST_ROOT= /opt/gtest.
With this catkin didn't find gmock, because catkin always expect gtest in /usr/include

@v-lopez
Copy link
Contributor

v-lopez commented Jun 12, 2019

I believe then it's better to make a PR for https://github.com/ros/catkin/blob/kinetic-devel/cmake/test/gtest.cmake

You can already disable the tests using CATKIN_ENABLE_TESTING.

@Hunk86
Copy link
Author

Hunk86 commented Jun 12, 2019

In my opinion is to check if the target exist always a good proceed

But you are correct I also have to add a pullrequest for gtest.cmake that this will find a custom gmock installation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants