Skip to content

Commit

Permalink
fixup! foonathan build fixes & upgrade to 0.7-3
Browse files Browse the repository at this point in the history
simplify further and use MakeAvailable
  • Loading branch information
maloel committed Oct 23, 2023
1 parent cac3099 commit 64cd29a
Showing 1 changed file with 7 additions and 28 deletions.
35 changes: 7 additions & 28 deletions CMake/external_foonathan_memory.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,21 @@ function(get_foonathan_memory)
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/third-party/foonathan_memory
)

# Always a static library
set( BUILD_SHARED_LIBS OFF )

# Remove unrequired targets
set(FOONATHAN_MEMORY_BUILD_VARS -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF
-DFOONATHAN_MEMORY_BUILD_TESTS=OFF
-DFOONATHAN_MEMORY_BUILD_TOOLS=OFF)

# Align STATIC CRT definitions with LRS
if(BUILD_WITH_STATIC_CRT)
set(FOONATHAN_MEMORY_BUILD_VARS ${FOONATHAN_MEMORY_BUILD_VARS}
-DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreaded$<$<CONFIG:Debug>:Debug>)
endif()

# Set foonathan_memory variables
# These are exposed options; not internal
set( FOONATHAN_MEMORY_BUILD_EXAMPLES OFF )
set( FOONATHAN_MEMORY_BUILD_TESTS OFF )
set( FOONATHAN_MEMORY_BUILD_TOOLS OFF )

# Since `FastDDS` require foonathan_memory package installed during configure time,
# We download it build it and install it both in Release & Debug configuration since we need both available.
# We use `FetchContent_Populate` and not `FetchContent_MakeAvailable` for that reason, we want to manually configure and build it.
FetchContent_GetProperties(foonathan_memory)
if(NOT foonathan_memory_POPULATED)
FetchContent_Populate(foonathan_memory)
endif()
FetchContent_MakeAvailable( foonathan_memory )

# Mark new options from FetchContent as advanced options
mark_as_advanced(FETCHCONTENT_SOURCE_DIR_FOONATHAN_MEMORY)
mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_FOONATHAN_MEMORY)


add_subdirectory( "${foonathan_memory_SOURCE_DIR}" "${foonathan_memory_SOURCE_DIR}/build" )


# Without this line, everything seems to work but find_package() will give:
# Found foonathan_memory: foonathan_memory_DIR-NOTFOUND
set( foonathan_memory_DIR "${foonathan_memory_SOURCE_DIR}" )


list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "Done")

Expand Down

0 comments on commit 64cd29a

Please sign in to comment.