This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
64 lines (54 loc) · 3.23 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
cmake_minimum_required(VERSION 3.10)
project(p2p C)
set(CMAKE_C_STANDARD 99)
set(GCC_COVERAGE_COMPILE_FLAGS "-Werror")
set(SOURCE_FILES modules/peer.h modules/peer.c utility.c utility.h modules/webio.h modules/webio.c modules/config.h modules/config.c lib/map.h lib/map.c lib/tcp-listener.c lib/tcp-listener.h)
option(BUILD_DOC "Build Documentation" ON)
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(BUILD_DOC_DIR ${CMAKE_SOURCE_DIR}/build/docs)
if(NOT EXISTS ${BUILD_DOC_DIR})
file(MAKE_DIRECTORY ${BUILD_DOC_DIR})
endif()
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen build started")
add_custom_target(Doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else(DOXYGEN_FOUND)
message("Doxygen needs to be installed to generate the documentation.")
endif(DOXYGEN_FOUND)
add_executable(p2p main.c modules/peer.h modules/peer.c utility.c utility.h modules/webio.h modules/webio.c modules/config.h modules/config.c lib/map.h lib/map.c lib/tcp-listener.c lib/tcp-listener.h lib/net.h modules/server.c modules/server.h)
add_executable(p2p-2 main.c modules/peer.h modules/peer.c utility.c utility.h modules/webio.h modules/webio.c modules/config.h modules/config.c lib/map.h lib/map.c lib/tcp-listener.c lib/tcp-listener.h lib/net.h modules/server.c modules/server.h)
add_executable(p2p-3 main.c modules/peer.h modules/peer.c utility.c utility.h modules/webio.h modules/webio.c modules/config.h modules/config.c lib/map.h lib/map.c lib/tcp-listener.c lib/tcp-listener.h lib/net.h modules/server.c modules/server.h)
set_target_properties( p2p-2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/p2p-2 )
set_target_properties( p2p-3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/p2p-3 )
# Függvények kipróbálására hoztam létre
add_executable(test2 test.c utility.h utility.c lib/map.h lib/map.c lib/tcp-listener.c lib/tcp-listener.h)
add_custom_command(TARGET p2p PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/htdocs/ $<TARGET_FILE_DIR:p2p>/htdocs/)
add_custom_command(TARGET p2p-2 PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/htdocs/ $<TARGET_FILE_DIR:p2p-2>/htdocs/)
add_custom_command(TARGET p2p-3 PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/htdocs/ $<TARGET_FILE_DIR:p2p-3>/htdocs/)
target_compile_definitions(p2p-2 PUBLIC RANDOM_PORT)
target_compile_definitions(p2p-3 PUBLIC RANDOM_PORT)
#find_package(OpenSSL REQUIRED)
#include_directories(${OPENSSL_INCLUDE_DIR})
#target_link_libraries(test ${OPENSSL_LIBRARIES})
#target_link_libraries(p2p ${OPENSSL_LIBRARIES})
#target_link_libraries(p2p-2 ${OPENSSL_LIBRARIES})
#target_link_libraries(p2p-3 ${OPENSSL_LIBRARIES})
if(WIN32)
target_link_libraries(p2p wsock32 ws2_32)
target_link_libraries(p2p-2 wsock32 ws2_32)
target_link_libraries(p2p-3 wsock32 ws2_32)
target_link_libraries(test2 wsock32 ws2_32)
endif()