42 lines
864 B
CMake
42 lines
864 B
CMake
cmake_minimum_required(VERSION 3.30)
|
|
project(leetcode C CXX)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
include_directories(include)
|
|
|
|
include(FetchContent)
|
|
|
|
add_compile_options(
|
|
-Wall
|
|
-Wextra
|
|
-O0
|
|
-g3
|
|
-fsanitize=address
|
|
-fsanitize=undefined
|
|
-fno-omit-frame-pointer
|
|
)
|
|
|
|
add_link_options(
|
|
-fsanitize=address
|
|
-fsanitize=undefined
|
|
)
|
|
|
|
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)
|
|
|
|
file(GLOB SRC_FILES "src/*.c")
|
|
|
|
foreach (SRC_FILE ${SRC_FILES})
|
|
get_filename_component(EXE_NAME ${SRC_FILE} NAME_WE)
|
|
add_executable(${EXE_NAME} ${SRC_FILE})
|
|
endforeach ()
|
|
|
|
add_subdirectory(tests)
|