]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
cmake updates from josh
authorRuss Combs <rucombs@cisco.com>
Tue, 15 Apr 2014 18:13:14 +0000 (14:13 -0400)
committerRuss Combs <rucombs@cisco.com>
Tue, 15 Apr 2014 18:13:14 +0000 (14:13 -0400)
12 files changed:
cmake/FindDAQ.cmake
cmake/FindDNET.cmake
cmake/FindLuaJIT.cmake
cmake/FindPCAP.cmake
cmake/FindPCRE.cmake
cmake/setConfigureOptions.txt
lua/CMakeLists.txt
src/CMakeLists.txt
src/ips_options/CMakeLists.txt
src/loggers/CMakeLists.txt
src/managers/CMakeLists.txt
src/test/CMakeLists.txt

index 5342133fd3ba91b6740e87f6ca0a6d622a4ce174..e5176dd3195ca8fc93ddff9753f3df23c78535f1 100644 (file)
@@ -5,7 +5,7 @@
 #  DAQ_FOUND, if false, do not try to link to Lua
 # 
 #  DAQ_FOUND - system has the daq
-#  DAQ_INCLUDE_DIRS - the daqs include directory
+#  DAQ_INCLUDE_DIR - the daqs include directory
 #  DAQ_LIBRARIES - the libraries needed to use the daq
 #
 ## Copied from default CMake FindLua51.cmake
