From: Russ Combs Date: Tue, 15 Apr 2014 18:13:14 +0000 (-0400) Subject: cmake updates from josh X-Git-Tag: 3.0.0-233~1570 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be51f7f7384be6d65462f459bea2fc956d770ada;p=thirdparty%2Fsnort3.git cmake updates from josh --- diff --git a/cmake/FindDAQ.cmake b/cmake/FindDAQ.cmake index 5342133fd..e5176dd31 100644 --- a/cmake/FindDAQ.cmake +++ b/cmake/FindDAQ.cmake @@ -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 ) diff --git a/cmake/FindDNET.cmake b/cmake/FindDNET.cmake index 0442c7833..54db436b8 100644 --- a/cmake/FindDNET.cmake +++ b/cmake/FindDNET.cmake @@ -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) diff --git a/cmake/FindLuaJIT.cmake b/cmake/FindLuaJIT.cmake index bf5bc3849..eb4f70ebf 100644 --- a/cmake/FindLuaJIT.cmake +++ b/cmake/FindLuaJIT.cmake @@ -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 ) diff --git a/cmake/FindPCAP.cmake b/cmake/FindPCAP.cmake index e1b9c66f8..80089d0b2 100644 --- a/cmake/FindPCAP.cmake +++ b/cmake/FindPCAP.cmake @@ -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) diff --git a/cmake/FindPCRE.cmake b/cmake/FindPCRE.cmake index 751c93f46..85bf0e3b4 100644 --- a/cmake/FindPCRE.cmake +++ b/cmake/FindPCRE.cmake @@ -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) diff --git a/cmake/setConfigureOptions.txt b/cmake/setConfigureOptions.txt index d16f56119..36e1b742d 100644 --- a/cmake/setConfigureOptions.txt +++ b/cmake/setConfigureOptions.txt @@ -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) diff --git a/lua/CMakeLists.txt b/lua/CMakeLists.txt index a78691070..b4f03f78e 100644 --- a/lua/CMakeLists.txt +++ b/lua/CMakeLists.txt @@ -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\;\;") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a482c624f..c76a53e51 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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() diff --git a/src/ips_options/CMakeLists.txt b/src/ips_options/CMakeLists.txt index 01c804b68..ee694d6b3 100644 --- a/src/ips_options/CMakeLists.txt +++ b/src/ips_options/CMakeLists.txt @@ -1,5 +1,5 @@ -include_directories(${LUAJIT_INCLUDE_DIRS}) +include_directories(${LUAJIT_INCLUDE_DIR}) SET( PLUGIN_LIST ips_ack.cc diff --git a/src/loggers/CMakeLists.txt b/src/loggers/CMakeLists.txt index be761ce36..189ec2a47 100644 --- a/src/loggers/CMakeLists.txt +++ b/src/loggers/CMakeLists.txt @@ -1,5 +1,5 @@ -include_directories(${LUAJIT_INCLUDE_DIRS}) +include_directories(${LUAJIT_INCLUDE_DIR}) set ( LOGGER_SOURCES loggers.cc diff --git a/src/managers/CMakeLists.txt b/src/managers/CMakeLists.txt index 071fdfa2f..b8d403543 100644 --- a/src/managers/CMakeLists.txt +++ b/src/managers/CMakeLists.txt @@ -1,5 +1,5 @@ -include_directories(${LUAJIT_INCLUDE_DIRS}) +include_directories(${LUAJIT_INCLUDE_DIR}) set (LUA_INCLUDES snort_config.lua diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index b8c4146d4..1fab5dad9 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -1,5 +1,3 @@ -message("\ttest") - if ( TESTING_ENABLED )