Insane_DNS/CMakeLists.txt

55 lines
1.9 KiB
CMake
Raw Normal View History

2023-10-25 13:08:15 -04:00
cmake_minimum_required(VERSION 3.0)
2023-10-24 21:59:30 -04:00
project(insane_dns)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
set(CMAKE_CXX_STANDARD 20)
2023-10-26 19:52:18 -04:00
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
2023-10-26 16:29:03 -04:00
option(BUILD_PARSE OFF)
option(BUILD_PROFILING OFF)
2023-10-26 16:30:01 -04:00
option(BUILD_NBT OFF)
2023-10-24 21:59:30 -04:00
add_subdirectory(libraries/BLT)
include_directories(include/)
include_directories(libraries/asio-1.28.1/include)
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
#file(GLOB_RECURSE ASIO_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/libraries/asio-1.28.1/src/*.cpp")
#add_compile_definitions(ASIO_SEPARATE_COMPILATION)
add_executable(insane_dns ${PROJECT_BUILD_FILES})
target_link_libraries(insane_dns BLT)
2023-10-26 20:10:27 -04:00
target_link_libraries(insane_dns stdc++fs)
2023-10-24 21:59:30 -04:00
2023-10-26 19:52:18 -04:00
if(THREADS_HAVE_PTHREAD_ARG)
# annoying hack for asio on sandcastle
2023-10-26 20:06:20 -04:00
set_property(TARGET insane_dns PROPERTY COMPILE_OPTIONS "-pthread")
set_property(TARGET insane_dns PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread")
2023-10-26 19:52:18 -04:00
endif()
if(CMAKE_THREAD_LIBS_INIT)
target_link_libraries(insane_dns "${CMAKE_THREAD_LIBS_INIT}")
endif()
2023-10-27 16:07:35 -04:00
#target_compile_options(insane_dns PRIVATE -Wall -Werror -Wpedantic -Werror=return-local-addr -Wno-comment -Wno-format)
#target_link_options(insane_dns PRIVATE -Wall -Werror -Wpedantic -Werror=return-local-addr -Wno-comment -Wno-format)
2023-10-24 21:59:30 -04:00
if (${ENABLE_ADDRSAN} MATCHES ON)
target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=address)
target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=address)
endif ()
if (${ENABLE_UBSAN} MATCHES ON)
target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=undefined)
target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=undefined)
endif ()
if (${ENABLE_TSAN} MATCHES ON)
target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=thread)
target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=thread)
endif ()