neocomm/CMakeLists.txt

76 lines
2.1 KiB
CMake
Raw Normal View History

2017-08-12 18:59:18 +00:00
# Copyright (C) 2017 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
# Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
2017-07-01 16:46:22 +00:00
#
2017-08-12 18:59:18 +00:00
# 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.
2017-07-01 16:46:22 +00:00
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
2017-08-12 18:59:18 +00:00
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
2017-07-01 16:46:22 +00:00
#
2017-08-12 18:59:18 +00:00
# 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/>.
2017-07-01 16:46:22 +00:00
2017-07-31 19:19:15 +00:00
cmake_minimum_required(VERSION 3.1)
2017-07-01 16:46:22 +00:00
project(NeoComm)
set(TARGET_NAME "neocomm")
2017-10-03 14:57:02 +00:00
set(TARGET_VERSION_MAJOR 1)
set(TARGET_VERSION_MINOR 0)
2017-07-01 16:46:22 +00:00
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}")
2017-08-12 18:59:18 +00:00
option(BUILD_SHARED_LIB
2017-07-01 16:46:22 +00:00
"Whether to build a shared object instead of a static." OFF)
2017-08-18 22:06:17 +00:00
find_package(GnuTLS REQUIRED)
2017-08-12 18:59:18 +00:00
find_package(PkgConfig REQUIRED)
2017-10-30 15:45:06 +00:00
pkg_check_modules(OPENDHT REQUIRED opendht>=1.4.0)
2017-07-31 19:19:15 +00:00
2017-07-01 16:46:22 +00:00
include_directories(
2017-08-12 18:59:18 +00:00
"include/"
SYSTEM OPENDHT_INCLUDE_DIRS)
2017-07-01 16:46:22 +00:00
2017-09-18 08:30:18 +00:00
set(SRCS
2017-09-20 19:02:25 +00:00
src/channel.cpp
2017-09-20 06:34:52 +00:00
src/error.cpp
2017-11-17 16:20:35 +00:00
src/message.cpp
2017-09-18 08:30:18 +00:00
src/node.cpp)
2017-07-01 16:46:22 +00:00
2017-10-30 15:45:06 +00:00
set(CMAKE_CXX_FLAGS
"-std=c++11 -Wall -Wextra -Wpedantic -Werror -Wfatal-errors -pedantic-errors -fno-elide-constructors")
2017-08-12 18:59:18 +00:00
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")
2017-07-01 16:46:22 +00:00
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()
2017-08-12 18:59:18 +00:00
if(BUILD_SHARED_LIB)
2017-07-31 19:19:15 +00:00
add_library(${TARGET_NAME} SHARED ${SRCS})
else()
add_library(${TARGET_NAME} STATIC ${SRCS})
endif()
2017-08-12 18:59:18 +00:00
if(BUILD_SHARED_LIB)
target_link_libraries(${TARGET_NAME}
2017-08-18 22:06:17 +00:00
${GNUTLS_LIBRARIES}
2017-08-12 18:59:18 +00:00
${OPENDHT_LIBRARIES})
endif()