diff --git a/CMake/Findfoonathan_memory.cmake b/CMake/Findfoonathan_memory.cmake new file mode 100644 index 00000000000..0f1f49a86dc --- /dev/null +++ b/CMake/Findfoonathan_memory.cmake @@ -0,0 +1,35 @@ + +# This is a dummy file, just so CMake does not complain: + +# CMake Error at build/third-party/fastdds/CMakeLists.txt:239 (find_package): +# By not providing "Findfoonathan_memory.cmake" in CMAKE_MODULE_PATH this +# project has asked CMake to find a package configuration file provided by +# "foonathan_memory", but CMake did not find one. +# +# Could not find a package configuration file provided by "foonathan_memory" +# with any of the following names: +# +# foonathan_memoryConfig.cmake +# foonathan_memory-config.cmake +# +# Add the installation prefix of "foonathan_memory" to CMAKE_PREFIX_PATH or +# set "foonathan_memory_DIR" to a directory containing one of the above +# files. If "foonathan_memory" provides a separate development package or +# SDK, be sure it has been installed. + +# FastDDS requires foonathan_memory and will not find it if we do not provide this +# file. +# +# Since all the variables should already be set by external_foonathan_memory.cmake, +# we don't really do anything. + +# This may not be the proper way to do this. But it works... + + +#message( "In Findfoonathan_memory.cmake" ) + + +#find_package( PkgConfig ) +#pkg_check_modules( foonathan_memory QUIET foonathan_memory ) + + diff --git a/CMake/external_fastdds.cmake b/CMake/external_fastdds.cmake index 8c6739e7b8f..126c9ba9eab 100644 --- a/CMake/external_fastdds.cmake +++ b/CMake/external_fastdds.cmake @@ -47,13 +47,13 @@ function(get_fastdds) mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_FASTDDS) # place FastDDS project with other 3rd-party projects - set_target_properties(fastcdr fastrtps PROPERTIES + set_target_properties(fastcdr fastrtps foonathan_memory PROPERTIES FOLDER "ExternalProjectTargets/fastdds") list(POP_BACK CMAKE_MESSAGE_INDENT) # Unindent outputs add_library(dds INTERFACE) - target_link_libraries(dds INTERFACE fastcdr fastrtps) + target_link_libraries( dds INTERFACE fastcdr fastrtps ) add_definitions(-DBUILD_WITH_DDS) diff --git a/CMake/external_foonathan_memory.cmake b/CMake/external_foonathan_memory.cmake index bcff6b4e3e9..20c3b3ea1d6 100644 --- a/CMake/external_foonathan_memory.cmake +++ b/CMake/external_foonathan_memory.cmake @@ -13,7 +13,7 @@ list(APPEND CMAKE_MESSAGE_INDENT " ") FetchContent_Declare( foonathan_memory GIT_REPOSITORY https://github.com/foonathan/memory.git - GIT_TAG "v0.7-2" + GIT_TAG "v0.7-3" GIT_SHALLOW ON # No history needed SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/third-party/foonathan_memory ) @@ -22,7 +22,7 @@ FetchContent_Declare( set(FOONATHAN_MEMORY_BUILD_VARS -DBUILD_SHARED_LIBS=OFF # explicit set static lib -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF -DFOONATHAN_MEMORY_BUILD_TESTS=OFF - -DFOONATHAN_MEMORY_BUILD_TOOLS=ON) # this tool is needed during configure time only, FastDDS recommend turning it ON. + -DFOONATHAN_MEMORY_BUILD_TOOLS=OFF) # Align STATIC CRT definitions with LRS if(BUILD_WITH_STATIC_CRT) @@ -45,39 +45,13 @@ mark_as_advanced(FETCHCONTENT_SOURCE_DIR_FOONATHAN_MEMORY) mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_FOONATHAN_MEMORY) -# Configure stage -execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/fastdds/fastdds_install - ${FOONATHAN_MEMORY_BUILD_VARS} - . - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/third-party/foonathan_memory" - OUTPUT_QUIET - RESULT_VARIABLE configure_ret -) +add_subdirectory( "${foonathan_memory_SOURCE_DIR}" ) -# Build and install Debug version -execute_process(COMMAND "${CMAKE_COMMAND}" --build . --config Debug --target install - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/third-party/foonathan_memory" - OUTPUT_QUIET - RESULT_VARIABLE debug_build_ret -) -# Build and install RelWithDeb version -execute_process(COMMAND "${CMAKE_COMMAND}" --build . --config RelWithDebInfo --target install - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/third-party/foonathan_memory" - OUTPUT_QUIET - RESULT_VARIABLE rel_with_deb_info_build_ret -) - -# Build and install Release version -execute_process(COMMAND "${CMAKE_COMMAND}" --build . --config Release --target install - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/third-party/foonathan_memory" - OUTPUT_QUIET - RESULT_VARIABLE release_build_ret -) +# 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}" ) - if(configure_ret OR debug_build_ret OR release_build_ret OR rel_with_deb_info_build_ret) - message( FATAL_ERROR "Failed to build foonathan_memory") - endif() list(POP_BACK CMAKE_MESSAGE_INDENT) message(CHECK_PASS "Done")