diff --git a/.gitmodules b/.gitmodules index 6a9cde8..2e9c47f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,7 +2,3 @@ path = fmt url = https://github.com/fmtlib/fmt branch = master -[submodule "sentry"] - path = sentry - url = https://github.com/getsentry/sentry-native.git - branch = master diff --git a/CMakeLists.txt b/CMakeLists.txt index 0696160..ec88d73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,13 +9,16 @@ endif() include (CMakePackageConfigHelpers) -add_subdirectory(fmt) -target_compile_definitions(fmt PUBLIC - FMT_STRING_ALIAS=1 - FMT_ARM_ABI_COMPATIBILITY=1 - FMT_EXCEPTIONS=0) -target_compile_definitions(fmt INTERFACE - FMT_ENFORCE_COMPILE_STRING=1) +if (NOT TARGET fmt) + add_subdirectory(fmt) + target_compile_definitions(fmt PUBLIC + FMT_STRING_ALIAS=1 + FMT_ARM_ABI_COMPATIBILITY=1 + FMT_EXCEPTIONS=0) + target_compile_definitions(fmt INTERFACE + FMT_ENFORCE_COMPILE_STRING=1) + set(FMT_LIB fmt) +endif () add_library(logvisor lib/logvisor.cpp @@ -28,7 +31,12 @@ if ("${SENTRY_DSN}" STREQUAL "") set(BREAKPAD_CLIENT "") else () message(STATUS "Enabling Sentry integration") - add_subdirectory(sentry) + include(FetchContent) + FetchContent_Declare(sentry + GIT_REPOSITORY https://github.com/getsentry/sentry-native.git + GIT_TAG 5fcb1dc4d1c8b85fc5ab225d29c7394b375fd1e9 + ) + FetchContent_MakeAvailable(sentry) target_compile_definitions(logvisor PUBLIC SENTRY_ENABLED=1) target_compile_definitions(logvisor PRIVATE SENTRY_DSN="${SENTRY_DSN}") set(SENTRY_LIB sentry) @@ -62,7 +70,9 @@ endif() target_include_directories(logvisor PUBLIC $) install(DIRECTORY include/logvisor DESTINATION include) -install(DIRECTORY fmt/include/fmt DESTINATION include) +if (FMT_LIB) + install(DIRECTORY fmt/include/fmt DESTINATION include) +endif () set(version_config_file "${PROJECT_BINARY_DIR}/logvisorConfigVersion.cmake") set(config_file "${PROJECT_BINARY_DIR}/logvisorConfig.cmake") @@ -70,7 +80,7 @@ set(config_install_dir "lib/cmake/logvisor") # Associate target with export install( - TARGETS logvisor fmt ${SENTRY_LIB} ${BREAKPAD_CLIENT} + TARGETS logvisor ${FMT_LIB} ${SENTRY_LIB} ${BREAKPAD_CLIENT} EXPORT logvisorTargets ARCHIVE DESTINATION "lib" INCLUDES DESTINATION include # This sets the INTERFACE_INCLUDE_DIRECTORIES property of the target. diff --git a/sentry b/sentry deleted file mode 160000 index 5fcb1dc..0000000 --- a/sentry +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5fcb1dc4d1c8b85fc5ab225d29c7394b375fd1e9