Skip to content

Commit b23ffa7

Browse files
authored
Update CMakeLists.txt to use MakeAvailable
1 parent a6aa263 commit b23ffa7

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

flutter_libs/windows/CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,21 @@ FetchContent_Declare(
6969
URL https://github.com/objectbox/objectbox-c/releases/download/v${OBJECTBOX_VERSION}/objectbox-windows-${OBJECTBOX_ARCH}.zip
7070
)
7171

72-
FetchContent_GetProperties(objectbox-download)
73-
if(NOT objectbox-download_POPULATED)
74-
FetchContent_Populate(objectbox-download)
75-
endif()
72+
# FIXED: Use MakeAvailable instead of GetProperties/Populate
73+
# This handles the download and set-up internally and is the modern standard.
74+
FetchContent_MakeAvailable(objectbox-download)
7675

76+
# We still need the source directory path to point to the library files
77+
# After MakeAvailable, the directory variable is named <lowercaseName>_SOURCE_DIR
7778
set(objectbox_flutter_libs_bundled_libraries
7879
"${objectbox-download_SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_SHARED_LIBRARY_SUFFIX}"
7980
PARENT_SCOPE
8081
)
8182

8283
add_library(objectbox SHARED IMPORTED GLOBAL)
8384
set_target_properties(objectbox PROPERTIES
84-
IMPORTED_LOCATION ${objectbox-download_SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_SHARED_LIBRARY_SUFFIX}
85-
IMPORTED_IMPLIB ${objectbox-download_SOURCE_DIR}/lib/${CMAKE_IMPORT_LIBRARY_PREFIX}objectbox${CMAKE_IMPORT_LIBRARY_SUFFIX}
85+
IMPORTED_LOCATION "${objectbox-download_SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_SHARED_LIBRARY_SUFFIX}"
86+
IMPORTED_IMPLIB "${objectbox-download_SOURCE_DIR}/lib/${CMAKE_IMPORT_LIBRARY_PREFIX}objectbox${CMAKE_IMPORT_LIBRARY_SUFFIX}"
8687
)
8788

88-
target_link_libraries(${PLUGIN_NAME} PRIVATE objectbox)
89+
target_link_libraries(${PLUGIN_NAME} PRIVATE objectbox)

0 commit comments

Comments
 (0)