From 61829c06f5648021a5673afd33c374f56077664b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Wed, 24 Feb 2021 20:17:26 +0700 Subject: [PATCH] build-style/cmake: pass LIBS as CMAKE_*_STANDARD_LIBRARIES Normally, we can add them into configure_args directly. However, if we need to link with 2 or more libaries (e.g. -latomic and -lexecinfo on armv6-musl), we have noway to do it properly: - configure_args will be splited on whitespace - cmake denies to recognise CMAKE_*_STANDARD_LIBRARIES as a list, hence denies to split on semicolon (";") Let's pass LIBS as CMAKE_*_STANDARD_LIBRARIES instead. --- common/build-style/cmake.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/build-style/cmake.sh b/common/build-style/cmake.sh index 401dabad31c8..33a556be0011 100644 --- a/common/build-style/cmake.sh +++ b/common/build-style/cmake.sh @@ -65,7 +65,10 @@ _EOF export CMAKE_GENERATOR="${CMAKE_GENERATOR:-Ninja}" # Remove -pipe: https://gitlab.kitware.com/cmake/cmake/issues/19590 CFLAGS="-DNDEBUG ${CFLAGS/ -pipe / }" CXXFLAGS="-DNDEBUG ${CXXFLAGS/ -pipe / }" \ - cmake ${cmake_args} ${configure_args} ${wrksrc}/${build_wrksrc} + cmake ${cmake_args} ${configure_args} \ + ${LIBS:+-DCMAKE_C_STANDARD_LIBRARIES="$LIBS"} \ + ${LIBS:+-DCMAKE_CXX_STANDARD_LIBRARIES="$LIBS"} \ + ${wrksrc}/${build_wrksrc} # Replace -isystem with -I if [ "$CMAKE_GENERATOR" = "Unix Makefiles" ]; then