From 304af488ce14c0d750effebb28405bb7b8b34c47 Mon Sep 17 00:00:00 2001 From: robtor Date: Wed, 1 Nov 2023 10:29:35 +0100 Subject: [PATCH] tweaks --- .gitignore | 1 + CMakeLists.txt | 12 ++++++++++++ task1/main.cpp | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a6790b5..5170b8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ cmake-build-debug +cmake-build-release .idea task1/dataset.dat \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 48bcf5d..ca1e4ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,5 +7,17 @@ set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) +if (${CMAKE_BUILD_TYPE} STREQUAL "Release") + set(CMAKE_) + add_compile_options( + -Wall + -Wpedantic + -O3 + -g3 + ) + add_compile_definitions( + NDEBUG) +endif () + add_subdirectory(task1) \ No newline at end of file diff --git a/task1/main.cpp b/task1/main.cpp index 462b2e4..fbe52bc 100644 --- a/task1/main.cpp +++ b/task1/main.cpp @@ -36,7 +36,7 @@ auto parse_file(std::ifstream &stream, std::vector &vec) -> void { } -int main(int argc, char *argv[]) { +auto main(int argc, char *argv[]) -> int { try { std::ifstream file("dataset.dat", std::ios_base::in); if (!file.is_open()) { @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) { return 0; } catch (std::exception e) { - fmt::print("Could not open file"); + fmt::print("Error occured: {}", e.what()); return -1; }