COSC_4P14_Assignment_2/CMakeLists.txt

40 lines
1.4 KiB
CMake
Raw Permalink Normal View History

2023-11-01 22:20:03 -04:00
cmake_minimum_required(VERSION 3.21)
project(AssignmentProject)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
option(BUILD_PROFILING OFF)
option(BUILD_NBT OFF)
add_subdirectory(libraries/BLT)
include_directories(include/)
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
2023-11-06 15:16:36 -05:00
file(GLOB_RECURSE PROJECT_C_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c")
2023-11-01 22:20:03 -04:00
2023-11-06 15:16:36 -05:00
add_executable(AssignmentProject ${PROJECT_BUILD_FILES} ${PROJECT_C_BUILD_FILES})
2023-11-01 22:20:03 -04:00
target_link_libraries(AssignmentProject BLT)
target_link_libraries(AssignmentProject stdc++fs)
2023-11-08 20:53:04 -05:00
target_compile_options(AssignmentProject PRIVATE -Wall -Wextra -Wpedantic -Wno-comment)
target_link_options(AssignmentProject PRIVATE -Wall -Wextra -Wpedantic -Wno-comment)
2023-11-01 22:20:03 -04:00
if (${ENABLE_ADDRSAN} MATCHES ON)
target_compile_options(AssignmentProject PRIVATE -fsanitize=address)
target_link_options(AssignmentProject PRIVATE -fsanitize=address)
endif ()
if (${ENABLE_UBSAN} MATCHES ON)
target_compile_options(AssignmentProject PRIVATE -fsanitize=undefined)
target_link_options(AssignmentProject PRIVATE -fsanitize=undefined)
endif ()
if (${ENABLE_TSAN} MATCHES ON)
target_compile_options(AssignmentProject PRIVATE -fsanitize=thread)
target_link_options(AssignmentProject PRIVATE -fsanitize=thread)
endif ()