Skip to content

Commit 2ed803d

Browse files
authored
Merge pull request #495 from scratchcpp/dependencies_without_find_package
Do not use find_package for dependencies
2 parents 2e3d3df + 73aab33 commit 2ed803d

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "thirdparty/googletest"]
55
path = thirdparty/googletest
66
url = https://github.com/google/googletest
7+
[submodule "thirdparty/utfcpp"]
8+
path = thirdparty/utfcpp
9+
url = https://github.com/nemtrif/utfcpp

CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ project(libscratchcpp LANGUAGES C CXX)
55
set(CMAKE_INCLUDE_CURRENT_DIR ON)
66
set(CMAKE_CXX_STANDARD 17)
77
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8-
set(ZIP_SRC thirdparty/zip/src)
98

109
option(LIBSCRATCHCPP_BUILD_UNIT_TESTS "Build unit tests" ON)
1110
option(LIBSCRATCHCPP_NETWORK_SUPPORT "Support for downloading projects" ON)
@@ -16,9 +15,6 @@ if (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
1615
set(LIBSCRATCHCPP_COMPUTED_GOTO OFF CACHE BOOL "" FORCE)
1716
endif()
1817

19-
find_package(nlohmann_json 3.9.1 REQUIRED)
20-
find_package(utf8cpp REQUIRED)
21-
2218
add_library(scratchcpp SHARED)
2319
add_subdirectory(src)
2420
include_directories(src) # TODO: Remove this line
@@ -66,22 +62,28 @@ target_sources(scratchcpp
6662
include/scratchcpp/imonitorhandler.h
6763
)
6864

65+
include(FetchContent)
66+
set(ZIP_SRC thirdparty/zip/src)
67+
set(UTFCPP_SRC thirdparty/utfcpp/source)
68+
6969
add_library(zip SHARED
7070
${ZIP_SRC}/zip.c
7171
${ZIP_SRC}/zip.h
7272
${ZIP_SRC}/miniz.h
7373
)
74-
include_directories(thirdparty/zip/src)
74+
target_include_directories(scratchcpp PUBLIC ${ZIP_SRC})
7575

76+
target_include_directories(scratchcpp PUBLIC ${UTFCPP_SRC})
7677
include_directories(thirdparty/spimpl)
7778

79+
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz)
80+
FetchContent_MakeAvailable(json)
81+
7882
target_link_libraries(scratchcpp PRIVATE nlohmann_json::nlohmann_json)
79-
target_link_libraries(scratchcpp PRIVATE utf8cpp)
8083
target_link_libraries(scratchcpp PRIVATE zip)
8184
target_link_libraries(scratchcpp PRIVATE scratchcpp-audio)
8285

8386
if (LIBSCRATCHCPP_NETWORK_SUPPORT)
84-
include(FetchContent)
8587
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
8688
GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8) # 1.10.5
8789
FetchContent_MakeAvailable(cpr)

thirdparty/utfcpp

Submodule utfcpp added at 6be08bb

0 commit comments

Comments
 (0)