Skip to content

Commit

Permalink
Look for debug versions of fastcdr and fastrtps as well (#116)
Browse files Browse the repository at this point in the history
* Revert "Merge pull request #115 from ros2/revert-75-export-libraries"

This reverts commit 321ca7e, reversing
changes made to 7149491.

* Look for debug versions of fastcdr and fastrtps as well

* Split library variables into release and debug

* Join FastRTPS_LIBRARIES_RELEASE and FastRTPS_LIBRARIES_DEBUG back into FastRTPS_LIBRARIES

* Export debug/optimized libraries separately

* Reduce if nesting

* Explicitly use 'd' as a suffix for debug libraries

* Fix indentation
  • Loading branch information
esteve authored and dirk-thomas committed Jun 13, 2017
1 parent 321ca7e commit b9b7f9a
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
56 changes: 56 additions & 0 deletions fastrtps_cmake_module/cmake/Modules/FindFastRTPS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,65 @@ set(FastRTPS_FOUND FALSE)
find_path(FastRTPS_INCLUDE_DIR
NAMES fastrtps/)

find_package(fastcdr REQUIRED CONFIG)
find_package(fastrtps REQUIRED CONFIG)

string(REGEX MATCH "^[0-9]+\\.[0-9]+" fastcdr_MAJOR_MINOR_VERSION "${fastcdr_VERSION}")
string(REGEX MATCH "^[0-9]+\\.[0-9]+" fastrtps_MAJOR_MINOR_VERSION "${fastrtps_VERSION}")

find_library(FastCDR_LIBRARY_RELEASE
NAMES fastcdr-${fastcdr_MAJOR_MINOR_VERSION} fastcdr)

find_library(FastCDR_LIBRARY_DEBUG
NAMES fastcdrd-${fastcdr_MAJOR_MINOR_VERSION})

if(FastCDR_LIBRARY_RELEASE AND FastCDR_LIBRARY_DEBUG)
set(FastCDR_LIBRARIES
optimized ${FastCDR_LIBRARY_RELEASE}
debug ${FastCDR_LIBRARY_DEBUG}
)
elseif(FastCDR_LIBRARY_RELEASE)
set(FastCDR_LIBRARIES
${FastCDR_LIBRARY_RELEASE}
)
elseif(FastCDR_LIBRARY_DEBUG)
set(FastCDR_LIBRARIES
${FastCDR_LIBRARY_DEBUG}
)
else()
set(FastCDR_LIBRARIES "")
endif()

find_library(FastRTPS_LIBRARY_RELEASE
NAMES fastrtps-${fastrtps_MAJOR_MINOR_VERSION} fastrtps)

find_library(FastRTPS_LIBRARY_DEBUG
NAMES fastrtpsd-${fastrtps_MAJOR_MINOR_VERSION})

if(FastRTPS_LIBRARY_RELEASE AND FastRTPS_LIBRARY_DEBUG)
set(FastRTPS_LIBRARIES
optimized ${FastRTPS_LIBRARY_RELEASE}
debug ${FastRTPS_LIBRARY_DEBUG}
${FastCDR_LIBRARIES}
)
elseif(FastRTPS_LIBRARY_RELEASE)
set(FastRTPS_LIBRARIES
${FastRTPS_LIBRARY_RELEASE}
${FastCDR_LIBRARIES}
)
elseif(FastRTPS_LIBRARY_DEBUG)
set(FastRTPS_LIBRARIES
${FastRTPS_LIBRARY_DEBUG}
${FastCDR_LIBRARIES}
)
else()
set(FastRTPS_LIBRARIES "")
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FastRTPS
FOUND_VAR FastRTPS_FOUND
REQUIRED_VARS
FastRTPS_INCLUDE_DIR
FastRTPS_LIBRARIES
)
3 changes: 2 additions & 1 deletion rmw_fastrtps_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ find_package(rcutils REQUIRED)
find_package(fastrtps_cmake_module REQUIRED)
find_package(fastcdr REQUIRED CONFIG)
find_package(fastrtps REQUIRED CONFIG)
find_package(FastRTPS REQUIRED MODULE)

find_package(rmw REQUIRED)
find_package(rosidl_generator_c REQUIRED)
Expand Down Expand Up @@ -59,7 +60,7 @@ ament_target_dependencies(rmw_fastrtps_cpp

configure_rmw_library(rmw_fastrtps_cpp)

ament_export_libraries(rmw_fastrtps_cpp fastcdr fastrtps)
ament_export_libraries(rmw_fastrtps_cpp ${FastRTPS_LIBRARIES})
if(NOT WIN32 AND NOT ANDROID)
ament_export_libraries(pthread)
endif()
Expand Down

0 comments on commit b9b7f9a

Please sign in to comment.