-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
43 lines (34 loc) · 1.49 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
cmake_minimum_required(VERSION 3.25)
project(localserver VERSION 1.0 DESCRIPTION "simple local webserver for quick serving document page")
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
add_library(htftp SHARED htftp.c)
set(CMAKE_BUILD_TYPE Debug)
add_executable(${PROJECT_NAME} main.c)
option(ARGHELPER "Use libarghelper lib from 'https://github.com/Jukoo/libarghlp.git'" ON)
set(ARGHELPER_SOURCE "git@github.com:Jukoo/libarghlp.git")
if(ARGHELPER)
message(CHECK_START "checking ...")
find_package(Git REQUIRED)
if(NOT GIT_FOUND )
message(FATAL "Abort Git not found")
endif()
message(CHECK_PASS " git command found!")
## fetch arghelper remote sources
execute_process(COMMAND ${GIT_EXECUTABLE} submodule add ${ARGHELPER_SOURCE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE ARGHLP_SUBMODULE_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT ARGHLP_SUBMODULE_RESULT EQUAL "0")
message(FATAL " Error libarghlp as submodule")
endif()
add_definitions(-DARGHLPER)
add_subdirectory(libarghlp)
target_include_directories(${PROJECT_NAME} PUBLIC libarghlp)
target_link_libraries(${PROJECT_NAME} PUBLIC arghlp)
endif()
target_link_libraries(${PROJECT_NAME} PUBLIC htftp)
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})