Skip to content

Commit

Permalink
Use FetchContent_MakeAvailable (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbatalov authored Feb 9, 2025
1 parent c4cc713 commit f6ba9d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
1 change: 1 addition & 0 deletions third_party/fpattern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FetchContent_Declare(fpattern
GIT_TAG 8523173ec252c3b796fcdfca0fcc6329642fbbe3 # v1.9
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
EXCLUDE_FROM_ALL
)

FetchContent_MakeAvailable(fpattern)
11 changes: 4 additions & 7 deletions third_party/sdl2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Build static lib only
set(BUILD_SHARED_LIBS OFF)
set(SDL_SHARED OFF)
set(SDL_STATIC ON)

Expand All @@ -15,14 +14,12 @@ include(FetchContent)
FetchContent_Declare(sdl2
GIT_REPOSITORY "https://github.com/libsdl-org/SDL"
GIT_TAG "release-2.26.1"
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
EXCLUDE_FROM_ALL
)

FetchContent_GetProperties(sdl2)
if (NOT sdl2_POPULATED)
FetchContent_Populate(sdl2)
endif()

add_subdirectory(${sdl2_SOURCE_DIR} ${sdl2_BINARY_DIR} EXCLUDE_FROM_ALL)
FetchContent_MakeAvailable(sdl2)

set(SDL2_INCLUDE_DIRS ${sdl2_SOURCE_DIR} ${sdl2_BINARY_DIR} PARENT_SCOPE)
set(SDL2_LIBRARIES SDL2-static SDL2::SDL2main PARENT_SCOPE)
10 changes: 4 additions & 6 deletions third_party/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ include(FetchContent)
FetchContent_Declare(zlib
GIT_REPOSITORY "https://github.com/madler/zlib"
GIT_TAG "v1.3.1"
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
EXCLUDE_FROM_ALL
)

FetchContent_GetProperties(zlib)
if (NOT zlib_POPULATED)
FetchContent_Populate(zlib)
endif()

add_subdirectory("${zlib_SOURCE_DIR}" "${zlib_BINARY_DIR}" EXCLUDE_FROM_ALL)
FetchContent_MakeAvailable(zlib)

set(ZLIB_LIBRARIES "zlibstatic" PARENT_SCOPE)
set(ZLIB_INCLUDE_DIRS "${zlib_SOURCE_DIR}" "${zlib_BINARY_DIR}" PARENT_SCOPE)

0 comments on commit f6ba9d3

Please sign in to comment.