act-cluster-lib/CMakeLists.txt
2024-01-10 18:11:43 -05:00

89 lines
2.4 KiB
CMake

#
# This file is part of the ACT library
#
# Copyright (c) 2024 Fabian Posch
#
# This program 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 2
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
cmake_minimum_required(VERSION 3.15)
project(
act-cluster-library
VERSION 0.0.1
DESCRIPTION "Library to interact with the ACT cluster system."
)
# Set the program version
add_compile_definitions(PROG_VERSION="0.0.1")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
add_compile_options(-Wall
-Wextra
-Wconversion-null
-Wmissing-declarations
-Woverlength-strings)
add_compile_options(
-Wpointer-arith
-Wunused-local-typedefs
-Wunused-result
-Wvarargs
-Wvla
-Wwrite-strings
-Wformat-security
-Wundef)
add_compile_options(-O2 -fPIC)
include_directories(./)
# Include shared act libraries
# We need this mostly for file elaboration ahead of cluster deployment
add_library(act-lib SHARED IMPORTED)
set_target_properties(ActLib PROPERTIES IMPORTED_LOCATION $ENV{ACT_HOME}/lib/libact.a)
add_library(act-common-lib SHARED IMPORTED)
set_target_properties(ActCommon PROPERTIES IMPORTED_LOCATION $ENV{ACT_HOME}/lib/libvlsilib.a)
# ATTENTION
# The main library is defined in the CMakeLists.txt in the ./src folder.
# Set the output directory of dynamic libraries
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_INSTALL_PREFIX $ENV{ACT_HOME} CACHE PATH "installation path" FORCE)
add_subdirectory(src)
# Link the needed libraries into it
target_link_libraries(
${PROJECT_NAME}
act-lib
act-common-lib
)
# Add the Postgresql library
target_link_libraries(
${PROJECT_NAME}
-lpqxx -lpq
)
# specify install targets
install(
TARGETS ${PROJECT_NAME}
DESTINATION lib
)