added template

This commit is contained in:
2026-10-20 13:29:42 +03:00
parent 280e806e82
commit 92bfa117af
6 changed files with 70 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# Workspace Instructions
- Keep the project compatible with C11 and CMake 3.16 or newer.
- Put public headers in `include/`, implementations in `src/`, and tests in `tests/`.
- Keep reusable functionality in libraries and link executables to those libraries.
- Register tests with CTest and avoid adding dependencies unless the project needs them.
- Verify changes with `cmake -S . -B build`, `cmake --build build`, and `ctest --test-dir build --output-on-failure`.

2
c-template/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/build/
/cmake-build-*/

13
c-template/CMakeLists.txt Normal file
View File

@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.16)
project(c_template VERSION 1.0.0 LANGUAGES C)
include(CTest)
# add_library(greeting src/greeting.c)
# target_include_directories(greeting PUBLIC include)
# target_compile_features(greeting PUBLIC c_std_11)
add_executable(c_template src/main.c)
# target_link_libraries(c_template PRIVATE greeting)

31
c-template/README.md Normal file
View File

@@ -0,0 +1,31 @@
# Laba 6
Найти и удалить в заданной строке лишние пробелы между словами и
знаками препинания
## Requirements
- CMake 3.16 or newer
- A C compiler with C11 support
## Configure and build
```sh
cmake -S . -B build
cmake --build build
```
## Run
```sh
./build/c_template
```
## Test
```sh
ctest --test-dir build --output-on-failure
```
The `greeting` library is an example of how to separate reusable code into a
public header and implementation. Replace it with your project's own modules.

7
c-template/src/main.c Normal file
View File

@@ -0,0 +1,7 @@
#include <stdio.h>
int main(void){
printf("Hello world");
return(0);
}

View File

@@ -0,0 +1,10 @@
#include <assert.h>
#include <string.h>
#include "greeting.h"
int main(void)
{
assert(strcmp(greeting_message(), "Hello, world!") == 0);
return 0;
}