"Fossies" - the Fresh Open Source Software Archive

Member "gvm-libs-11.0.1/base/CMakeLists.txt" (12 May 2020, 4058 Bytes) of package /linux/misc/openvas/gvm-libs-11.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "CMakeLists.txt": 11.0.0_vs_11.0.1.

    1 # Copyright (C) 2009-2019 Greenbone Networks GmbH
    2 #
    3 # SPDX-License-Identifier: GPL-2.0-or-later
    4 #
    5 # This program is free software; you can redistribute it and/or
    6 # modify it under the terms of the GNU General Public License
    7 # as published by the Free Software Foundation; either version 2
    8 # of the License, or (at your option) any later version.
    9 #
   10 # This program is distributed in the hope that it will be useful,
   11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13 # GNU General Public License for more details.
   14 #
   15 # You should have received a copy of the GNU General Public License
   16 # along with this program; if not, write to the Free Software
   17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   18 
   19 include (FindPkgConfig)
   20 
   21 if (NOT PKG_CONFIG_FOUND)
   22   message(FATAL_ERROR "pkg-config executable not found. Aborting.")
   23 endif (NOT PKG_CONFIG_FOUND)
   24 
   25 
   26 ## Dependency checks
   27 
   28 pkg_check_modules (GLIB REQUIRED glib-2.0>=2.42)
   29 
   30 include_directories (${GLIB_INCLUDE_DIRS})
   31 
   32 set (FILES array.c credentials.c cvss.c drop_privileges.c hosts.c logging.c
   33            networking.c nvti.c pidfile.c prefs.c proctitle.c pwpolicy.c
   34            settings.c strings.c version.c)
   35 
   36 set (HEADERS array.h credentials.h cvss.h drop_privileges.h hosts.h logging.h
   37              networking.h nvti.h pidfile.h prefs.h proctitle.h pwpolicy.h
   38              settings.h strings.h version.h)
   39 
   40 if (BUILD_STATIC)
   41   set (LIBGVM_BASE_NAME gvm_base_static)
   42   add_library (gvm_base_static STATIC ${FILES})
   43   set_target_properties (gvm_base_static PROPERTIES OUTPUT_NAME "gvm_base")
   44   set_target_properties (gvm_base_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
   45   set_target_properties (gvm_base_static PROPERTIES PUBLIC_HEADER "${HEADERS}")
   46 endif (BUILD_STATIC)
   47 
   48 if (BUILD_SHARED)
   49   set (LIBGVM_BASE_NAME gvm_base_shared)
   50   add_library (gvm_base_shared SHARED ${FILES})
   51   set_target_properties (gvm_base_shared PROPERTIES OUTPUT_NAME "gvm_base")
   52   set_target_properties (gvm_base_shared PROPERTIES CLEAN_DIRECT_OUTPUT 1)
   53   set_target_properties (gvm_base_shared PROPERTIES SOVERSION "${PROJECT_VERSION_MAJOR}")
   54   set_target_properties (gvm_base_shared PROPERTIES VERSION "${CPACK_PACKAGE_VERSION}")
   55   set_target_properties (gvm_base_shared PROPERTIES PUBLIC_HEADER "${HEADERS}")
   56 
   57   target_link_libraries (gvm_base_shared LINK_PRIVATE ${GLIB_LDFLAGS} ${LINKER_HARDENING_FLAGS})
   58 endif (BUILD_SHARED)
   59 
   60 set (LIBGVM_BASE_NAME
   61      ${LIBGVM_BASE_NAME}
   62      PARENT_SCOPE)
   63 
   64 if (GVM_PID_DIR)
   65   add_definitions (-DGVM_PID_DIR="${GVM_PID_DIR}")
   66 endif (GVM_PID_DIR)
   67 
   68 if (GVM_SYSCONF_DIR)
   69   add_definitions (-DGVM_SYSCONF_DIR="${GVM_SYSCONF_DIR}")
   70 endif (GVM_SYSCONF_DIR)
   71 
   72 
   73 ## Tests
   74 
   75 if (BUILD_TESTS)
   76   add_executable (array-test
   77                   EXCLUDE_FROM_ALL
   78                   array_tests.c)
   79 
   80   add_test (array-test array-test)
   81 
   82   target_include_directories (array-test PRIVATE ${CGREEN_INCLUDE_DIRS})
   83 
   84   target_link_libraries (array-test ${CGREEN_LIBRARIES} ${GLIB_LDFLAGS} ${LINKER_HARDENING_FLAGS})
   85 
   86   add_executable (version-test
   87                   EXCLUDE_FROM_ALL
   88                   version_tests.c)
   89 
   90   add_test (version-test version-test)
   91 
   92   target_include_directories (version-test PRIVATE ${CGREEN_INCLUDE_DIRS})
   93 
   94   target_link_libraries (version-test ${CGREEN_LIBRARIES} ${GLIB_LDFLAGS} ${LINKER_HARDENING_FLAGS})
   95 endif (BUILD_TESTS)
   96 
   97 
   98 ## Install
   99 
  100 configure_file (libgvm_base.pc.in ${CMAKE_BINARY_DIR}/libgvm_base.pc @ONLY)
  101 
  102 install (DIRECTORY DESTINATION ${GVM_PID_DIR})
  103 
  104 install (FILES ${CMAKE_BINARY_DIR}/libgvm_base.pc
  105          DESTINATION ${LIBDIR}/pkgconfig)
  106 
  107 if (BUILD_STATIC)
  108   install (TARGETS gvm_base_static
  109     RUNTIME DESTINATION ${BINDIR}
  110     ARCHIVE DESTINATION ${LIBDIR}
  111     PUBLIC_HEADER DESTINATION "${INCLUDEDIR}/gvm/base")
  112 endif (BUILD_STATIC)
  113 
  114 if (BUILD_SHARED)
  115   install (TARGETS gvm_base_shared
  116     RUNTIME DESTINATION ${BINDIR}
  117     LIBRARY DESTINATION ${LIBDIR}
  118     ARCHIVE DESTINATION ${LIBDIR}
  119     PUBLIC_HEADER DESTINATION "${INCLUDEDIR}/gvm/base")
  120 endif (BUILD_SHARED)
  121 
  122 ## End