cmake: use FetchContent for some dependencies (#6560)

this transition is _not_ complete, but we use FetchContent for
RapidJSON, PajladaSerialize, PajladaSettings, and PajladaSignals.

In the future, we can move towards providing as many of our dependencies
as possible through conan & vcpkg so submodule-less builds are possible.
This commit is contained in:
pajlada
2025-11-02 21:45:27 +01:00
committed by GitHub
parent 072bc897a0
commit e7668212bd
12 changed files with 49 additions and 83 deletions
+11 -3
View File
@@ -873,6 +873,17 @@ if (CHATTERINO_GENERATE_COVERAGE)
)
endif ()
if(TARGET rapidjson)
message(DEBUG "Linking to rapidjson target")
target_link_libraries(${LIBRARY_PROJECT} PUBLIC rapidjson)
elseif(DEFINED RapidJSON_SOURCE_DIR)
message(DEBUG "RapidJSON_SOURCE_DIR defined, assuming this is a submodule/source build. (${RapidJSON_SOURCE_DIR})")
target_include_directories(${LIBRARY_PROJECT} SYSTEM PUBLIC ${RapidJSON_SOURCE_DIR}/include)
else()
message(DEBUG "No rapidjson target found, this is most likely a system install. Adding include directories (${RAPIDJSON_INCLUDE_DIRS}) instead")
target_include_directories(${LIBRARY_PROJECT} SYSTEM PUBLIC ${RAPIDJSON_INCLUDE_DIRS})
endif()
target_link_libraries(${LIBRARY_PROJECT}
PUBLIC
Qt${MAJOR_QT_VERSION}::Core
@@ -888,7 +899,6 @@ target_link_libraries(${LIBRARY_PROJECT}
Pajlada::Signals
websocketpp::websocketpp
Threads::Threads
RapidJSON::RapidJSON
LRUCache
MagicEnum
$<$<BOOL:${WIN32}>:Wtsapi32>
@@ -1194,8 +1204,6 @@ target_link_libraries(${LIBRARY_PROJECT}
OpenSSL::Crypto
)
target_include_directories(${LIBRARY_PROJECT} PUBLIC ${RapidJSON_INCLUDE_DIRS})
if (LIBRT)
target_link_libraries(${LIBRARY_PROJECT}
PUBLIC
+5 -4
View File
@@ -18,9 +18,10 @@ template <typename T>
struct SignalVectorItemEvent;
template <typename TVectorItem>
class SignalVectorModel : public QAbstractTableModel,
pajlada::Signals::SignalHolder
class SignalVectorModel : public QAbstractTableModel
{
pajlada::Signals::SignalHolder signalHolder;
public:
SignalVectorModel(int columnCount, QObject *parent = nullptr)
: QAbstractTableModel(parent)
@@ -66,9 +67,9 @@ public:
insert(args);
}
this->managedConnect(vec->itemInserted, insert);
this->signalHolder.managedConnect(vec->itemInserted, insert);
this->managedConnect(vec->itemRemoved, [this](auto args) {
this->signalHolder.managedConnect(vec->itemRemoved, [this](auto args) {
if (args.caller == this)
{
return;