Restuctured source tree - added bin and tests directories

Disabled warnings as errors
bumped the cmake min version to 3.12 for c++20 support and -j flag
Placed a CMakeLists.txt in each subdirectory of the project
This commit is contained in:
Egor 2024-10-24 04:25:45 +03:00
parent e16a1a6f6e
commit cab1b88a77
13 changed files with 18 additions and 13 deletions

View file

@ -1,5 +1,4 @@
Checks: 'clang-diagnostic-*,clang-analyzer-*,cppcoreguidelines-*,modernize-*,-modernize-use-trailing-return-type,readability-*' Checks: 'clang-diagnostic-*,clang-analyzer-*,cppcoreguidelines-*,modernize-*,-modernize-use-trailing-return-type,readability-*'
WarningsAsErrors: '*'
CheckOptions: CheckOptions:
- { key: readability-identifier-naming.NamespaceCase, value: lower_case } - { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- { key: readability-identifier-naming.ClassCase, value: CamelCase } - { key: readability-identifier-naming.ClassCase, value: CamelCase }

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.12)
project(yadro-task VERSION 0.1 LANGUAGES CXX) project(yadro-task VERSION 0.1 LANGUAGES CXX)
@ -9,13 +9,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_program(CLANG_TIDY_EXE NAMES clang-tidy REQUIRED) find_program(CLANG_TIDY_EXE NAMES clang-tidy REQUIRED)
set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE}) set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE})
file(GLOB SOURCES src/*.cpp) enable_testing()
add_executable(${PROJECT_NAME} ${SOURCES}) add_subdirectory(src)
add_subdirectory(bin)
target_include_directories(${PROJECT_NAME} add_subdirectory(tests)
PRIVATE
${PROJECT_SOURCE_DIR}/include
)
set_property(TARGET ${PROJECT_NAME} PROPERTY COMPILE_WARNINGS_AS_ERRORS ON)

2
bin/CMakeLists.txt Normal file
View file

@ -0,0 +1,2 @@
add_executable(ftsort ${PROJECT_SOURCE_DIR}/bin/ftsort.cpp)
target_link_libraries(ftsort PRIVATE tapelib)

4
src/CMakeLists.txt Normal file
View file

@ -0,0 +1,4 @@
file(GLOB SOURCES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/src/*.cpp)
add_library(tapelib ${SOURCES})
target_include_directories(tapelib PUBLIC ${PROJECT_SOURCE_DIR}/include/tapelib)

View file

@ -1,4 +1,4 @@
#include "tapeconfig.h" #include "tape_config.h"
#include "filetape.h" #include "filetape.h"
#include <string> #include <string>

View file

@ -1,3 +1,3 @@
#include "tapeutil.h" #include "tape_util.h"
void tape::sort(Tape &input, Tape &output) {} void tape::sort(Tape &input, Tape &output) {}

4
tests/CMakeLists.txt Normal file
View file

@ -0,0 +1,4 @@
add_executable(filetape_tests ${PROJECT_SOURCE_DIR}/tests/filetape_tests.cpp)
target_link_libraries(filetape_tests PRIVATE tapelib)
add_test(filetape_tests filetape_tests)

1
tests/filetape_tests.cpp Normal file
View file

@ -0,0 +1 @@
int main(int argc, char *argv[]) { return 0; }