drogonframework / drogonframework/drogon
fix drogon with sqlite on conan
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 15
Description
**Describe the bug**
drogon cannot be built with wit sqlite support using the official conan recipe. A PR with the fix is placed [conan-center-index](https://github.com/conan-io/conan-center-index/pull/15233) but awaits approval. The issue is the custom [FindSQLite3.cmake](https://github.com/drogonframework/drogon/blob/master/cmake_modules/FindSQLite3.cmake) which is not used in the conan case and therefore the target `SQLite3_lib` is not created and thus not properly linking to sqlite3.
**To Reproduce**
Steps to reproduce the behavior:
1. install dependencies with conan: `conan install -r conancenter -pr:b default -b missing ..`
2. See error
Show build output
```bash
In file included from ~/.conan/data/drogon/1.8.2/_/_/build/29b7a10fab013440ab3aa45962e0ad849f6963d8/src/orm_lib/src/sqlite3_impl/Sqlite3Connection.h:18,
from ~/.conan/data/drogon/1.8.2/_/_/build/29b7a10fab013440ab3aa45962e0ad849f6963d8/src/orm_lib/src/sqlite3_impl/Sqlite3Connection.cc:15:
~/.conan/data/drogon/1.8.2/_/_/build/29b7a10fab013440ab3aa45962e0ad849f6963d8/src/orm_lib/src/sqlite3_impl/Sqlite3ResultImpl.h:19:10: fatal error: sqlite3.h: No such file or directory
19 | #include
| ^~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/drogon.dir/build.make:692: CMakeFiles/drogon.dir/orm_lib/src/sqlite3_impl/Sqlite3Connection.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:102: CMakeFiles/drogon.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
```
**Expected behavior**
A successfully built and installed package
**Additional context**
conan recipe
```python
from conan import ConanFile
class Recipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
default_options = {
"drogon:with_ctl": True,
"drogon:with_orm": True,
"drogon:with_sqlite": True,
}
def layout(self):
self.folders.generators = "conan"
def requirements(self):
self.requires("fmt/9.0.0")
self.requires("drogon/1.8.2")
def build_requirements(self):
self.test_requires("catch2/3.0.1")
def imports(self):
self.copy("drogon_ctl",dst="packages/bin",src="bin", root_package="drogon")
```
Contributor guide
Assessment
This issue has not been assessed yet.