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

jsk_topic_tools/cmake/nodelet.cmake: add random prefix before _single… #1586

Merged
merged 2 commits into from
Jul 26, 2018
Merged
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
16 changes: 9 additions & 7 deletions jsk_topic_tools/cmake/nodelet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ macro(jsk_nodelet _nodelet_cpp _nodelet_class
_single_nodelet_exec_name _CODE_PARAM_NAME)
list(APPEND ${_CODE_PARAM_NAME} ${_nodelet_cpp})
set(NODELET ${_nodelet_class})
set(DEFAULT_NODE_NAME ${_single_nodelet_exec_name})
string(RANDOM __NODENAME_PREFIX)
set(DEFAULT_NODE_NAME JSK_NODELET_${__NODENAME_PREFIX}_${_single_nodelet_exec_name})
Copy link
Member

@furushchev furushchev Aug 2, 2018

Choose a reason for hiding this comment

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

@k-okada Is there any rationale that you randomized the prefix?
I wonder any target may miss caches in the case of catkin build --force-cmake.
How about changing __NODENAME_PREFIX to, for example, just PROJECT_NAME?

Copy link
Member Author

Choose a reason for hiding this comment

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

@furushchev thank you for feedback, yes PROJECT_NAME would be better #1591

if(${USE_ROSBUILD})
rosbuild_find_ros_package(jsk_topic_tools)
set(_jsk_topic_tools_SOURCE_DIR ${jsk_topic_tools_PACKAGE_PATH})
Expand All @@ -19,19 +20,20 @@ macro(jsk_nodelet _nodelet_cpp _nodelet_class
endif(${USE_ROSBUILD})
configure_file(
${_jsk_topic_tools_SOURCE_DIR}/cmake/single_nodelet_exec.cpp.in
${_single_nodelet_exec_name}.cpp)
${DEFAULT_NODE_NAME}.cpp)
if(${USE_ROSBUILD})
rosbuild_add_executable(${_single_nodelet_exec_name} build/${_single_nodelet_exec_name}.cpp)
rosbuild_add_executable(${DEFAULT_NODE_NAME} build/${DEFAULT_NODE_NAME}.cpp)
else(${USE_ROSBUILD})
add_executable(${_single_nodelet_exec_name} ${_single_nodelet_exec_name}.cpp)
add_executable(${DEFAULT_NODE_NAME} ${DEFAULT_NODE_NAME}.cpp)
find_package(Boost QUIET REQUIRED COMPONENTS program_options)
target_link_libraries(${_single_nodelet_exec_name} ${catkin_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(${DEFAULT_NODE_NAME} ${catkin_LIBRARIES} ${Boost_LIBRARIES})
endif(${USE_ROSBUILD})
set_target_properties(${DEFAULT_NODE_NAME} PROPERTIES OUTPUT_NAME ${_single_nodelet_exec_name})
if (${ARGC} GREATER 4)
list(APPEND ${ARGV4} ${_single_nodelet_exec_name})
list(APPEND ${ARGV4} ${DEFAULT_NODE_NAME})
endif(${ARGC} GREATER 4)
if(NOT ${USE_ROSBUILD})
install(TARGETS ${_single_nodelet_exec_name}
install(TARGETS ${DEFAULT_NODE_NAME}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
Expand Down