added target for code checking in CMakeLists.txt

new target "check" uses same options as debug but will fail on warnings
This commit is contained in:
Sven Vogel 2024-04-12 23:06:10 +02:00
parent 376837d37c
commit 81d0c6b48e
2 changed files with 26 additions and 1 deletions

View File

@ -11,4 +11,4 @@ jobs:
- name: Setup SDK
run: docker pull servostar/gemstone:sdk-"$SDK" && docker build --tag gemstone:devkit-"$SDK" .
- name: Compile
run: docker run gemstone:devkit-"$SDK" make -B release
run: docker run gemstone:devkit-"$SDK" make check

View File

@ -102,3 +102,28 @@ target_compile_options(debug PUBLIC ${FLAGS} -g)
# add src directory as include path
target_include_directories(debug PUBLIC src)
# ------------------------------------------------ #
# Target Code Check #
# ------------------------------------------------ #
# Same as debug but will fail on warnings
# use as check
add_executable(check
${SOURCE_FILES}
${LEX_GENERATED_SOURCE_FILE}
${YACC_GENERATED_SOURCE_FILE})
set_target_properties(check
PROPERTIES
OUTPUT_NAME "gsc"
RUNTIME_OUTPUT_DIRECTORY "bin/check")
# compiler flags targeting a GCC debug environment
# extra -Werror flag to treat warnings as error to make github action fail on warning
target_compile_options(check PUBLIC ${FLAGS} -g -Werror)
# add src directory as include path
target_include_directories(check PUBLIC src)