From a742d4afc5fe155d85c492dec7790925d78f9993 Mon Sep 17 00:00:00 2001 From: Emilio Corigliano <emilio.corigliano@skywarder.eu> Date: Fri, 15 Mar 2024 14:55:48 +0100 Subject: [PATCH] [SBS] Updated cmake to test build a static library instead of an executable and build also if build system finds clang++ --- cmake/sbs.cmake | 4 ++++ sbs | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/sbs.cmake b/cmake/sbs.cmake index 7cd5a66c2..25d03aa9b 100644 --- a/cmake/sbs.cmake +++ b/cmake/sbs.cmake @@ -19,6 +19,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. +# We want to test for building of static library and not an executable +# reference: https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program +set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") + enable_language(C CXX ASM) # Load in SBS_BASE the project path diff --git a/sbs b/sbs index f867e9960..a0b9102ff 100755 --- a/sbs +++ b/sbs @@ -55,6 +55,7 @@ find_deps() { command -v cmake > /dev/null 2>&1 && found_cmake=true command -v arm-miosix-eabi-g++ > /dev/null 2>&1 && found_miosixgpp=true + command -v clang++ > /dev/null 2>&1 && found_clangpp=true command -v ccache > /dev/null 2>&1 && found_ccache=true command -v ninja > /dev/null 2>&1 && found_ninja=true command -v python > /dev/null 2>&1 && found_python=true @@ -66,6 +67,7 @@ find_deps() { printf "Found CMake: "; [ "$found_cmake" = true ] && echo "yes" || echo "no" printf "Found arm-miosix-eabi-g++: "; [ "$found_miosixgpp" = true ] && echo "yes" || echo "no" + printf "Found clang++: "; [ "$found_clangpp" = true ] && echo "yes" || echo "no" printf "Found Ccache: "; [ "$found_ccache" = true ] && echo "yes" || echo "no" printf "Found Ninja: "; [ "$found_ninja" = true ] && echo "yes" || echo "no" printf "Found Python: "; [ "$found_python" = true ] && echo "yes" || echo "no" @@ -75,8 +77,8 @@ find_deps() { printf "Found flasher: "; [ "$found_stflash" = true ] && echo "st-flash" \ || { [ "$found_stlink" = true ] && echo "st-link" || echo "no"; } - [ "$found_cmake" = true ] || { echo "Error: CMake must be installed"; return 1; } - [ "$found_miosixgpp" = true ] || { echo "Error: arm-miosix-eabi-g++ must be installed"; return 1; } + [ "$found_cmake" = true ] || { echo "Error: CMake must be installed"; return 1; } + [ "$found_clangpp" = true ] || { echo "Error: clang++ must be installed"; return 1; } } # Workaround: Disable tests in excluded subdirectories -- GitLab