"Fossies" - the Fresh Open Source Software Archive

Member "snort3_extra-3.1.53.0/CMakeLists.txt" (20 Dec 2022, 4293 Bytes) of package /linux/misc/snort3_extra-3.1.53.0.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.

    1 cmake_minimum_required ( VERSION 3.4.3 )
    2 project( extra CXX C )
    3 
    4 set (EXTRA_VERSION_MAJOR 1)
    5 set (EXTRA_VERSION_MINOR 0)
    6 set (EXTRA_VERSION_PATCH 0)
    7 set (EXTRA_VERSION "${EXTRA_VERSION_MAJOR}.${EXTRA_VERSION_MINOR}.${EXTRA_VERSION_PATCH}")
    8 
    9 set (CMAKE_CXX_STANDARD 11)
   10 set (CMAKE_CXX_STANDARD_REQUIRED ON)
   11 set (CMAKE_CXX_EXTENSIONS OFF)
   12 
   13 set (CMAKE_C_STANDARD 99)
   14 set (CMAKE_C_STANDARD_REQUIRED ON)
   15 set (CMAKE_C_EXTENSIONS ON)
   16 
   17 set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
   18 # Pull in definitions of various install directories
   19 include (GNUInstallDirs)
   20 include (${CMAKE_MODULE_PATH}/create_options.cmake)
   21 include (${CMAKE_MODULE_PATH}/configure_options.cmake)
   22 
   23 set (CPACK_GENERATOR TGZ)
   24 set (CPACK_PACKAGE_NAME "snort_extra")
   25 set (CPACK_PACKAGE_VENDOR "Cisco")
   26 set (CPACK_PACKAGE_VERSION_MAJOR "${EXTRA_VERSION_MAJOR}")
   27 set (CPACK_PACKAGE_VERSION_MINOR "${EXTRA_VERSION_MINOR}")
   28 set (CPACK_PACKAGE_VERSION_PATCH "${EXTRA_VERSION_PATCH}")
   29 set (CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/doc/images/snort.png")
   30 set (CPACK_PACKAGE_INSTALL_DIRECTORY "snort")
   31 set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
   32 set (CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README")
   33 set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
   34 set (CPACK_SOURCE_IGNORE_FILES "${CMAKE_BINARY_DIR}/*")
   35 set (CPACK_SOURCE_GENERATOR TGZ)
   36 
   37 set (LIB_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}/snort")
   38 set (PLUGIN_INSTALL_PATH "${LIB_INSTALL_PATH}/plugins/${CMAKE_PROJECT_NAME}")
   39 
   40 include(CPack)
   41 
   42 set ( C_FLAGS "" CACHE STRING "" )
   43 set ( CXX_FLAGS "" CACHE STRING "" )
   44 
   45 set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}" CACHE STRING "" FORCE )
   46 set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS}" CACHE STRING "" FORCE )
   47 
   48 execute_process (
   49     COMMAND pkg-config --variable=cpp_opts snort
   50     OUTPUT_VARIABLE CPP_OPTS
   51 )
   52 string ( REGEX REPLACE "[\r\n]" " " CPP_OPTS "${CPP_OPTS}" )
   53 separate_arguments ( CPP_OPTS )
   54 
   55 foreach ( OPT ${CPP_OPTS} )
   56     execute_process (
   57         COMMAND pkg-config --variable=${OPT}_CPPFLAGS snort
   58         OUTPUT_VARIABLE CPPFLAGS
   59     )
   60 
   61     string ( REGEX REPLACE "[\r\n]" " " CPPFLAGS "${CPPFLAGS}" )
   62     set ( ${OPT}_CPPFLAGS "${CPPFLAGS}" CACHE STRING "" )
   63 
   64     set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${OPT}_CPPFLAGS}" CACHE STRING "" FORCE )
   65     set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${OPT}_CPPFLAGS}" CACHE STRING "" FORCE )
   66 endforeach ( OPT )
   67 
   68 execute_process (
   69     COMMAND pkg-config --variable=cpp_opts_other snort
   70     OUTPUT_VARIABLE CPP_OPTS_OTHER
   71 )
   72 string ( REGEX REPLACE "[\r\n]" " " CPP_OPTS_OTHER "${CPP_OPTS_OTHER}" )
   73 separate_arguments ( CPP_OPTS_OTHER )
   74 
   75 foreach ( OPT ${CPP_OPTS_OTHER} )
   76     execute_process (
   77         COMMAND pkg-config --variable=${OPT}_CPPFLAGS snort
   78         OUTPUT_VARIABLE CPPFLAGS
   79     )
   80 
   81     string ( REGEX REPLACE "[\r\n]" " " CPPFLAGS "${CPPFLAGS}" )
   82     set ( ${OPT}_CPPFLAGS "${CPPFLAGS}" CACHE STRING "" )
   83 
   84     set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${OPT}_CPPFLAGS}" CACHE STRING "" FORCE )
   85     set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${OPT}_CPPFLAGS}" CACHE STRING "" FORCE )
   86 endforeach ( OPT )
   87 
   88 # Set these after all tests are done but *before* any subdirectories are included
   89 #  or other targets declared.
   90 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS}")
   91 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS}")
   92 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_LINKER_FLAGS}")
   93 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${EXTRA_LINKER_FLAGS}")
   94 foreach (EXTRA_LIBRARY IN LISTS EXTRA_LIBRARIES)
   95     link_libraries(${EXTRA_LIBRARY})
   96 endforeach (EXTRA_LIBRARY)
   97 
   98 add_subdirectory ( src )
   99 
  100 string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER)
  101 
  102 message("
  103 -------------------------------------------------------
  104 ${CMAKE_PROJECT_NAME} version ${EXTRA_VERSION}
  105 
  106 Install options:
  107     prefix:     ${CMAKE_INSTALL_PREFIX}
  108 
  109 Compiler options:
  110     CC:             ${CMAKE_C_COMPILER}
  111     CXX:            ${CMAKE_CXX_COMPILER}
  112     CFLAGS:         ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}
  113     CXXFLAGS:       ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER}}
  114     EXE_LDFLAGS:    ${CMAKE_EXE_LINKER_FLAGS}
  115     MODULE_LDFLAGS: ${CMAKE_MODULE_LINKER_FLAGS}
  116 ")