view CMakeLists.txt @ 919:52334419194e release-3.1

misc: added tag 3.1.0 for changeset 49b25adcd313
author David Demelier <markand@malikania.fr>
date Fri, 03 Jul 2020 11:37:07 +0200
parents 5e25439fe98d
children
line wrap: on
line source

#
# CMakeLists.txt -- CMake build system for irccd
#
# Copyright (c) 2013-2020 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

#
# Where to start.
# -------------------------------------------------------------------
#
# If you plan to modify the build system there are several places to look to do
# what you want.
#
# cmake/IrccdOptions.cmake  - User definable options.
# cmake/IrccdPackage.cmake  - Package creation.
# cmake/IrccdSystem.cmake   - Contains some platforms checks and compile flags.
# cmake/IrccdVersion.cmake  - Defines the Irccd version and its plugins.
# cmake/check               - Platform checks in separate files.
# cmake/export              - CMake and pkg-config exports.
# cmake/function            - Custom CMake functions.
# cmake/internal            - Some internal files (e.g. the sysconfig.h)
# cmake/packages            - Additional find_package modules.
#
# Build system is then processed in different directories:
#
# doc                       - The documentation process.
# extern                    - External libraries.
# libirccd                  - Common code.
# libirccd-ctl              - The irccdctl library.
# libirccd-js               - Javascript bindings library.
# libirccd-test             - Helpers for unit tests.
# libirccd-daemon           - The irccd bot library.
# irccd                     - The irccd executable.
# irccdctl                  - The irccdctl utility.
# man                       - Manual pages.
# plugins                   - Official irccd plugins.
# systemd                   - Unit file for systemd.
# tests                     - The unit tests.
#

cmake_minimum_required(VERSION 3.10)
project(irccd)

include(GNUInstallDirs)
include(InstallRequiredSystemLibraries)

set_property(GLOBAL PROPERTY USE_FOLDERS On)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED On)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${irccd_SOURCE_DIR}/cmake/packages)
set(CMAKE_POSITION_INDEPENDENT_CODE On)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS On)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

foreach (cfg ${CMAKE_CONFIGURATION_TYPES})
	string(TOUPPER CFG ${cfg})
	set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG} ${CMAKE_BINARY_DIR}/bin/${cfg})
endforeach ()

include(cmake/check/PutTime.cmake)

include(cmake/function/IrccdSetGlobal.cmake)
include(cmake/function/IrccdDefineExecutable.cmake)
include(cmake/function/IrccdDefineLibrary.cmake)
include(cmake/function/IrccdDefineMan.cmake)
include(cmake/function/IrccdDefinePlugin.cmake)
include(cmake/function/IrccdDefineTest.cmake)
include(cmake/function/IrccdIndentMessage.cmake)

include(cmake/IrccdVersion.cmake)
include(cmake/IrccdOptions.cmake)
include(cmake/IrccdSystem.cmake)

find_package(Threads REQUIRED)

add_subdirectory(cmake)
add_subdirectory(extern/json)
add_subdirectory(doc)
add_subdirectory(libirccd)
add_subdirectory(libirccd-daemon)
add_subdirectory(libirccd-ctl)
add_subdirectory(libirccd-test)

if (IRCCD_HAVE_JS)
	add_subdirectory(libirccd-js)
endif ()

add_subdirectory(irccd)
add_subdirectory(irccdctl)
add_subdirectory(irccd-test)
add_subdirectory(systemd)
add_subdirectory(plugins)
add_subdirectory(man)

if (IRCCD_WITH_TESTS)
	include(CTest)
	add_subdirectory(tests)
endif ()

add_subdirectory(cmake/export)

message("Building with the following flags:")
message("       General flags:  ${CMAKE_CXX_FLAGS}")
message("       Debug flags:    ${CMAKE_CXX_FLAGS_DEBUG}")
message("       Release flags:  ${CMAKE_CXX_FLAGS_RELEASE}")
message("")

message("Building irccd with following options:")
message("       Libedit:        ${IRCCD_WITH_LIBEDIT_MSG}")
message("       OpenSSL:        ${IRCCD_WITH_SSL_MSG}")
message("       Javascript:     ${IRCCD_WITH_JS_MSG}")
message("       Tests:          ${IRCCD_WITH_TESTS_MSG}")
message("       Man pages:      ${IRCCD_WITH_MAN_MSG}")
message("       Doxygen:        ${IRCCD_WITH_DOXYGEN_MSG}")
message("       Systemd:        ${IRCCD_WITH_SYSTEMD_MSG}")
message("")

message("Installing plugins:")
foreach (plugin ${IRCCD_PLUGINS})
	string(TOUPPER ${plugin} name)
	irccd_indent_message("       ${plugin}: " "${IRCCD_WITH_PLUGIN_${name}_MSG}" 22)
endforeach ()
message("")

include(cmake/IrccdPackage.cmake)
include(CPack)