42 lines
831 B
CMake
42 lines
831 B
CMake
cmake_minimum_required(VERSION 3.30)
|
|
project(leetcode C CXX)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
include_directories(include)
|
|
|
|
include(FetchContent)
|
|
|
|
add_compile_options(
|
|
-Wall
|
|
-Wextra
|
|
-O0
|
|
-g3
|
|
-fno-omit-frame-pointer
|
|
)
|
|
|
|
if (UNIX)
|
|
add_compile_options(
|
|
-fsanitize=address
|
|
-fsanitize=undefined
|
|
)
|
|
add_link_options(
|
|
-fsanitize=address
|
|
-fsanitize=undefined
|
|
)
|
|
endif ()
|
|
|
|
FetchContent_Declare(
|
|
googletest
|
|
URL https://github.com/google/googletest/releases/download/v1.15.2/googletest-1.15.2.tar.gz
|
|
URL_HASH MD5=7e11f6cfcf6498324ac82d567dcb891e
|
|
)
|
|
|
|
FetchContent_MakeAvailable(googletest)
|
|
|
|
add_library(solution_2711 STATIC src/2711.c)
|
|
|
|
add_subdirectory(tests)
|