2017-07-01 16:46:22 +00:00
|
|
|
# Copyright (C) 2017 Ortega Froysa, Nicolás <deathsbreed@themusicinnoise.net>
|
|
|
|
# Author: Ortega Froysa, Nicolás <deathsbreed@themusicinnoise.net>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser 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
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this program. If not, see
|
|
|
|
# <http://www.gnu.org/licenses/>.
|
|
|
|
|
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")
|
|
|
|
set(TARGET_VERSION_MAJOR 0)
|
|
|
|
set(TARGET_VERSION_MINOR 1)
|
|
|
|
|
|
|
|
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_LIBS
|
|
|
|
"Whether to build a shared object instead of a static." OFF)
|
|
|
|
|
2017-07-31 19:19:15 +00:00
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
|
|
|
|
2017-07-01 16:46:22 +00:00
|
|
|
include_directories(
|
|
|
|
"include/")
|
|
|
|
|
|
|
|
set(SRCS
|
2017-07-31 19:19:15 +00:00
|
|
|
src/connectivity.c
|
2017-07-19 17:02:49 +00:00
|
|
|
src/error.c
|
2017-07-31 19:19:15 +00:00
|
|
|
src/neocomm.c)
|
2017-07-01 16:46:22 +00:00
|
|
|
|
|
|
|
set(CMAKE_C_FLAGS "-std=c99 -Wall -Wextra -Werror -Wfatal-errors -Wmissing-declarations -pedantic-errors")
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-g -O0")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
|
|
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O3")
|
|
|
|
set(CMAKE_C_FLAGS_MINSEZEREL "-Os")
|
|
|
|
|
|
|
|
if(NOT CMAKE_BUILD_TYPE MATCHES "debug" AND
|
|
|
|
NOT CMAKE_BUILD_TYPE MATCHES "relwithdebinfo")
|
|
|
|
add_definitions("-DNDEBUG")
|
|
|
|
else()
|
|
|
|
add_definitions("-DDEBUG")
|
|
|
|
endif()
|
|
|
|
|
2017-07-31 19:19:15 +00:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
add_library(${TARGET_NAME} SHARED ${SRCS})
|
|
|
|
else()
|
|
|
|
add_library(${TARGET_NAME} STATIC ${SRCS})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_link_libraries(${TARGET_NAME}
|
|
|
|
Threads::Threads)
|