@@ -5,7 +5,6 @@ project(libscratchcpp LANGUAGES C CXX)
55set (CMAKE_INCLUDE_CURRENT_DIR ON )
66set (CMAKE_CXX_STANDARD 17)
77set (CMAKE_CXX_STANDARD_REQUIRED ON )
8- set (ZIP_SRC thirdparty/zip/src)
98
109option (LIBSCRATCHCPP_BUILD_UNIT_TESTS "Build unit tests" ON )
1110option (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)
1716endif ()
1817
19- find_package (nlohmann_json 3.9.1 REQUIRED)
20- find_package (utf8cpp REQUIRED)
21-
2218add_library (scratchcpp SHARED)
2319add_subdirectory (src)
2420include_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+
6969add_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} )
7677include_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+
7882target_link_libraries (scratchcpp PRIVATE nlohmann_json::nlohmann_json)
79- target_link_libraries (scratchcpp PRIVATE utf8cpp)
8083target_link_libraries (scratchcpp PRIVATE zip)
8184target_link_libraries (scratchcpp PRIVATE scratchcpp-audio)
8285
8386if (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)
0 commit comments