Skip to content

Commit cd79b00

Browse files
committed
adjust conditional
1 parent 5fcf846 commit cd79b00

File tree

1 file changed

+31
-32
lines changed

1 file changed

+31
-32
lines changed

packages/common/amplify_db_common/windows/CMakeLists.txt

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,42 @@ add_library(${PLUGIN_NAME} SHARED
1616
"amplify_db_common_plugin.cpp"
1717
)
1818

19-
###
19+
# ##
2020
# Below here, keep in sync with: https://github.com/simolus3/sqlite3.dart/blob/main/sqlite3_flutter_libs/windows/CMakeLists.txt
21-
###
21+
# ##
2222

23-
# Essentially, the idea of this build script is to compile a sqlite3.dll
24-
# and make Flutter bundle that with the final app.
25-
# It looks like we can't avoid building a sqlite3_flutter_libs.dll too,
26-
# but that's not on me.
27-
28-
apply_standard_settings(${PLUGIN_NAME})
29-
set_target_properties(${PLUGIN_NAME} PROPERTIES
30-
CXX_VISIBILITY_PRESET hidden)
31-
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
32-
target_include_directories(${PLUGIN_NAME} INTERFACE
33-
"${CMAKE_CURRENT_SOURCE_DIR}/include")
34-
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)
23+
# Only fetch and build sqlite3 if it hasn't been added yet
24+
if(NOT TARGET sqlite3)
25+
# Essentially, the idea of this build script is to compile a sqlite3.dll
26+
# and make Flutter bundle that with the final app.
27+
# It looks like we can't avoid building a sqlite3_flutter_libs.dll too,
28+
# but that's not on me.
29+
apply_standard_settings(${PLUGIN_NAME})
30+
set_target_properties(${PLUGIN_NAME} PROPERTIES
31+
CXX_VISIBILITY_PRESET hidden)
32+
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
33+
target_include_directories(${PLUGIN_NAME} INTERFACE
34+
"${CMAKE_CURRENT_SOURCE_DIR}/include")
35+
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)
3536

36-
include(FetchContent)
37+
include(FetchContent)
3738

38-
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
39-
# cmake 3.24.0 added the `DOWNLOAD_EXTRACT_TIMESTAMP` and prints an ugly warning when
40-
# the default is used, so override it to the recommended behavior.
41-
# We can't really ask users to use a cmake that recent, so there's this if here.
42-
FetchContent_Declare(
43-
sqlite3
44-
URL https://sqlite.org/2024/sqlite-autoconf-3460000.tar.gz
45-
DOWNLOAD_EXTRACT_TIMESTAMP NEW
46-
)
47-
else()
48-
FetchContent_Declare(
49-
sqlite3
50-
URL https://sqlite.org/2024/sqlite-autoconf-3460000.tar.gz
51-
)
52-
endif()
39+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
40+
# cmake 3.24.0 added the `DOWNLOAD_EXTRACT_TIMESTAMP` and prints an ugly warning when
41+
# the default is used, so override it to the recommended behavior.
42+
# We can't really ask users to use a cmake that recent, so there's this if here.
43+
FetchContent_Declare(
44+
sqlite3
45+
URL https://sqlite.org/2024/sqlite-autoconf-3460000.tar.gz
46+
DOWNLOAD_EXTRACT_TIMESTAMP NEW
47+
)
48+
else()
49+
FetchContent_Declare(
50+
sqlite3
51+
URL https://sqlite.org/2024/sqlite-autoconf-3460000.tar.gz
52+
)
53+
endif()
5354

54-
# Only fetch and build sqlite3 if it hasn't been added yet
55-
if (NOT TARGET sqlite3)
5655
FetchContent_MakeAvailable(sqlite3)
5756

5857
add_library(sqlite3 SHARED "sqlite3_flutter.c")

0 commit comments

Comments
 (0)