1 diff -r 6d5130e4ae52 sqlite/CMakeLists.txt
2 --- a/sqlite/CMakeLists.txt Sun Sep 10 18:53:00 2017 +0200
3 +++ b/sqlite/CMakeLists.txt Fri Sep 15 00:12:11 2017 -0700
5 cmake_minimum_required( VERSION 2.4 )
7 -# [BB/EP] Download SQLite archive and extract the sources if necessary.
8 -set( ZAN_SQLITE_VERSION 3180000 ) # SQL version 3.18.0
9 -set( ZAN_SQLITE_YEAR 2017 )
10 -set( ZAN_SQLITE_SHA1 "74559194e1dd9b9d577cac001c0e9d370856671b" )
11 -set( ZAN_SQLITE_DOWNLOAD_NAME "sqlite-autoconf-${ZAN_SQLITE_VERSION}" )
12 -set( ZAN_SQLITE_TEMP_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}.tar.gz" )
13 -set( ZAN_SQLITE_HASHED_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/sqlite-${ZAN_SQLITE_SHA1}.tar.gz" )
15 -if( IS_DIRECTORY ${ZAN_SQLITE_HASHED_ARCHIVE} OR IS_SYMLINK ${ZAN_SQLITE_HASHED_ARCHIVE} )
16 - message( FATAL_ERROR "SQLite: ${ZAN_SQLITE_HASHED_ARCHIVE} must be a valid file.\n"
17 - "SQLite: Please remove it and try again." )
18 -elseif( NOT EXISTS ${ZAN_SQLITE_HASHED_ARCHIVE} )
20 - if( IS_DIRECTORY ${ZAN_SQLITE_TEMP_ARCHIVE} OR IS_SYMLINK ${ZAN_SQLITE_TEMP_ARCHIVE} )
21 - message( FATAL_ERROR "SQLite: ${ZAN_SQLITE_TEMP_ARCHIVE} must be a valid file.\n"
22 - "SQLite: Please remove it and try again." )
24 - message( STATUS "SQLite: downloading the archive..." )
26 - file( DOWNLOAD https://www.sqlite.org/${ZAN_SQLITE_YEAR}/${ZAN_SQLITE_DOWNLOAD_NAME}.tar.gz ${ZAN_SQLITE_TEMP_ARCHIVE}
28 - STATUS ZAN_SQLITE_DOWNLOAD_STATUS )
30 - # Report any problem if present and abort immediately.
31 - list( GET ZAN_SQLITE_DOWNLOAD_STATUS 0 ZAN_SQLITE_DOWNLOAD_ERROR_CODE )
32 - if( ZAN_SQLITE_DOWNLOAD_ERROR_CODE )
33 - list( GET ZAN_SQLITE_DOWNLOAD_STATUS 1 ZAN_SQLITE_DOWNLOAD_ERROR_MESSAGE )
34 - message( FATAL_ERROR "SQLite: download failed. Reason: ${ZAN_SQLITE_DOWNLOAD_ERROR_MESSAGE}" )
37 - # Check the hash. Abort immediately if it's not valid (something is wrong with the download)
38 - file( SHA1 ${ZAN_SQLITE_TEMP_ARCHIVE} ZAN_SQLITE_CURRENT_SHA1 )
39 - if( NOT ZAN_SQLITE_CURRENT_SHA1 STREQUAL ZAN_SQLITE_SHA1 )
40 - message( FATAL_ERROR "SQLite: download failed. The downloaded file has a different hash:\n"
41 - "SQLite: valid: ${ZAN_SQLITE_SHA1}\n"
42 - "SQLite: downloaded: ${ZAN_SQLITE_CURRENT_SHA1}" )
45 - message( STATUS "SQLite: saving the source files into the 'sqlite' directory." )
47 - # Rename the archive.
48 - execute_process( COMMAND ${CMAKE_COMMAND} -E rename ${ZAN_SQLITE_TEMP_ARCHIVE} ${ZAN_SQLITE_HASHED_ARCHIVE} )
50 - # Extract the archive.
51 - execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf ${ZAN_SQLITE_HASHED_ARCHIVE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
53 - # Copy the required files.
54 - execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}/sqlite3.c ${CMAKE_CURRENT_SOURCE_DIR} )
55 - execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}/sqlite3.h ${CMAKE_CURRENT_SOURCE_DIR} )
56 - execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}/sqlite3ext.h ${CMAKE_CURRENT_SOURCE_DIR} )
58 - # Remove the extracted folder.
59 - execute_process( COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME} )
61 - message( STATUS "SQLite: done." )
64 add_library( sqlite3 sqlite3.c )
65 target_link_libraries( sqlite3 ${CMAKE_DL_LIBS} )