Skip to content

Commit

Permalink
rename TARGETS variable (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Feb 26, 2013
1 parent 13f7778 commit 9b2e409
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions cmake/catkinConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if(NOT _CATKIN_FIND_ OR _CATKIN_FIND_ EQUAL 0)
set(catkin_INCLUDE_DIRS "")
set(catkin_LIBRARIES "")
set(catkin_LIBRARY_DIRS "")
set(catkin_CODE_GENERATION_TARGETS "")
set(catkin_EXPORTED_TARGETS "")
endif()

# increment recursion counter
Expand Down Expand Up @@ -83,7 +83,7 @@ foreach(component ${catkin_FIND_COMPONENTS})
list_append_unique(catkin_INCLUDE_DIRS ${${component}_INCLUDE_DIRS})
list_append_unique(catkin_LIBRARIES ${${component}_LIBRARIES})
list_append_unique(catkin_LIBRARY_DIRS ${${component}_LIBRARY_DIRS})
list(APPEND catkin_CODE_GENERATION_TARGETS ${${component}_CODE_GENERATION_TARGETS})
list(APPEND catkin_EXPORTED_TARGETS ${${component}_EXPORTED_TARGETS})
endif()
endforeach()
list_insert_in_workspace_order(catkin_INCLUDE_DIRS ${catkin_INCLUDE_DIRS})
Expand Down
10 changes: 5 additions & 5 deletions cmake/catkin_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
# If the global variable ${PROJECT_NAME}_CFG_EXTRAS is set it will be
# prepended to the explicitly passed argument.
# :type CFG_EXTRAS: string
# :param CODE_GENERATION_TARGETS: a list of target names which generate
# :param EXPORTED_TARGETS: a list of target names which usually generate
# code. Downstream packages can depend on these targets to ensure that
# code is generated before it is being used. The generated CMake config
# file will ensure that the targets exists.
# If the global variable ${PROJECT_NAME}_CODE_GENERATION_TARGETS is
# If the global variable ${PROJECT_NAME}_EXPORTED_TARGETS is
# set it will be prepended to the explicitly passed argument.
# :type CODE_GENERATION_TARGETS: string
# :type EXPORTED_TARGETS: string
# :param SKIP_CMAKE_CONFIG_GENERATION: the option to skip the generation
# of the CMake config files for the package
# :type SKIP_CMAKE_CONFIG_GENERATION: bool
Expand Down Expand Up @@ -348,8 +348,8 @@ function(_catkin_package)
endforeach()

if(NOT PROJECT_SKIP_CMAKE_CONFIG_GENERATION)
set(PKG_CODE_GENERATION_TARGETS ${${PROJECT_NAME}_CODE_GENERATION_TARGETS} ${PROJECT_CODE_GENERATION_TARGETS})
foreach(t ${PKG_CODE_GENERATION_TARGETS})
set(PKG_EXPORTED_TARGETS ${${PROJECT_NAME}_EXPORTED_TARGETS} ${PROJECT_EXPORTED_TARGETS})
foreach(t ${PKG_EXPORTED_TARGETS})
if(NOT TARGET ${t})
message(FATAL_ERROR "catkin_package() could not find target '${t}' for code generation.")
endif()
Expand Down
6 changes: 3 additions & 3 deletions cmake/templates/pkgConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ foreach(library ${libraries})
endif()
endforeach()

set(@PROJECT_NAME@_CODE_GENERATION_TARGETS "@PKG_CODE_GENERATION_TARGETS@")
set(@PROJECT_NAME@_EXPORTED_TARGETS "@PKG_EXPORTED_TARGETS@")
# create dummy targets for exported code generation targets to make life of users easier
foreach(t ${@PROJECT_NAME@_CODE_GENERATION_TARGETS})
foreach(t ${@PROJECT_NAME@_EXPORTED_TARGETS})
if(NOT TARGET ${t})
add_custom_target(${t})
endif()
Expand All @@ -157,7 +157,7 @@ foreach(depend ${depends})
_list_append_unique(@PROJECT_NAME@_INCLUDE_DIRS ${${@PROJECT_NAME@_dep}_INCLUDE_DIRS})
list(APPEND @PROJECT_NAME@_LIBRARIES ${${@PROJECT_NAME@_dep}_LIBRARIES})
_list_append_unique(@PROJECT_NAME@_LIBRARY_DIRS ${${@PROJECT_NAME@_dep}_LIBRARY_DIRS})
list(APPEND @PROJECT_NAME@_CODE_GENERATION_TARGETS ${${@PROJECT_NAME@_dep}_CODE_GENERATION_TARGETS})
list(APPEND @PROJECT_NAME@_EXPORTED_TARGETS ${${@PROJECT_NAME@_dep}_EXPORTED_TARGETS})
endforeach()

if(@PROJECT_NAME@_LIBRARIES)
Expand Down
4 changes: 2 additions & 2 deletions test/mock_resources/src/catkin_test/quux_user/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ include_directories(${sensor_msgs_INCLUDE_DIRS})
include_directories(${std_msgs_INCLUDE_DIRS} ${quux_msgs_INCLUDE_DIRS})

add_executable(quux_user-exec src/main.cpp)
add_dependencies(quux_user-exec sensor_msgs_gencpp)
add_dependencies(quux_user-exec ${sensor_msgs_EXPORTED_TARGETS})

message(STATUS ${roscpp_serialization_LIBRARIES})

Expand All @@ -41,4 +41,4 @@ target_link_libraries(quux_user-exec ${roscpp_serialization_LIBRARIES} ${rostime
add_executable(quux_srv-exec src/srv_test.cpp)

target_link_libraries(quux_srv-exec ${roscpp_serialization_LIBRARIES})
add_dependencies(quux_srv-exec sensor_msgs_gencpp)
add_dependencies(quux_srv-exec ${sensor_msgs_EXPORTED_TARGETS})

0 comments on commit 9b2e409

Please sign in to comment.