optimize CMakeLists.txt
This commit is contained in:
@@ -4,6 +4,7 @@ project(leetcode C CXX)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(GTEST_VERSION 1.17.0)
|
||||
|
||||
include_directories(include)
|
||||
|
||||
@@ -30,44 +31,11 @@ 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
|
||||
URL https://github.com/google/googletest/releases/download/v${GTEST_VERSION}/googletest-${GTEST_VERSION}.tar.gz
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
|
||||
add_executable(13 src/13.c)
|
||||
add_executable(88 src/88.c)
|
||||
add_executable(100 src/100.c)
|
||||
add_executable(101 src/101.c)
|
||||
add_executable(104 src/104.c)
|
||||
add_executable(108 src/108.c)
|
||||
add_executable(110 src/110.c)
|
||||
add_executable(111 src/111.c)
|
||||
add_executable(112 src/119.c)
|
||||
add_executable(136 src/136.c)
|
||||
add_executable(141 src/141.c)
|
||||
add_executable(144 src/144.c)
|
||||
add_executable(145 src/145.c)
|
||||
add_executable(160 src/160.c)
|
||||
add_executable(168 src/168.c)
|
||||
add_executable(169 src/169.c)
|
||||
add_executable(171 src/171.c)
|
||||
add_executable(190 src/190.c)
|
||||
add_executable(191 src/191.c)
|
||||
add_executable(202 src/202.c)
|
||||
add_executable(219 src/219.c)
|
||||
add_executable(225 src/225.c)
|
||||
add_executable(228 src/228.c)
|
||||
add_executable(231 src/231.c)
|
||||
add_executable(263 src/263.c)
|
||||
add_executable(268 src/268.c)
|
||||
add_executable(278 src/278.c)
|
||||
add_executable(338 src/338.c)
|
||||
add_executable(374 src/374.c)
|
||||
add_executable(2786 src/2786.c)
|
||||
add_executable(3110 src/3110.c)
|
||||
|
||||
file(GLOB SRC_FILES "src/*.c")
|
||||
|
||||
set(EXECUTABLE_SOURCES
|
||||
@@ -104,6 +72,11 @@ set(EXECUTABLE_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/3110.c"
|
||||
)
|
||||
|
||||
foreach(src_file IN LISTS EXECUTABLE_SOURCES)
|
||||
get_filename_component(exe_name "${src_file}" NAME_WE)
|
||||
add_executable(${exe_name} ${src_file})
|
||||
endforeach()
|
||||
|
||||
set(LIBRARY_SOURCES)
|
||||
|
||||
foreach (SRC_FILE ${SRC_FILES})
|
||||
|
||||
Reference in New Issue
Block a user