aboutsummaryrefslogtreecommitdiff
path: root/comp6771/2/CMakeLists.txt
diff options
context:
space:
mode:
authorNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-13 18:00:17 +1100
committerNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-13 18:00:17 +1100
commit98cef5e9a772602d42acfcf233838c760424db9a (patch)
tree5277fa1d7cc0a69a0f166fcbf10fd320f345f049 /comp6771/2/CMakeLists.txt
initial commit
Diffstat (limited to 'comp6771/2/CMakeLists.txt')
-rw-r--r--comp6771/2/CMakeLists.txt71
1 files changed, 71 insertions, 0 deletions
diff --git a/comp6771/2/CMakeLists.txt b/comp6771/2/CMakeLists.txt
new file mode 100644
index 0000000..aab06d3
--- /dev/null
+++ b/comp6771/2/CMakeLists.txt
@@ -0,0 +1,71 @@
+# ------------------------------------------------------------ #
+# -------------- DO NOT TOUCH BELOW THIS LINE ---------------- #
+# ------------------------------------------------------------ #
+
+# Make sure checks are configured
+execute_process(COMMAND bash util/setup.sh)
+
+# this must be the first line of a CMake script.
+# sets the lowerbound on what CMake version can be used.
+cmake_minimum_required(VERSION 3.0...3.5)
+
+# the name of this CMake project and what language it uses
+# we could list more languages if we were using more.
+project(COMP6771_LAB_001 LANGUAGES CXX)
+
+# we use C++20
+set(CMAKE_CXX_STANDARD 20)
+set(CMAKE_CXX_STANDARD_REQUIRED YES)
+set(CMAKE_CXX_EXTENSIONS NO)
+
+# this is helpful for editors like VS Code
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+# helpful compiler flags for gcc/clang
+# the descriptions for these flags can be found on the GNU Compiler Collection's webpage.
+add_compile_options(
+ -Wall
+ -Wextra
+ -Werror
+ -pedantic-errors
+ -Wconversion
+ -Wsign-conversion
+ -Wdouble-promotion
+ -Wcast-align
+ -Wformat=2
+ -Wuninitialized
+ -Wnull-dereference
+ -Wnon-virtual-dtor
+ -Woverloaded-virtual
+ -Wdeprecated-copy-dtor
+ -Wold-style-cast
+ -Wzero-as-null-pointer-constant
+ -Wsuggest-override
+ -fstack-protector-strong
+)
+
+# debug builds should be compiled with sanitizers
+# sanitizers are small libraries that check things like buffer overrun with minimal runtime overhead.
+set(CMAKE_CXX_FLAGS_DEBUG_INIT "-fsanitize=address,undefined")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-fsanitize=address,undefined")
+set(CMAKE_CXX_EXE_LINKER_FLAGS_DEBUG_INIT "-fsanitize=address,undefined")
+set(CMAKE_CXX_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-fsanitize=address,undefined")
+
+
+# add the testing library Catch2
+enable_testing()
+add_library(catch2_main lib/catch2_main.cpp)
+target_include_directories(catch2_main PUBLIC lib)
+# link the library so that other programs can get it
+link_libraries(catch2_main)
+
+# ------------------------------------------------------------ #
+# -------------- DO NOT MODIFY ABOVE THIS LINE --------------- #
+# ------------------------------------------------------------ #
+
+add_library(filtered_string_view src/filtered_string_view.h src/filtered_string_view.cpp)
+link_libraries(filtered_string_view)
+
+add_executable(filtered_string_view_test src/filtered_string_view.test.cpp)
+add_test(filtered_string_view_test filtered_string_view_test)
+