Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows linker error SQLite3 #1263

Open
adamski opened this issue Jan 12, 2024 · 3 comments
Open

Windows linker error SQLite3 #1263

adamski opened this issue Jan 12, 2024 · 3 comments

Comments

@adamski
Copy link

adamski commented Jan 12, 2024

I'm trying to integrate into a Windows CMake build and currently blocked as I can't seem to link it.

-- CPM: adding package [email protected] (v1.8.2)
-- SQLITE_ORM: Build with C++14 features
-- Configuring sqlite_orm 1.8.0
-- Found SQLite3: C:/Users/Adam/dev/source/sayit/CoreLibrary/cmake-build-release/_deps/sqlite3-src (found version "3.42.0") 
CMake Error at C:/Users/Adam/AppData/Local/Programs/CLion Nova/bin/cmake/win/x64/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find SQLite3 (missing: SQLite3_INCLUDE_DIR SQLite3_LIBRARY)

I'm doing this to create the static lib but it does not seem to be creating it:


FetchContent_Declare(sqlite3 URL https://www.sqlite.org/2023/sqlite-amalgamation-3420000.zip)
if (NOT sqlite3_POPULATED)
      # notice that we do not call `add_subdirectory`, we simply fetch and then
      # use the subdirectory sources directly.
      FetchContent_Populate(sqlite3)
endif ()

add_library(sqlite3 STATIC
      ${sqlite3_SOURCE_DIR}/sqlite3.c
      ${sqlite3_SOURCE_DIR}/sqlite3ext.h
)
@adamski
Copy link
Author

adamski commented Jan 12, 2024

Fixed it - the sqlite.lib was being built I just needed to find and point to the location:

FetchContent_Declare(sqlite3 URL https://www.sqlite.org/2023/sqlite-amalgamation-3420000.zip)
if (NOT sqlite3_POPULATED)
        # notice that we do not call `add_subdirectory`, we simply fetch and then
        # use the subdirectory sources directly.
        FetchContent_Populate(sqlite3)
endif ()

add_library(sqlite3 STATIC
        ${sqlite3_SOURCE_DIR}/sqlite3.c
        ${sqlite3_SOURCE_DIR}/sqlite3ext.h
)


set (SQLite3_INCLUDE_DIR ${sqlite3_SOURCE_DIR})
set (SQLite3_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/sqlite3.lib)

@trueqbit
Copy link
Collaborator

@adamski Is it a problem related to sqlite_orm?

@adamski
Copy link
Author

adamski commented Jan 17, 2024

@trueqbit I think its due to how sqlite_orm depends on sqlite. It might be good to add this as an example for building and linking with a local sqlite lib rather than a system installed version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants