CMake integration
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
add_executable(zbbs-server)
|
||||
|
||||
set_property(TARGET zbbs-server PROPERTY C_STANDARD 23)
|
||||
|
||||
find_package(PostgreSQL REQUIRED)
|
||||
if(NOT PostgreSQL_FOUND)
|
||||
message(FATAL_ERROR "PostgreSQL not found. Please install libpq-dev or set PostgreSQL_ROOT.")
|
||||
endif()
|
||||
|
||||
find_package(OpenSSL REQUIRED)
|
||||
if(NOT OpenSSL_FOUND)
|
||||
message(FATAL_ERROR "OpenSSL not found. Please install libcrypto or set OpenSSL_ROOT.")
|
||||
endif()
|
||||
|
||||
file(GLOB M_HEADERS "*.h")
|
||||
file(GLOB M_SOURCES "*.c")
|
||||
|
||||
target_sources(zbbs-server
|
||||
PRIVATE
|
||||
${M_SOURCES}
|
||||
PUBLIC
|
||||
FILE_SET HEADERS
|
||||
FILES
|
||||
${M_HEADERS}
|
||||
"types.h"
|
||||
)
|
||||
|
||||
add_subdirectory(libs)
|
||||
|
||||
target_link_libraries(zbbs-server
|
||||
PRIVATE
|
||||
murmur3
|
||||
PostgreSQL::PostgreSQL
|
||||
OpenSSL::Crypto
|
||||
)
|
||||
|
||||
if (ZBBS_DEBUG)
|
||||
if(
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR
|
||||
(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
||||
)
|
||||
|
||||
target_compile_options(zbbs-server PRIVATE /W3)
|
||||
message("Include debug info (Microsoft)")
|
||||
|
||||
elseif(
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
|
||||
(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
)
|
||||
|
||||
target_compile_options(zbbs-server PRIVATE -Wall -ggdb -pedantic)
|
||||
message("Include debug info (GNU/Clang)")
|
||||
|
||||
endif()
|
||||
endif()
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
client.o: src/client.c src/client.h src/main.h src/types.h src/file_p.h \
|
||||
src/session.h
|
||||
db.o: src/db.c src/db.h src/main.h src/types.h
|
||||
file_p.o: src/file_p.c src/file_p.h src/main.h src/types.h src/db.h \
|
||||
src/libs/murmur3/murmur3.h src/session.h
|
||||
main.o: src/main.c src/main.h src/types.h src/server.h src/db.h
|
||||
server.o: src/server.c src/main.h src/types.h src/session.h src/user.h
|
||||
session.o: src/session.c src/session.h src/main.h src/types.h \
|
||||
src/client.h src/db.h src/file_p.h src/user.h
|
||||
user.o: src/user.c src/db.h src/main.h src/types.h src/session.h
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#include "file_p.h"
|
||||
#include "db.h"
|
||||
#include "libs/murmur3/murmur3.h"
|
||||
#include <murmur3.h>
|
||||
#include "main.h"
|
||||
#include "session.h"
|
||||
#include <arpa/inet.h>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
add_subdirectory(murmur3)
|
||||
@@ -0,0 +1,13 @@
|
||||
add_library(murmur3 STATIC)
|
||||
|
||||
file(GLOB M_HEADERS "*.h")
|
||||
file(GLOB M_SOURCES "*.c")
|
||||
|
||||
target_sources(murmur3
|
||||
PRIVATE
|
||||
${M_SOURCES}
|
||||
PUBLIC
|
||||
FILE_SET HEADERS
|
||||
FILES
|
||||
${M_HEADERS}
|
||||
)
|
||||
Reference in New Issue
Block a user