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

find_package(catkin) #61

Merged
merged 1 commit into from
Feb 23, 2016
Merged

find_package(catkin) #61

merged 1 commit into from
Feb 23, 2016

Conversation

gerkey
Copy link
Contributor

@gerkey gerkey commented Feb 23, 2016

If you have a directory with two files, Foo.msg and CMakeLists.txt, with the following content:

Foo.msg:

int16 foo

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
#find_package(catkin REQUIRED)
find_package(genmsg REQUIRED)
add_message_files(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} FILES Foo.msg)

then running cmake yields this error about an undefined macro that's provided by catkin:

-- Using these message generators: 
CMake Error at /opt/ros/jade/share/genmsg/cmake/genmsg-extras.cmake:110 (assert_file_exists):
  Unknown CMake command "assert_file_exists".
Call Stack (most recent call first):
  CMakeLists.txt:4 (add_message_files)

The error can be avoided by uncommenting the find_package(catkin REQUIRED) line in the user's CMakeLists.txt, but that's not a good answer.

This PR pushes the find_package(catkin REQUIRED) call into genmsg, where the macro is being called. I'm not sure whether genmsg's package.xml dependencies should also be modified.

@dirk-thomas
Copy link
Member

I don't think using this simple function justifies a run dependency on catkin. I have created #62 to get rid of the implicit dependency.

@gerkey
Copy link
Contributor Author

gerkey commented Feb 23, 2016

Agreed, better to remove the dependency.

@gerkey gerkey closed this Feb 23, 2016
@dirk-thomas dirk-thomas reopened this Feb 23, 2016
@dirk-thomas
Copy link
Member

In order to make catkin available at runtime of this package the manifest needs a run dependency on catkin. Otherwise it looks good.

@@ -18,6 +18,9 @@ set(GENMSG_CHECK_DEPS_SCRIPT "${genmsg_DIR}/../../../@(CATKIN_PACKAGE_BIN_DESTIN

include(CMakeParseArguments)

# We need to call assert_file_exists()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please either remove the comment (since the mentioned function is not the only thing used from catkin) or extend to all parts of catkin which are used. Since the second option is likely getting outdated I would suggest the first one.

@gerkey
Copy link
Contributor Author

gerkey commented Feb 23, 2016

Added a run dependency in c8d2295 and updated the comment in 169bf66.

@@ -17,6 +17,7 @@
<author>Ken Conley</author>

<buildtool_depend version_gte="0.5.74">catkin</buildtool_depend>
<run_depend version_gte="0.5.74">catkin</run_depend>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is a reason for specifying a minimum version of catkin. All the functions and variables used at runtime exist in catkin "forever".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the buildtool depend should have a minimum version, but the run depend should not?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the minimum version for the build dependency was introduced in 6bbac53 to ensure a new enough catkin version is being used when compiling the package. That is not necessary for the runtime of the package.

@gerkey gerkey force-pushed the find_package_catkin branch from 169bf66 to 64f78b1 Compare February 23, 2016 18:38
@gerkey
Copy link
Contributor Author

gerkey commented Feb 23, 2016

Min version updated and commits squashed.

@@ -18,6 +18,9 @@ set(GENMSG_CHECK_DEPS_SCRIPT "${genmsg_DIR}/../../../@(CATKIN_PACKAGE_BIN_DESTIN

include(CMakeParseArguments)

# We need various macros and variables that are provided by catkin
find_package(catkin REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catkin variables are already being used in the lines above. Therefore I think this needs to be moved to line ~10.

@gerkey gerkey force-pushed the find_package_catkin branch from 64f78b1 to e54d7e3 Compare February 23, 2016 18:59
@gerkey
Copy link
Contributor Author

gerkey commented Feb 23, 2016

Moved earlier in e54d7e3

@dirk-thomas
Copy link
Member

Thanks for the PR and iterating on it.

dirk-thomas added a commit that referenced this pull request Feb 23, 2016
@dirk-thomas dirk-thomas merged commit 4f969dc into indigo-devel Feb 23, 2016
@dirk-thomas dirk-thomas deleted the find_package_catkin branch February 23, 2016 19:07
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