Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Rose <dan@digilabs.io>
  • Loading branch information
rotu committed Sep 24, 2019
1 parent 7ccd899 commit 3fdbb4a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
15 changes: 8 additions & 7 deletions rmw_implementation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,26 @@ message(STATUS "")
get_available_rmw_implementations(available_rmw_implementations)
list(LENGTH available_rmw_implementations count_available_rmw_implementations)
if(count_available_rmw_implementations EQUAL 1)
set(rmw_implementation_baked_default ON)
set(rmw_implementation_disable_runtime_selection_default ON)
else()
set(rmw_implementation_baked_default OFF)
set(rmw_implementation_disable_runtime_selection_default OFF)
endif()

option(RMW_IMPLEMENTATION_BAKED "\
option(RMW_IMPLEMENTATION_DISABLE_RUNTIME_SELECTION "\
Use only the RMW implementation specified at build time, \
ignoring runtime value of the 'RMW_IMPLEMENTATION' environment variable \
and the 'RMW_IMPLEMENTATION' CMake option"
${rmw_implementation_baked_default})
${rmw_implementation_disable_runtime_selection_default})

if(RMW_IMPLEMENTATION_BAKED)
message(STATUS "Dynamic loading disabled; directly referencing '${RMW_IMPLEMENTATION}'")
if(RMW_IMPLEMENTATION_DISABLE_RUNTIME_SELECTION)
message(STATUS "Runtime selection of RMW disabled; Statically loading "
"'${RMW_IMPLEMENTATION}'")
else()
# provides FindPoco.cmake and Poco on platforms without it
find_package(poco_vendor REQUIRED)
find_package(Poco REQUIRED COMPONENTS Foundation)

message(STATUS "Dynamic loading enabled")
message(STATUS "Runtime selection of RMW enabled")

add_library(${PROJECT_NAME} SHARED
src/functions.cpp)
Expand Down
14 changes: 7 additions & 7 deletions rmw_implementation/rmw_implementation-extras.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ elseif(NOT "$ENV{RMW_IMPLEMENTATION}" STREQUAL "")
else()
set(requested_rmw_implementation "@RMW_IMPLEMENTATION@")
set(requested_rmw_implementation_from
"the default when @PROJECT_NAME@ wasbuilt")
"the default when @PROJECT_NAME@ was built")
endif()

if(@RMW_IMPLEMENTATION_BAKED@)
if(@RMW_IMPLEMENTATION_DISABLE_RUNTIME_SELECTION@)
message(STATUS "Using RMW implementation '@RMW_IMPLEMENTATION@'")
if(NOT requested_rmw_implementation STREQUAL @RMW_IMPLEMENTATION@)
message(ERROR
if(NOT requested_rmw_implementation STREQUAL "@RMW_IMPLEMENTATION@")
message(FATAL_ERROR
"The RMW implementation has been specified as "
"'${requested_rmw_implementation}' via "
"${requested_rmw_implementation_from}, but rmw_implementation was built "
"without dynamic linking enabled. We will use '@RMW_IMPLEMENTATION@'."
"only with support for '@RMW_IMPLEMENTATION@'."
)
endif()
find_package("@RMW_IMPLEMENTATION@" REQUIRED)
Expand All @@ -53,7 +53,7 @@ else()
get_available_rmw_implementations(available_rmw_implementations)

if(NOT requested_rmw_implementation IN_LIST available_rmw_implementations)
message(WARNING
message(FATAL_ERROR
"The RMW implementation has been specified as "
"'${requested_rmw_implementation}' via "
"${requested_rmw_implementation_from}, but it is not available at this "
Expand All @@ -68,4 +68,4 @@ else()

find_package(Threads REQUIRED)
list(APPEND rmw_implementation_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
endif()
endif()

0 comments on commit 3fdbb4a

Please sign in to comment.