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

alternative method to use a generator expression in cmake < 2.8.12 #981

Merged
merged 1 commit into from
Mar 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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})")