2016-09-19 11:50:08 +08:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(sqlite3 C)
|
|
|
|
|
2018-02-28 04:24:41 +08:00
|
|
|
include_directories(.)
|
2016-10-19 04:09:04 +08:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
set(API "-DSQLITE_API=__declspec(dllexport)")
|
|
|
|
else()
|
|
|
|
set(API "-DSQLITE_API=extern")
|
|
|
|
endif()
|
2018-02-28 04:24:41 +08:00
|
|
|
add_library(sqlite3 sqlite3.c)
|
2016-10-19 04:09:04 +08:00
|
|
|
|
2016-10-19 04:01:48 +08:00
|
|
|
target_compile_definitions(sqlite3 PRIVATE
|
2016-10-19 04:09:04 +08:00
|
|
|
$<$<CONFIG:Debug>:-DSQLITE_DEBUG>
|
|
|
|
${API}
|
2016-10-19 04:01:48 +08:00
|
|
|
-DSQLITE_ENABLE_RTREE
|
|
|
|
-DSQLITE_ENABLE_UNLOCK_NOTIFY
|
|
|
|
)
|
2016-10-19 12:42:21 +08:00
|
|
|
target_include_directories(sqlite3 INTERFACE $<INSTALL_INTERFACE:include>)
|
2016-12-07 02:08:15 +08:00
|
|
|
|
2018-02-28 04:24:41 +08:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
|
2016-09-19 11:50:08 +08:00
|
|
|
target_compile_definitions(sqlite3 PRIVATE -DSQLITE_OS_WINRT=1)
|
|
|
|
endif()
|
|
|
|
|
2018-02-28 04:24:41 +08:00
|
|
|
if(NOT SQLITE3_SKIP_TOOLS)
|
|
|
|
add_executable(sqlite3-bin shell.c)
|
|
|
|
set_target_properties(sqlite3-bin PROPERTIES OUTPUT_NAME sqlite3)
|
|
|
|
target_link_libraries(sqlite3-bin PRIVATE sqlite3)
|
|
|
|
install(TARGETS sqlite3-bin sqlite3 RUNTIME DESTINATION tools)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
install(TARGETS sqlite3 EXPORT sqlite3Config
|
2016-09-19 11:50:08 +08:00
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
)
|
2018-02-28 04:24:41 +08:00
|
|
|
|
|
|
|
install(FILES sqlite3.h sqlite3ext.h DESTINATION include CONFIGURATIONS Release)
|
|
|
|
install(EXPORT sqlite3Config DESTINATION share/sqlite3)
|