refactor: support system and bundled cmark

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2023-01-07 14:57:13 +01:00 committed by Joshua Goins
parent aa7c910e26
commit 22a2b7ac46
4 changed files with 18 additions and 1 deletions

3
.gitmodules vendored
View File

@ -16,3 +16,6 @@
[submodule "libraries/extra-cmake-modules"] [submodule "libraries/extra-cmake-modules"]
path = libraries/extra-cmake-modules path = libraries/extra-cmake-modules
url = https://github.com/KDE/extra-cmake-modules url = https://github.com/KDE/extra-cmake-modules
[submodule "libraries/cmark"]
path = libraries/cmark
url = https://github.com/commonmark/cmark.git

View File

@ -266,6 +266,9 @@ if(NOT Launcher_FORCE_BUNDLED_LIBS)
# Find ghc_filesystem # Find ghc_filesystem
find_package(ghc_filesystem QUIET) find_package(ghc_filesystem QUIET)
# Find cmark
find_package(cmark QUIET)
endif() endif()
include(ECMQtDeclareLoggingCategory) include(ECMQtDeclareLoggingCategory)
@ -407,6 +410,16 @@ if(NOT tomlplusplus_FOUND)
else() else()
message(STATUS "Using system tomlplusplus") message(STATUS "Using system tomlplusplus")
endif() endif()
if(NOT cmark_FOUND)
message(STATUS "Using bundled cmark")
set(CMARK_STATIC ON CACHE BOOL "Build static libcmark library" FORCE)
set(CMARK_SHARED OFF CACHE BOOL "Build shared libcmark library" FORCE)
set(CMARK_TESTS OFF CACHE BOOL "Build cmark tests and enable testing" FORCE)
add_subdirectory(libraries/cmark EXCLUDE_FROM_ALL) # Markdown parser
add_library(cmark::cmark ALIAS cmark_static)
else()
message(STATUS "Using system cmark")
endif()
add_subdirectory(libraries/katabasis) # An OAuth2 library that tried to do too much add_subdirectory(libraries/katabasis) # An OAuth2 library that tried to do too much
add_subdirectory(libraries/gamemode) add_subdirectory(libraries/gamemode)
add_subdirectory(libraries/murmur2) # Hash for usage with the CurseForge API add_subdirectory(libraries/murmur2) # Hash for usage with the CurseForge API

View File

@ -1043,7 +1043,7 @@ target_link_libraries(Launcher_logic
) )
target_link_libraries(Launcher_logic target_link_libraries(Launcher_logic
QuaZip::QuaZip QuaZip::QuaZip
cmark cmark::cmark
LocalPeer LocalPeer
Launcher_rainbow Launcher_rainbow
) )

1
libraries/cmark Submodule

@ -0,0 +1 @@
Subproject commit a8da5a2f252b96eca60ae8bada1a9ba059a38401