添加googletest
This commit is contained in:
parent
b1893c001e
commit
5ffc8c8eb0
@ -1,30 +1,41 @@
|
||||
cmake_minimum_required(VERSION 3.30)
|
||||
project(leetcode C)
|
||||
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
|
||||
-Wall
|
||||
-Wextra
|
||||
-O0
|
||||
-g3
|
||||
-fsanitize=address
|
||||
-fsanitize=undefined
|
||||
-fno-omit-frame-pointer
|
||||
)
|
||||
|
||||
add_link_options(
|
||||
-fsanitize=address
|
||||
-fsanitize=undefined
|
||||
-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})
|
||||
foreach (SRC_FILE ${SRC_FILES})
|
||||
get_filename_component(EXE_NAME ${SRC_FILE} NAME_WE)
|
||||
add_executable(${EXE_NAME} ${SRC_FILE})
|
||||
endforeach()
|
||||
endforeach ()
|
||||
|
||||
add_subdirectory(tests)
|
||||
|
Loading…
x
Reference in New Issue
Block a user