@@ -22,7 +22,7 @@ set (ERROR_MESSAGE
 
 
 
-find_path(DAQ_INCLUDE_DIRS
+find_path(DAQ_INCLUDE_DIR
     NAMES  daq.h 
     HINTS  ENV DAQ_DIR
     PATH_SUFFIXES daq
@@ -66,11 +66,11 @@ find_library(DAQ_LIBRARIES
 
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(DAQ
-    REQUIRED_VARS DAQ_LIBRARIES DAQ_INCLUDE_DIRS
+    REQUIRED_VARS DAQ_LIBRARIES DAQ_INCLUDE_DIR
     FAIL_MESSAGE "${ERROR_MESSAGE}"
 )
 
 mark_as_advanced(
-    DAQ_INCLUDE_DIRS 
+    DAQ_INCLUDE_DIR 
     DAQ_LIBRARIES 
 )
index 0442c7833457bbdc308fe76743ad87211133edeb..54db436b8aae8e567c21efeb74c7364e41fbbb30 100644 (file)
@@ -6,7 +6,7 @@
 # The environment variable DUMBNETDIR allows to specficy where to find 
 # libdnet in non standard location.
 #  
-#  DNET_INCLUDE_DIRS - where to find dnet.h, etc.
+#  DNET_INCLUDE_DIR - where to find dnet.h, etc.
 #  DNET_LIBRARIES   - List of libraries when using dnet.
 #  DNET_FOUND       - True if dnet found.
 
@@ -21,57 +21,26 @@ set(ERROR_MESSAGE
 )
 
 
-find_program(DNET_CONFIG 
-    NAMES dnet-config
-    HINTS ENV DNET_DIR
+find_path(DNET_INCLUDE_DIR 
+  NAMES dnet.h dumbnet.h
+  HINTS ENV DNETDIR
 )
 
-# Don't search for the dnet include directories if it is already defined by the user
-if(NOT DNET_INCLUDE_DIRS)
-    if(DNET_CONFIG)
-        EXECUTE_PROCESS(COMMAND ${DNET_CONFIG} --cflags
-            OUTPUT_VARIABLE DNET_INCLUDE_DIRS
-            OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-
-    else(DNET_CONFIG)
-      find_path(DNET_INCLUDE_DIRS 
-          NAMES dnet.h dumbnet.h
-          HINTS ENV DNETDIR
-      )
-
-    endif(DNET_CONFIG)
-endif(NOT DNET_INCLUDE_DIRS)
-
-
-# Don't search for the dnet libraries if it is already defined by the user
-if(NOT DNET_LIBRARIES)
-    if(DNET_CONFIG)
-        EXECUTE_PROCESS(COMMAND ${DNET_CONFIG} --libs
-            OUTPUT_VARIABLE DNET_LIBRARIES
-            OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-
-    else(DNET_CONFIG)
-        find_library(DNET_LIBRARIES
-            NAMES dnet dumbnet
-            HINTS ENV DNETDIR
-        )
-
-    endif(DNET_CONFIG)
-endif(NOT DNET_LIBRARIES)
+find_library(DNET_LIBRARIES
+    NAMES dnet dumbnet
+    HINTS ENV DNETDIR
+)
 
 
 
 
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(DNET 
-    REQUIRED_VARS DNET_INCLUDE_DIRS DNET_LIBRARIES
+    REQUIRED_VARS DNET_INCLUDE_DIR DNET_LIBRARIES
     FAIL_MESSAGE "${ERROR_MESSAGE}"
 )
 
 mark_as_advanced(
-    DNET_INCLUDE_DIRS
+    DNET_INCLUDE_DIR
     DNET_LIBRARIES
 )
-unset(DNET_CONFIG CACHE)
index bf5bc38499b4ccaf3d6a002e82c69e8b67b8f3d0..eb4f70ebfa55a9ace4a83a100fbb5ce233283a04 100644 (file)
@@ -5,7 +5,7 @@
 # This module defines
 #  LUAJIT_FOUND, if false, do not try to link to Lua
 #  LUAJIT_LIBRARIES
-#  LUAJIT_INCLUDE_DIRS, where to find lua.h
+#  LUAJIT_INCLUDE_DIR, where to find lua.h
 #  LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
 
 ## Copied from default CMake FindLua51.cmake
@@ -26,7 +26,7 @@ set(ERROR_MESSAGE
 )
 
 
-find_path(LUAJIT_INCLUDE_DIRS 
+find_path(LUAJIT_INCLUDE_DIR 
     NAMES luajit.h
     HINTS ENV LUA_DIR
     PATH_SUFFIXES include include/luajit-2.0
@@ -56,8 +56,8 @@ if(LUAJIT_LIBRARIES)
 endif()
 
 
-if(LUAJIT_INCLUDE_DIRS AND EXISTS "${LUAJIT_INCLUDE_DIRS}/luajit.h")
-    file(STRINGS "${LUAJIT_INCLUDE_DIRS}/luajit.h" luajit_version_str REGEX "^#define[ \t]+LUAJIT_VERSION[ \t]+\"LuaJIT .+\"")
+if(LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/luajit.h")
+    file(STRINGS "${LUAJIT_INCLUDE_DIR}/luajit.h" luajit_version_str REGEX "^#define[ \t]+LUAJIT_VERSION[ \t]+\"LuaJIT .+\"")
 
     string(REGEX REPLACE "^#define[ \t]+LUAJIT_VERSION[ \t]+\"LuaJIT ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${luajit_version_str}")
     unset(luajit_version_str)
@@ -67,13 +67,13 @@ include(FindPackageHandleStandardArgs)
 # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
 # all listed variables are TRUE
 find_package_handle_standard_args(LuaJIT
-    REQUIRED_VARS LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIRS
+    REQUIRED_VARS LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR
     VERSION_VAR LUAJIT_VERSION_STRING
     FAIL_MESSAGE "${ERROR_MESSAGE}"
 )
 
 mark_as_advanced(
-    LUAJIT_INCLUDE_DIRS 
+    LUAJIT_INCLUDE_DIR 
     LUAJIT_LIBRARIES 
     MATH_LIBRARY
 )
index e1b9c66f8a04a3ca209ea632c6e7848db143e014..80089d0b2653b5edc562342d89360fc8db07b155 100644 (file)
@@ -11,7 +11,7 @@
 # Variables defined by this module:
 #
 #  PCAP_FOUND                System has libpcap, include and library dirs found
-#  PCAP_INCLUDE_DIRS          The libpcap include directories.
+#  PCAP_INCLUDE_DIR          The libpcap include directories.
 #  PCAP_LIBRARIES            The libpcap library (possibly includes a thread
 #                            library e.g. required by pf_ring's libpcap)
 #  HAVE_LIBPFRING              If a found version of libpcap supports PF_RING
@@ -26,53 +26,22 @@ set(ERROR_MESSAGE
     shared library that may be installed in an unusual place"
 )
 
-find_program(PCAP_CONFIG 
-    NAMES pcap-config
-    HINTS ENV PCAP_DIR
-)
-
-if(NOT PCAP_INCLUDE_DIRS)
-    if (PCAP_CONFIG)
-        EXECUTE_PROCESS(COMMAND ${PCAP_CONFIG} --cflags
-            OUTPUT_VARIABLE PCAP_INCLUDE_DIRS
-            OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-
-    else()   
-        find_path(PCAP_INCLUDE_DIRS
-            NAMES pcap.h
-        )
-
-    endif()
-endif()
-
 
-if(NOT PCAP_LIBRARIES)
-    if (PCAP_CONFIG)
-        EXECUTE_PROCESS(
-            COMMAND pcap-config --libs
-            RESULT_VARIABLE exit_code
-            OUTPUT_VARIABLE PCAP_LIBRARIES
-            OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-
-    else()
-
-        find_library(PCAP_LIBRARIES 
-            NAMES pcap
-        )
-    endif()
 
+find_path(PCAP_INCLUDE_DIR
+    NAMES pcap.h
+)
 
-    set (PCAP_LIBRARIES "${PCAP_LIBRARIES}" CACHE PATH "libpcap library directory")
-endif()
+find_library(PCAP_LIBRARIES 
+    NAMES pcap
+)
 
 
 #  foo to ensure PCAP compiles
 
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(PCAP
-    REQUIRED_VARS PCAP_LIBRARIES PCAP_INCLUDE_DIRS
+    REQUIRED_VARS PCAP_LIBRARIES PCAP_INCLUDE_DIR
     FAIL_MESSAGE ${ERROR_MESSAGE}
 )
 
@@ -107,7 +76,7 @@ check_function_exists(pcap_get_pfring_id HAVE_LIBPFRING)
 set(CMAKE_REQUIRED_LIBRARIES)
 
 mark_as_advanced(
-    PCAP_INCLUDE_DIRS
+    PCAP_INCLUDE_DIR
     PCAP_LIBRARIES
 )
 unset(PCAP_CONFIG CACHE)
index 751c93f4643058460dff65153c3b0ea084910213..85bf0e3b440e21b42d7f90614bb4694ce75e11d9 100644 (file)
@@ -3,7 +3,7 @@
 # - Find pcre
 # Find the native PCRE includes and library
 #
-#  PCRE_INCLUDE_DIRS - where to find pcre.h, etc.
+#  PCRE_INCLUDE_DIR - where to find pcre.h, etc.
 #  PCRE_LIBRARIES    - List of libraries when using pcre.
 #  PCRE_FOUND        - True if pcre found.
 
@@ -12,57 +12,21 @@ set(ERROR_MESSAGE
     \tGet it from http://www.pcre.org\n"
 )
 
-find_program(PCRE_CONFIG 
-    NAMES pcre-config
-    HINTS ENV PCRE_DIR
+find_path(PCRE_INCLUDE_DIR 
+    NAMES pcre.h
 )
 
-
-
-if (NOT PCRE_INCLUDE_DIRS)
-    if(PCRE_CONFIG)
-        execute_process(COMMAND ${PCRE_CONFIG} --cflags
-            OUTPUT_VARIABLE PCRE_INCLUDE_DIRS
-            OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-
-    else(PCRE_CONFIG)
-        find_path(PCRE_INCLUDE_DIRS 
-            NAMES pcre.h
-        )
-
-    endif(PCRE_CONFIG)
-endif(NOT PCRE_INCLUDE_DIRS)
-
-
-if (NOT PCRE_LIBRARIES)
-    if(PCRE_CONFIG)
-        execute_process(COMMAND ${PCRE_CONFIG} --libs
-            OUTPUT_VARIABLE PCRE_LIBRARIES
-            OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-
-    else(PCRE_CONFIG)
-        find_path(PCRE_LIBRARIES 
-            NAMES pcre
-        )
-
-    endif(PCRE_CONFIG)
-endif(NOT PCRE_LIBRARIES)
-
+find_library(PCRE_LIBRARIES 
+    NAMES pcre
+)
 
 
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(PCRE
-    REQUIRED_VARS PCRE_LIBRARIES PCRE_INCLUDE_DIRS
+    REQUIRED_VARS PCRE_INCLUDE_DIR PCRE_LIBRARIES
     FAIL_MESSAGE "${ERROR_MESSAGE}"
 )
 
-
-
-include (CheckLibraryExists)
-check_library_exists(pcre pcre_compile ${PCRE_LIBRARIES} MIN_VERSION_SIX)
-
 message(STATUS "MUST BE AT LEAST VERSION SIX")
 
 message(STATUS "Create test to check PCRE version")
@@ -71,6 +35,5 @@ message(STATUS "Create test to check PCRE version")
 
 mark_as_advanced(
     PCRE_LIBRARIES 
-    PCRE_INCLUDE_DIRS
+    PCRE_INCLUDE_DIR
 )
-unset(PCRE_CONFIG CACHE)
index d16f56119ee16bf555f67e8ad7150d6806a102de..36e1b742d6822a6d1fba45c737e3384623cca53d 100644 (file)
@@ -113,7 +113,7 @@ if (NOT DBLATEX_FOUND)
     set(MAKE_PDF_DOC "OFF" CACHE BOOL ${MAKE_PDF_DOC_HELP_STRING})
 endif()
 
-if (${CMAKE_GENERATOR} MATCHES Xcode)
+if ("${CMAKE_GENERATOR}" MATCHES "Xcode")
     get_property(MAKE_HTML_DOC_HELP_STRING CACHE "MAKE_HTML_DOC" PROPERTY HELPSTRING)
     set(MAKE_HTML_DOC "OFF" CACHE BOOL ${MAKE_HTML_DOC_HELP_STRING})
     get_property(MAKE_PDF_DOC_HELP_STRING CACHE "MAKE_PDF_DOC" PROPERTY HELPSTRING)
index a786910704c38c5c1f2e64e20969abc2aa665950..b4f03f78e35a3388885d023d5d9c1719b160364c 100644 (file)
@@ -6,7 +6,8 @@ set (LUA_SCRIPTS
     reference.lua
 )
 
-install (FILES ${EXTRA_DIST_BINARY_PATH}
+install (FILES ${LUA_SCRIPTS}
     DESTINATION "conf"
 )
 
+set(ENV{LUA_PATH} "${CMAKE_INSTALL_PREFIX}/include/snort/lua/?.lua\;\;")
index a482c624fbab5f74f72ae0d87814867b9ceef81a..c76a53e51547bac1ef7c6b1710eb76471d453ea5 100644 (file)
@@ -2,11 +2,11 @@
 # ... include everything because I'm not correcting 
 # every files include
 
-include_directories(${DAQ_INCLUDE_DIRS})
-include_directories(${LUA_INCLUDE_DIRS})
-include_directories(${PCAP_INCLUDES})
-include_directories(${PCRE_INCLUDE_DIRS})
-include_directories(${LUAJIT_INCLUDE_DIRS})
+include_directories(${DAQ_INCLUDE_DIR})
+include_directories(${PCAP_INCLUDE_DIR})
+include_directories(${PCRE_INCLUDE_DIR})
+include_directories(${LUAJIT_INCLUDE_DIR})
+include_directories(${DNET_INCLUDE_DIR})
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 include_directories(control)
 include_directories(detection)
@@ -129,6 +129,7 @@ target_link_libraries(snort
     ${OPENSSL_CRYPTO_LIBRARY}
     ${LUAJIT_LIBRARIES}
     ${DAQ_LIBRARIES}
+    ${DNET_LIBRARIES}
 )
 
 
@@ -182,71 +183,76 @@ install(TARGETS snort
 #
 ##############################################################################
 
-set(TARGET_DIR ${CMAKE_BINARY_DIR})
 
 
-set(file builtin.txt)
+if (MAKE_PDF_DOC OR MAKE_HTML_DOC)
 
-set(output ${TARGET_DIR}/${file})
-add_custom_command(
-    OUTPUT ${output}
-    COMMAND snort --markup --help-builtin > ${output}
-    MAIN_DEPENDENCY snort
-    COMMENT "Documents: building ${output}"
-)
-get_filename_component(file_name "${file}" NAME_WE)
-add_custom_target(doc_${file_name} ALL DEPENDS ${output} )
 
+    set(TARGET_DIR ${CMAKE_BINARY_DIR})
 
-set(file commands.txt)
 
-set(output ${TARGET_DIR}/${file})
-add_custom_command(
-    OUTPUT ${output}
-    COMMAND snort  --markup --help-commands > ${output}
-    MAIN_DEPENDENCY snort
-    COMMENT "Documents: building ${output}"
-)
-get_filename_component(file_name "${file}" NAME_WE)
-add_custom_target(doc_${file_name} ALL DEPENDS ${output} )
+    set(file builtin.txt)
 
+    set(output ${TARGET_DIR}/${file})
+    add_custom_command(
+        OUTPUT ${output}
+        COMMAND snort --markup --help-builtin > ${output}
+        MAIN_DEPENDENCY snort
+        COMMENT "Documents: building ${output}"
+    )
+    get_filename_component(file_name "${file}" NAME_WE)
+    add_custom_target(doc_${file_name} ALL DEPENDS ${output} )
 
 
-set(file config.txt)
+    set(file commands.txt)
 
-set(output ${TARGET_DIR}/${file})
-add_custom_command(
-    OUTPUT ${output}
-    COMMAND snort --markup --help-config > ${output}
-    MAIN_DEPENDENCY snort
-    COMMENT "Documents: building ${output}"
-)
-get_filename_component(file_name "${file}" NAME_WE)
-add_custom_target(doc_${file_name} ALL DEPENDS ${output})
+    set(output ${TARGET_DIR}/${file})
+    add_custom_command(
+        OUTPUT ${output}
+        COMMAND snort  --markup --help-commands > ${output}
+        MAIN_DEPENDENCY snort
+        COMMENT "Documents: building ${output}"
+    )
+    get_filename_component(file_name "${file}" NAME_WE)
+    add_custom_target(doc_${file_name} ALL DEPENDS ${output} )
 
 
-set(file options.txt)
 
-set(output ${TARGET_DIR}/${file})
-add_custom_command(
-    OUTPUT ${output}
-    COMMAND snort --markup --help > ${output}
-    MAIN_DEPENDENCY snort
-    COMMENT "Documents: building ${output}"
-)
-get_filename_component(file_name "${file}" NAME_WE)
-add_custom_target(doc_${file_name} ALL DEPENDS ${output})
+    set(file config.txt)
 
+    set(output ${TARGET_DIR}/${file})
+    add_custom_command(
+        OUTPUT ${output}
+        COMMAND snort --markup --help-config > ${output}
+        MAIN_DEPENDENCY snort
+        COMMENT "Documents: building ${output}"
+    )
+    get_filename_component(file_name "${file}" NAME_WE)
+    add_custom_target(doc_${file_name} ALL DEPENDS ${output})
 
-set(file gids.txt)
 
-set(output ${TARGET_DIR}/${file})
-add_custom_command(
-    OUTPUT ${output}
-    COMMAND snort --markup --help-gids > ${output}
-    MAIN_DEPENDENCY snort
-    COMMENT "Documents: building ${output}"
-)
-get_filename_component(file_name "${file}" NAME_WE)
-add_custom_target(doc_${file_name} ALL DEPENDS ${output})
+    set(file options.txt)
+
+    set(output ${TARGET_DIR}/${file})
+    add_custom_command(
+        OUTPUT ${output}
+        COMMAND snort --markup --help > ${output}
+        MAIN_DEPENDENCY snort
+        COMMENT "Documents: building ${output}"
+    )
+    get_filename_component(file_name "${file}" NAME_WE)
+    add_custom_target(doc_${file_name} ALL DEPENDS ${output})
 
+
+    set(file gids.txt)
+
+    set(output ${TARGET_DIR}/${file})
+    add_custom_command(
+        OUTPUT ${output}
+        COMMAND snort --markup --help-gids > ${output}
+        MAIN_DEPENDENCY snort
+        COMMENT "Documents: building ${output}"
+    )
+    get_filename_component(file_name "${file}" NAME_WE)
+    add_custom_target(doc_${file_name} ALL DEPENDS ${output})
+endif()
index 01c804b686e9fad3671c9cddc3b2fadc511e1965..ee694d6b335be541bd910a62f78c90b0ad4dbc38 100644 (file)
@@ -1,5 +1,5 @@
 
-include_directories(${LUAJIT_INCLUDE_DIRS})
+include_directories(${LUAJIT_INCLUDE_DIR})
 
 SET( PLUGIN_LIST
     ips_ack.cc
index be761ce36393ea928e38153e5f06c2bc8c459722..189ec2a478d5ad61de6e63c223ea4c861a8a584f 100644 (file)
@@ -1,5 +1,5 @@
 
-include_directories(${LUAJIT_INCLUDE_DIRS})
+include_directories(${LUAJIT_INCLUDE_DIR})
 
 set ( LOGGER_SOURCES
     loggers.cc
index 071fdfa2fbf56bc8993e887d565bec77dbd73df5..b8d40354392c7feb8253432f8eefc361f5848757 100644 (file)
@@ -1,5 +1,5 @@
 
-include_directories(${LUAJIT_INCLUDE_DIRS})
+include_directories(${LUAJIT_INCLUDE_DIR})
 
 set (LUA_INCLUDES
     snort_config.lua
index b8c4146d434fbd54bfb5da530e09fe4665c103f0..1fab5dad981e576f36c89c23bb5c3e155fc74b06 100644 (file)
@@ -1,5 +1,3 @@
-message("\ttest")
-
 
 if ( TESTING_ENABLED )