UsenetSearch/CMakeLists.txt

113 lines
2.9 KiB
CMake

# Copyright© 2021 John Sennesael
#
# UsenetSearch is Free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# UsenetSearch 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with UsenetSearch. If not, see <https://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.5)
#set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb -fno-omit-frame-pointer -fsanitize=address")
#set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb -fno-omit-frame-pointer -pthread")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -pthread")
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "DEBUG" CACHE STRING "Type of build: Debug|Release")
endif()
project(usenetsearchd CXX)
set(CMAKE_CXX_STANDARD 17)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(OpenSSL REQUIRED)
# Usenetsearch common library --------------------------------------------------
add_library(usenetsearch
"src/Application.cpp"
"src/Configuration.cpp"
"src/Database.cpp"
"src/Dns.cpp"
"src/Except.cpp"
"src/Filter.cpp"
"src/Indexer.cpp"
"src/IoSocket.cpp"
"src/Logger.cpp"
"src/Serialize.cpp"
"src/SSLConnection.cpp"
"src/StringUtils.cpp"
"src/TcpConnection.cpp"
"src/ThreadPool.cpp"
"src/UsenetClient.cpp"
)
target_include_directories(usenetsearch
PRIVATE
include
PUBLIC
${OPENSSL_INCLUDE_DIR}
)
target_link_libraries(usenetsearch
PUBLIC ${OPENSSL_LIBRARIES} stdc++fs
)
# Indexer executable -----------------------------------------------------------
add_executable(usenetindexd
"src/usenetindexd.cpp"
)
target_link_libraries(usenetindexd
PUBLIC ${OPENSSL_LIBRARIES} stdc++fs
PRIVATE usenetsearch
)
target_include_directories(usenetindexd
PRIVATE
include
)
# usenetfind executable --------------------------------------------------------
add_executable(usenetfind
"src/usenetfind.cpp"
)
target_link_libraries(usenetfind
PUBLIC ${OPENSSL_LIBRARIES} stdc++fs
PRIVATE usenetsearch
)
target_include_directories(usenetfind
PRIVATE
include
)
# dbdump executable ------------------------------------------------------------
add_executable(dbdump
"src/dbdump.cpp"
)
target_link_libraries(dbdump
PUBLIC ${OPENSSL_LIBRARIES} stdc++fs
PRIVATE usenetsearch
)
target_include_directories(dbdump
PRIVATE
include
)