From cf8fe181a2b37c4f47c32649c0c216a9acd13248 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Sat, 25 Nov 2023 20:27:09 +0300 Subject: [PATCH] Change way to handle arguments in configure --- CMakeLists.txt | 2 +- configure | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c290f3b..e3ff16b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ add_executable(csnake src/sleep.c ) -set_target_properties(csnake PROPERTIES C_STANDARD 99) +set_target_properties(csnake PROPERTIES C_STANDARD 11) set_target_properties(csnake PROPERTIES C_EXTENSIONS FALSE) target_include_directories(csnake PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/configure b/configure index e5add12..71ed007 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #!/bin/sh -if [[ "$*" == *"--help"* ]] || [[ "$*" == *"-h"* ]] -then +usage() +{ echo "Use environment variables to pass values: CC - compiler (default: cc) CFLAGS - flags for compiler @@ -11,7 +11,17 @@ then DEFX - start x DEFY - start y" exit 1 -fi +} + +while test $# -gt 0; do + case "$1" in + -h) usage + ;; + --help) usage + ;; + esac + shift +done CC=${CC:-cc} CFLAGS=${CFLAGS:-}