75 lines
2.1 KiB
CMake
75 lines
2.1 KiB
CMake
# Copyright (C) 2017 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
|
# Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
# License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
cmake_minimum_required(VERSION 3.1)
|
|
project(NeoComm)
|
|
|
|
set(TARGET_NAME "neocomm")
|
|
set(TARGET_VERSION_MAJOR 1)
|
|
set(TARGET_VERSION_MINOR 0)
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
set(CMAKE_BUILD_TYPE "release")
|
|
endif()
|
|
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
|
|
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
|
|
|
|
option(BUILD_SHARED_LIB
|
|
"Whether to build a shared object instead of a static." OFF)
|
|
|
|
find_package(GnuTLS REQUIRED)
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(OPENDHT REQUIRED opendht>=1.4.0)
|
|
|
|
include_directories(
|
|
"include/"
|
|
SYSTEM OPENDHT_INCLUDE_DIRS)
|
|
|
|
set(SRCS
|
|
src/channel.cpp
|
|
src/error.cpp
|
|
src/node.cpp)
|
|
|
|
set(CMAKE_CXX_FLAGS
|
|
"-std=c++11 -Wall -Wextra -Wpedantic -Werror -Wfatal-errors -pedantic-errors -fno-elide-constructors")
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3")
|
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
|
|
|
|
if(NOT CMAKE_BUILD_TYPE MATCHES "debug" AND
|
|
NOT CMAKE_BUILD_TYPE MATCHES "relwithdebinfo")
|
|
add_definitions("-DNDEBUG")
|
|
else()
|
|
add_definitions("-DDEBUG")
|
|
endif()
|
|
|
|
if(WIN32)
|
|
add_definitions("-DWOE32")
|
|
endif()
|
|
|
|
if(BUILD_SHARED_LIB)
|
|
add_library(${TARGET_NAME} SHARED ${SRCS})
|
|
else()
|
|
add_library(${TARGET_NAME} STATIC ${SRCS})
|
|
endif()
|
|
|
|
if(BUILD_SHARED_LIB)
|
|
target_link_libraries(${TARGET_NAME}
|
|
${GNUTLS_LIBRARIES}
|
|
${OPENDHT_LIBRARIES})
|
|
endif()
|