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.
This commit is contained in:
Đoàn Trần Công Danh 2021-02-24 20:17:26 +07:00 committed by Đoàn Trần Công Danh
parent 70d21fee4a
commit 0d75e72b8b

View file

@ -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