CMake tries to look for a file called "sqlite_ormConfig.cmake" or "sqlite_orm-config.cmake", however the actual file is called "SqliteOrmConfig.cmake", which leads to the error.
do you know how can it be fixed? I don't know cause I am not a cmake guru.
Head of dev works fine for me. Can't reproduce.
find_package(SqliteOrm REQUIRED)
add_executable(testprog "main.cpp")
target_link_libraries(testprog PRIVATE sqlite_orm::sqlite_orm)
Sample works fine in visual studio.
I believe the confusion comes from the difference in the package name, and the import name.
Not sure whether it's too late to change it now without breaking everyone's workflows.
Maybe an additional bit of documentation will be sufficient.
@undisputed-seraphim thanks for your help. Can you write here an example of text for readme please? It would be very helpful cause I don't use cmake.
I merged it. Thanks. @nfarid is the issue actual?
find_package does work when using the library built from the dev branch. This is because the cmake script will install the cmake config file as cmake/SqliteOrm/SqliteOrmConfig.cmake.
So find_package(SqliteOrm) will work.
However when building from the master branch, the cmake script will install the cmake config as cmake/sqlite_orm/SqliteOrmConfig.cmake.
https://github.com/fnc12/sqlite_orm/blob/master/build/cmake/GenerateConfigModule.cmake#L10
find_package(sqlite_orm) will search for sqlite_orm/sqlite_ormConfig.cmake
find_package(SqliteOrm) will search for SqliteOrm/SqliteOrmConfig.cmake
Neither will work, as neither finds sqlite_orm/SqliteOrmConfig.cmake.
Overall, the issue only exists in the master branch, which was caused by the mixture of snake_case and PascalCase in the outdated cmake script.
This is because I updated the cmake code recently to work properly, will be resolved as soon as the master code is merged I believe. See https://github.com/fnc12/sqlite_orm/pull/572
Also there are examples in the examples folder as described in the docs. I did reference the example rather than putting the example directly in the readme, so changes have to be done only in one place rather than in two.
Glad to hear that. This can be closed.
Most helpful comment
This is because I updated the cmake code recently to work properly, will be resolved as soon as the master code is merged I believe. See https://github.com/fnc12/sqlite_orm/pull/572
Also there are examples in the examples folder as described in the docs. I did reference the example rather than putting the example directly in the readme, so changes have to be done only in one place rather than in two.