Skip to content

Commit

Permalink
Require Windows static build only if SHM enabled
Browse files Browse the repository at this point in the history
This addresses

  CMake Error at src/CMakeLists.txt:50 (message):
    CycloneDDS with enabled shared memory support can only be built as a static
    library on Windows

on Windows when ENABLE_SHM=AUTO is in effect.

Signed-off-by: Erik Boasson <[email protected]>
  • Loading branch information
eboasson committed Jan 25, 2023
1 parent 37c25f2 commit 16928eb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,23 @@ set(ENABLE_SHM "AUTO" CACHE STRING "Enable shared memory support")

set_property(CACHE ENABLE_SHM PROPERTY STRINGS ON OFF AUTO)
if(ENABLE_SHM)
if(WIN32)
if (BUILD_SHARED_LIBS OR NOT DEFINED BUILD_SHARED_LIBS)
message(FATAL_ERROR "CycloneDDS with enabled shared memory support can only be built as a static library on Windows")
endif()
endif()
if(NOT ENABLE_SHM STREQUAL "AUTO")
set(iceoryx_required REQUIRED)
else()
set(iceoryx_required QUIET)
endif()
find_package(iceoryx_binding_c ${iceoryx_required})
set(ENABLE_SHM ${iceoryx_binding_c_FOUND} CACHE STRING "" FORCE)
if(ENABLE_SHM AND APPLE)
endif()
# now ENABLE_SHM is no longer AUTO
if(ENABLE_SHM)
if(APPLE)
get_filename_component(iceoryx_libdir "${ICEORYX_LIB}" DIRECTORY)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${iceoryx_libdir}")
elseif(WIN32)
if (BUILD_SHARED_LIBS OR NOT DEFINED BUILD_SHARED_LIBS)
message(FATAL_ERROR "CycloneDDS with enabled shared memory support can only be built as a static library on Windows")
endif()
endif()
endif()

Expand Down

0 comments on commit 16928eb

Please sign in to comment.