Merge pull request 'build(cmake): setup cmake build system for library and tests' (#9) from QN-1 into main
This commit is contained in:
commit
c4769a637f
1 changed files with 25 additions and 0 deletions
25
CMakeLists.txt
Normal file
25
CMakeLists.txt
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
project(qnet C)
|
||||||
|
|
||||||
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE SRC_FILES "${PROJECT_SOURCE_DIR}/src/*.c")
|
||||||
|
add_library(qnet STATIC ${SRC_FILES})
|
||||||
|
target_include_directories(qnet PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
target_link_libraries(qnet PRIVATE ws2_32)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_options(qnet PRIVATE /W4)
|
||||||
|
else()
|
||||||
|
target_compile_options(qnet PRIVATE -Wall -Wextra -pedantic)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(GLOB_RECURSE SRC_TEST_FILES "${PROJECT_SOURCE_DIR}/tests/*.c")
|
||||||
|
add_executable(qnet-test ${SRC_TEST_FILES})
|
||||||
|
|
||||||
|
target_include_directories(qnet-test PRIVATE ${PROJECT_SOURCE_DIR}/tests)
|
||||||
|
target_link_libraries(qnet-test qnet)
|
||||||
Loading…
Add table
Reference in a new issue