forked from metin2/server
38 lines
907 B
CMake
38 lines
907 B
CMake
|
cmake_minimum_required(VERSION 3.8)
|
||
|
|
||
|
project(db CXX)
|
||
|
|
||
|
file(GLOB_RECURSE sources
|
||
|
src/*.cpp src/*.h
|
||
|
)
|
||
|
|
||
|
|
||
|
include_directories(${PROJECT_BINARY_DIR}/src/)
|
||
|
|
||
|
include_directories(src/)
|
||
|
|
||
|
# Find dependencies
|
||
|
find_package(libmysql REQUIRED)
|
||
|
find_package(Boost REQUIRED)
|
||
|
|
||
|
add_executable(${PROJECT_NAME} ${sources})
|
||
|
|
||
|
# Link dependencies if found
|
||
|
if (libmysql_FOUND)
|
||
|
target_link_libraries (${PROJECT_NAME} ${MYSQL_LIBRARIES})
|
||
|
endif (libmysql_FOUND)
|
||
|
|
||
|
if (Boost_FOUND)
|
||
|
include_directories(${Boost_INCLUDE_DIRS})
|
||
|
target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES} ${Boost_SYSTEM_LIBRARY})
|
||
|
endif (Boost_FOUND)
|
||
|
|
||
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||
|
# Pthreads
|
||
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||
|
find_package (Threads REQUIRED)
|
||
|
target_link_libraries (${PROJECT_NAME} Threads::Threads)
|
||
|
endif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||
|
|
||
|
target_link_libraries(${PROJECT_NAME} libpoly libsql libthecore)
|