diff options
Diffstat (limited to '02_exercise/CMakeLists.txt')
-rw-r--r-- | 02_exercise/CMakeLists.txt | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/02_exercise/CMakeLists.txt b/02_exercise/CMakeLists.txt index c2fa8d5..ca67d1a 100644 --- a/02_exercise/CMakeLists.txt +++ b/02_exercise/CMakeLists.txt @@ -1,9 +1,14 @@ cmake_minimum_required(VERSION 3.5) -project(shell) +project(shell C) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_C_STANDARD 11) +set(CMAKE_C_STANDARD_REQUIRED True) + +add_executable(prog prog.c) add_executable(shell shell.c) -target_link_libraries(shell PRIVATE array prompt_utils) +target_link_libraries(shell PRIVATE array prompt_utils process) add_compile_definitions(_GNU_SOURCE) add_library(array array.c) @@ -11,8 +16,17 @@ 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) +add_executable(prompt_utils_test prompt_utils_test.c) +target_link_libraries(prompt_utils_test PRIVATE prompt_utils array) + +add_library(process process.c) +target_link_libraries(process PRIVATE array) + +add_executable(process_test process_test.c) +target_link_libraries(process_test PRIVATE process) + + + set(CLANG_WARNINGS -Wall -Wextra # reasonable and standard @@ -20,8 +34,6 @@ set(CLANG_WARNINGS # 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 @@ -39,8 +51,7 @@ set(GCC_WARNINGS -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}) +set(PROJECT_WARNINGS ${GCC_WARNINGS}) target_compile_options(shell INTERFACE ${PROJECT_WARNINGS}) target_compile_options(prompt_utils INTERFACE ${PROJECT_WARNINGS})
\ No newline at end of file |