aboutsummaryrefslogtreecommitdiff
path: root/data/generate_proj_db.cmake
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-03-26 12:49:35 +0100
committerGitHub <noreply@github.com>2021-03-26 12:49:35 +0100
commit14ce3d9fa8700b4c0aa035c86a7e55af905dbf28 (patch)
treeddddb044f8eaaa9c7f0b49cb03f049c24a1a76f3 /data/generate_proj_db.cmake
parent969ae0712c45b176c3097f5f7e3e5aeb4873c878 (diff)
downloadPROJ-14ce3d9fa8700b4c0aa035c86a7e55af905dbf28.tar.gz
PROJ-14ce3d9fa8700b4c0aa035c86a7e55af905dbf28.zip
Build: simplify proj.db generation (#2605)
- change foreign key check, so that it is enabled outside of the transaction where we insert things, and can make the sqlite3 process fail in case of violations, without the postcheck done in the autoconf build - autoconf and cmake builds: simplification related to the above (which also means that cmake builds now have the fkey check, which was omitted until now)
Diffstat (limited to 'data/generate_proj_db.cmake')
-rw-r--r--data/generate_proj_db.cmake18
1 files changed, 18 insertions, 0 deletions
diff --git a/data/generate_proj_db.cmake b/data/generate_proj_db.cmake
new file mode 100644
index 00000000..734dbe1e
--- /dev/null
+++ b/data/generate_proj_db.cmake
@@ -0,0 +1,18 @@
+function(cat IN_FILE OUT_FILE)
+ file(READ ${IN_FILE} CONTENTS)
+ file(APPEND ${OUT_FILE} "${CONTENTS}")
+endfunction()
+
+file(WRITE "${ALL_SQL_IN}" "")
+include(sql_filelist.cmake)
+foreach(SQL_FILE ${SQL_FILES})
+ cat(${SQL_FILE} "${ALL_SQL_IN}")
+endforeach()
+
+execute_process(COMMAND "${EXE_SQLITE3}" "${PROJ_DB}"
+ INPUT_FILE "${ALL_SQL_IN}"
+ RESULT_VARIABLE STATUS)
+
+if(STATUS AND NOT STATUS EQUAL 0)
+ message(FATAL_ERROR "SQLite3 failed")
+endif()