build: introduce default build variables (#21991)

There are a number of cmake variables and cache variables that need to
be passed to all dependencies. This is not only cumbersome, but also
fragile as it's easy to miss adding or removing a flag from a dependency
by accident. Introducing a global variable that controls all builds
makes it much easier to handle our dependencies.

Also fixes the currently broken release workflow as we need to pass the
CMAKE_OSX_ARCHITECTURES variable to all dependencies built with cmake.
This commit is contained in:
dundargoc
2023-01-25 14:36:17 +01:00
committed by GitHub
parent 06d1e86ff8
commit b8288df99b
11 changed files with 38 additions and 67 deletions

View File

@@ -1,13 +1,3 @@
set(MSGPACK_CMAKE_ARGS
-DMSGPACK_BUILD_TESTS=OFF
-DMSGPACK_BUILD_EXAMPLES=OFF
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
-DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
${BUILD_TYPE_STRING})
if(USE_EXISTING_SRC_DIR)
unset(MSGPACK_URL)
endif()
@@ -16,8 +6,9 @@ ExternalProject_Add(msgpack
URL_HASH SHA256=${MSGPACK_SHA256}
DOWNLOAD_NO_PROGRESS TRUE
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/msgpack
CMAKE_ARGS "${MSGPACK_CMAKE_ARGS}"
CMAKE_CACHE_ARGS
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES})
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
-DMSGPACK_BUILD_TESTS=OFF
-DMSGPACK_BUILD_EXAMPLES=OFF
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS})
list(APPEND THIRD_PARTY_DEPS msgpack)