diff options
author | Stefan Zabka <zabkaste@hu-berlin.de> | 2020-05-21 12:37:46 +0200 |
---|---|---|
committer | Stefan Zabka <zabkaste@hu-berlin.de> | 2020-05-21 12:37:46 +0200 |
commit | dd4f3ec7551fddb88c5d6b96ed1aff3521c937ca (patch) | |
tree | 97e603f80bde82372e0a1cbb4b70b8bfdace8740 /02_exercise/CMakeLists.txt | |
parent | f117343477e596937bdfcf0ddce447c0d127b9cf (diff) | |
download | betriebssysteme-dd4f3ec7551fddb88c5d6b96ed1aff3521c937ca.tar.gz betriebssysteme-dd4f3ec7551fddb88c5d6b96ed1aff3521c937ca.zip |
Added warning and cleaned them up
Diffstat (limited to '02_exercise/CMakeLists.txt')
-rw-r--r-- | 02_exercise/CMakeLists.txt | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/02_exercise/CMakeLists.txt b/02_exercise/CMakeLists.txt new file mode 100644 index 0000000..c2fa8d5 --- /dev/null +++ b/02_exercise/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.5) + +project(shell) + +add_executable(shell shell.c) +target_link_libraries(shell PRIVATE array prompt_utils) +add_compile_definitions(_GNU_SOURCE) + +add_library(array array.c) + +add_library(prompt_utils prompt_utils.c) +target_link_libraries(prompt_utils PRIVATE array) + +set(CMAKE_C_STANDARD gnu11) +set(CMAKE_C_STANDARD_REQUIRED True) +set(CLANG_WARNINGS + -Wall + -Wextra # reasonable and standard + -Wshadow # warn the user if a variable declaration shadows one from a + # parent context + -Wcast-align # warn for potential performance problem casts + -Wunused # warn on anything being unused + -Woverloaded-virtual # warn if you overload (not override) a virtual + # function + -Wpedantic # warn if non-standard C++ is used + -Wconversion # warn on type conversions that may lose data + -Wsign-conversion # warn on sign conversions + -Wnull-dereference # warn if a null dereference is detected + -Wdouble-promotion # warn if float is implicit promoted to double + -Wformat=2 # warn on security issues around functions that format output + # (ie printf) + -Werror + ) +set(GCC_WARNINGS + ${CLANG_WARNINGS} + -Wmisleading-indentation # warn if indentation implies blocks where blocks + # do not exist + -Wduplicated-cond # warn if if / else chain has duplicated conditions + -Wduplicated-branches # warn if if / else branches have duplicated code + -Wlogical-op # warn about logical operations being used where bitwise were + # probably wanted + -Wuseless-cast # warn if you perform a cast to the same type + ) +set(PROJECT_WARNINGS ${CLANG_WARNINGS}) +target_compile_options(shell INTERFACE ${PROJECT_WARNINGS}) +target_compile_options(prompt_utils INTERFACE ${PROJECT_WARNINGS})
\ No newline at end of file |