UDPConnection/CMakeLists.txt

38 lines
1.3 KiB
Text
Raw Normal View History

2019-01-26 03:52:10 +00:00
cmake_minimum_required(VERSION 3.7)
project(UDPConnection)
set(UDPConnection_SOURCES
src/UDPConnection.c
2019-01-27 06:09:38 +00:00
src/UDPC_Deque.c
2019-02-04 08:21:49 +00:00
src/UDPC_HashMap.c
2019-01-26 03:52:10 +00:00
)
set(CMAKE_C_FLAGS "-Wall -Wno-missing-braces")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
set(CMAKE_C_FLAGS_RELEASE "-O3 -D NDEBUG")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug', none was specified.")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
endif()
2019-01-26 03:52:10 +00:00
add_library(UDPConnection ${UDPConnection_SOURCES})
2019-01-26 03:52:10 +00:00
target_compile_features(UDPConnection PUBLIC c_std_11)
2019-01-27 06:09:38 +00:00
target_link_libraries(UDPConnection PUBLIC pthread)
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(UDPC_UnitTest_SOURCES
src/test/UDPC_UnitTest.c)
add_executable(UnitTest ${UDPC_UnitTest_SOURCES})
target_link_libraries(UnitTest PUBLIC UDPConnection)
target_include_directories(UnitTest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(UDPC_NetworkTest_SOURCES
src/test/UDPC_NetworkTest.c)
add_executable(NetworkTest ${UDPC_NetworkTest_SOURCES})
target_link_libraries(NetworkTest PUBLIC UDPConnection)
target_include_directories(NetworkTest PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
2019-01-27 06:09:38 +00:00
endif()