Skip to content

Instantly share code, notes, and snippets.

@doevelopper
Created March 9, 2022 11:31
Show Gist options
  • Save doevelopper/6c0a8af623a7bc6dec4daa1248912eee to your computer and use it in GitHub Desktop.
Save doevelopper/6c0a8af623a7bc6dec4daa1248912eee to your computer and use it in GitHub Desktop.
force linking against "Release" version of DDS libraries
```cmake
if (NOT RTIConnextDDS_FOUND)
find_package(RTIConnextDDS "6.1.0" EXACT REQUIRED COMPONENTS core)
# use always the release configuration of RTI libs regardless of current
# CMAKE_BUILD_TYPE (root cause of double free error)
set_target_properties(RTIConnextDDS::core PROPERTIES
MAP_IMPORTED_CONFIG_RELEASE Release
MAP_IMPORTED_CONFIG_DEBUG Release
MAP_IMPORTED_CONFIG_RELWITHDEBUGINFO Release)
set_target_properties(RTIConnextDDS::c_api PROPERTIES
MAP_IMPORTED_CONFIG_RELEASE Release
MAP_IMPORTED_CONFIG_DEBUG Release
MAP_IMPORTED_CONFIG_RELWITHDEBUGINFO Release)
set_target_properties(RTIConnextDDS::cpp_api PROPERTIES
MAP_IMPORTED_CONFIG_RELEASE Release
MAP_IMPORTED_CONFIG_DEBUG Release
MAP_IMPORTED_CONFIG_RELWITHDEBUGINFO Release)
set_target_properties(RTIConnextDDS::cpp2_api PROPERTIES
MAP_IMPORTED_CONFIG_RELEASE Release
MAP_IMPORTED_CONFIG_DEBUG Release
MAP_IMPORTED_CONFIG_RELWITHDEBUGINFO Release)
endif()
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment