diff options
| author | 刘学利 <[email protected]> | 2024-06-12 03:40:41 +0000 |
|---|---|---|
| committer | 刘学利 <[email protected]> | 2024-06-12 03:40:41 +0000 |
| commit | b7d504620edb2a24b899fe85caa84c28a3ad8564 (patch) | |
| tree | c75cd2978ba7ddf49f02f9e36e4b1a427ceb4946 /CMakeLists.txt | |
| parent | 478696610e58d1f38b3491c4f3f8a9f9518383b3 (diff) | |
DNS Decoder create version
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..785eed0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required (VERSION 3.0) + +set(lib_name dns_decoder) + +project (${lib_name}) + +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +include(Version) + +set(CMAKE_MACOSX_RPATH 0) +set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wall) + +find_program(CMAKE_CXX_CPPCHECK NAMES cppcheck) +if (CMAKE_CXX_CPPCHECK) + list( + APPEND CMAKE_CXX_CPPCHECK + "--enable=all" + "--error-exitcode=1" + "--suppress=unusedFunction" + "--suppress=missingInclude" + "--suppress=uselessAssignmentPtrArg" + "--suppress=unmatchedSuppression" + "--suppress=internalAstError" + "--suppress=constParameter" + "--suppress=variableScope" + "--suppress=unreadVariable" + "--suppress=unusedStructMember" + ) + set(CMAKE_C_CPPCHECK ${CMAKE_CXX_CPPCHECK}) +else() + message(FATAL_ERROR "Could not find the program cppcheck.") +endif() + + +#for ASAN +set(ASAN_OPTION "OFF" CACHE STRING " set asan type chosen by the user, using OFF as default") +set_property(CACHE ASAN_OPTION PROPERTY STRINGS OFF ADDRESS THREAD) +message(STATUS "ASAN_OPTION='${ASAN_OPTION}'") + +if(ASAN_OPTION MATCHES "ADDRESS") + set(CMAKE_C_FLAGS "${CMAKADDRESS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=address -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=address -fno-omit-frame-pointer") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan") +elseif(ASAN_OPTION MATCHES "THREAD") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=thread -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DCMAKE_BUILD_TYPE=Debug -fsanitize=thread -fno-omit-frame-pointer") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan") +endif() +# end of for ASAN + +include_directories(${PROJECT_SOURCE_DIR}/include) +include_directories(/opt/MESA/include/MESA/) + +set(CMAKE_INSTALL_PREFIX /opt/tsg/) + +enable_testing() +add_subdirectory(src) +add_subdirectory(test) + +install(FILES bin/dns_decoder.toml DESTINATION ${CMAKE_INSTALL_PREFIX}/sapp/etc/dns/ COMPONENT PROFILE) +install(FILES bin/dns_decoder_local_stat.sh DESTINATION ${CMAKE_INSTALL_PREFIX}/framework/bin/ COMPONENT PROFILE) +install(FILES include/dns_decoder.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/decoder/ COMPONENT HEADER) + +include(Package) |
