Skip to content

Commit

Permalink
Merge pull request #1310 from clalancette/clalancette/fix-cmake-3.23-…
Browse files Browse the repository at this point in the history
…warning

Fix warning when building with CMake 3.23.
  • Loading branch information
dkroenke authored Apr 1, 2022
2 parents 3f5cf85 + cbd079f commit d6b1825
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions iceoryx_posh/cmake/cpptoml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ else()
set(CREATE_PATH_COMMAND mkdir -p)
endif()

if(DEFINED CMAKE_TOOLCHAIN_FILE)
set(TOOLCHAIN_FILE "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
set(cpptoml_DIR ${CMAKE_BINARY_DIR}/dependencies/install/lib/cmake/cpptoml)
set(cpptoml_DIR ${cpptoml_DIR} CACHE PATH "" FORCE)
endif()

# set download config, source and build paths
set(DOWNLOAD_CONFIG_DIR ${CMAKE_BINARY_DIR}/dependencies/cpptoml/download)
set(SOURCE_DIR ${CMAKE_BINARY_DIR}/dependencies/cpptoml/src)
Expand Down Expand Up @@ -72,14 +66,22 @@ if(result)
message(WARNING "CMake step [patch] for cpptoml failed: ${result}! Build of cpptoml might fail")
endif()

execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "-DENABLE_LIBCXX=off" "-DCPPTOML_BUILD_EXAMPLES=off" "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}" "${TOOLCHAIN_FILE}" "${SOURCE_DIR}"
"-DCMAKE_C_FLAGS_INIT=${CMAKE_C_FLAGS_INIT}"
"-DCMAKE_CXX_FLAGS_INIT=${CMAKE_CXX_FLAGS_INIT}"
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
"-DCMAKE_C_COMPILER_TARGET=${CMAKE_C_COMPILER_TARGET}"
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
"-DCMAKE_CXX_COMPILER_TARGET=${CMAKE_CXX_COMPILER_TARGET}"
"-DCMAKE_LINKER=${CMAKE_LINKER}"
set(CMAKE_ADDITIONAL_OPTIONS
"-DCMAKE_C_FLAGS_INIT=${CMAKE_C_FLAGS_INIT}"
"-DCMAKE_CXX_FLAGS_INIT=${CMAKE_CXX_FLAGS_INIT}"
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
"-DCMAKE_C_COMPILER_TARGET=${CMAKE_C_COMPILER_TARGET}"
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
"-DCMAKE_CXX_COMPILER_TARGET=${CMAKE_CXX_COMPILER_TARGET}"
"-DCMAKE_LINKER=${CMAKE_LINKER}")

if(DEFINED CMAKE_TOOLCHAIN_FILE)
list(APPEND CMAKE_ADDITIONAL_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
set(cpptoml_DIR ${CMAKE_BINARY_DIR}/dependencies/install/lib/cmake/cpptoml)
set(cpptoml_DIR ${cpptoml_DIR} CACHE PATH "" FORCE)
endif()

execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "-DENABLE_LIBCXX=off" "-DCPPTOML_BUILD_EXAMPLES=off" "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}" "${SOURCE_DIR}" ${CMAKE_ADDITIONAL_OPTIONS}
RESULT_VARIABLE result
WORKING_DIRECTORY ${BUILD_DIR} )
if(result)
Expand Down

0 comments on commit d6b1825

Please sign in to comment.