Skip to content

Commit

Permalink
Merge pull request #981 from ros-visualization/fix_saucy_cmake
Browse files Browse the repository at this point in the history
alternative method to use a generator expression in cmake < 2.8.12
  • Loading branch information
wjwwood committed Mar 24, 2016
2 parents e824fc2 + 66d3305 commit 78d4851
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/rviz/default_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,23 @@ install(TARGETS default_plugin
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})

# Generate to the devel space so the extras file can include it from the devel space.
file(GENERATE
OUTPUT "${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/default_plugin_location.cmake"
CONTENT "set(rviz_DEFAULT_PLUGIN_FILE_NAME $<TARGET_FILE_NAME:default_plugin>)"
add_custom_command(
OUTPUT ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/default_plugin_location.cmake
COMMAND
${CMAKE_COMMAND}
-DPATH_TO_FILE="${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/default_plugin_location.cmake"
-DDEFAULT_PLUGIN_FILE_NAME=$<TARGET_FILE_NAME:default_plugin>
-P ${CMAKE_CURRENT_SOURCE_DIR}/file_generate_helper.cmake
)
add_custom_target(create_default_plugin_location_file ALL
DEPENDS ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/default_plugin_location.cmake
)
# TODO(wjwwood): remove the solution above (including the file_generate_helper.cmake file) when we can
# depend on cmake >= 2.8.12 (after dropping Saucy) and use the snippet below.
# file(GENERATE
# OUTPUT "${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/default_plugin_location.cmake"
# CONTENT "set(rviz_DEFAULT_PLUGIN_FILE_NAME $<TARGET_FILE_NAME:default_plugin>)"
# )
# Install from the devel space to the install space.
install(FILES "${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/default_plugin_location.cmake"
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake
Expand Down
1 change: 1 addition & 0 deletions src/rviz/default_plugin/file_generate_helper.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file(WRITE "${PATH_TO_FILE}" "set(rviz_DEFAULT_PLUGIN_FILE_NAME ${DEFAULT_PLUGIN_FILE_NAME})")

0 comments on commit 78d4851

Please sign in to comment.