CMakeLists.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Copyright (c) 2008-2023 the Urho3D project
  2. # License: MIT
  3. # Define target name
  4. set (TARGET_NAME sqlite)
  5. # Define preprocessor macros
  6. add_definitions (-DSQLITE_USE_URI=1 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_SOUNDEX) # https://www.sqlite.org/compile.html
  7. if (WEB)
  8. # Do not use pthread and dl libraries for Web platform
  9. add_definitions (-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION)
  10. elseif (MINGW)
  11. # We only support MinGW with "_mingw.h" header file, note the leading underscore
  12. add_definitions (-D_HAVE__MINGW_H)
  13. endif ()
  14. foreach (VAR HAVE_STDINT_H HAVE_INTTYPES_H HAVE_MALLOC_H HAVE_MALLOC_USABLE_SIZE)
  15. if (${VAR})
  16. add_definitions (-D${VAR})
  17. endif ()
  18. endforeach ()
  19. # Define source files
  20. set (SOURCE_FILES src/sqlite3.c)
  21. # Setup target
  22. setup_library ()
  23. # Install headers for building and using the Urho3D library
  24. install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/SQLite FILES_MATCHING PATTERN *.h) # Note: the trailing slash is significant
  25. # Setup additional SQLite CLI standalone target (this target can be transfered and executed on an embedded device, such as Raspberry Pi and Android)
  26. if (NOT IOS AND NOT TVOS AND NOT WEB)
  27. # Define target name for SQLite shell
  28. set (TARGET_NAME sqlite3)
  29. # Define source files
  30. set (SOURCE_FILES src/shell.c src/sqlite3.c src/sqlite3.h)
  31. # Define dependency libs
  32. if (NOT WIN32)
  33. set (LIBS dl)
  34. if (READLINE_FOUND)
  35. add_definitions (-DHAVE_READLINE)
  36. list (APPEND INCLUDE_DIRS ${READLINE_INCLUDE_DIRS})
  37. list (APPEND LIBS ${READLINE_LIBRARIES})
  38. endif ()
  39. endif ()
  40. # Setup target
  41. setup_executable (NODEPS)
  42. endif ()
  43. # SQLite will not work correctly with the -ffast-math option, so unset it in this scope only
  44. string (REPLACE -ffast-math "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") # Stringify for string replacement