neocomm/CMakeLists.txt
2017-07-31 14:19:15 -05:00

68 lines
2.0 KiB
CMake

# 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/>.
cmake_minimum_required(VERSION 3.1)
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)
find_package(Threads REQUIRED)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
include_directories(
"include/")
set(SRCS
src/connectivity.c
src/error.c
src/neocomm.c)
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()
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)