oatpp / example-crud

A complete example of a "CRUD" service (UserService) built with Oat++.

Home Page:https://oatpp.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Configure fails, all dependencies installed.

acidtonic opened this issue · comments

commented

Gentoo Linux, gcc 9.3.0, cmake 3.16.5

installed oat++
installed oat-swagger
installed oat-sqlite

Cloned this repo

$ mkdir build
$ cd build
$ cmake ..
-- Configuring done
CMake Error at CMakeLists.txt:56 (add_executable):
  Target "crud-exe" links to target "SQLite::SQLite3" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:6 (add_library):
  Target "crud-lib" links to target "SQLite::SQLite3" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:59 (add_executable):
  Target "crud-test" links to target "SQLite::SQLite3" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

Target "crud-exe" links to target "SQLite::SQLite3" but the target was not

It seems like you are missing the SQLite3 Library.

commented

I have sqlite3 installed, I use it in many of my C projects. Do I need a C++ Sqlite3 library? I see no dependency listed for that.

commented
/usr/include/sqlite3.h

$ pkg-config --libs sqlite3
-lsqlite3

What else is needed?

commented

Looks like the -DOATPP_SQLITE_AMALGAMATION=ON flag did not get applied as I typed it manually and had a typo.

Looks like that changes the flag from sqlite3 to Sqlite::Sqlite3 and that is what broke it, my apologies.

Hey @acidtonic ,

Just to summarize:

  • if -DOATPP_SQLITE_AMALGAMATION=ON then oatpp-sqlite will build and install the SQLite amalgamation together with oatpp-sqlite sources.
  • if -DOATPP_SQLITE_AMALGAMATION=OFF then oatpp-sqlite will rely on CMakes' 3.14 built-in FindSQLite3 script to find existing SQLite installation in your system.
-- Configuring done
CMake Error at CMakeLists.txt:6 (add_library):
  Target "crud-lib" links to target "SQLite::SQLite3" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:70 (add_executable):
  Target "crud-exe" links to target "SQLite::SQLite3" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:73 (add_executable):
  Target "crud-test" links to target "SQLite::SQLite3" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

how to solve ?

############################################################################

Flag '-DOATPP_SQLITE_AMALGAMATION=ON' used by oatpp-sqlite module only

############################################################################
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DOATPP_BUILD_TESTS=OFF -DOATPP_SQLITE_AMALGAMATION=ON ..
make install -j $NPROC

cd ../../

-- Configuring done
CMake Error at CMakeLists.txt:6 (add_library):
  Target "crud-lib" links to target "SQLite::SQLite3" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:70 (add_executable):
  Target "crud-exe" links to target "SQLite::SQLite3" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:73 (add_executable):
  Target "crud-test" links to target "SQLite::SQLite3" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

how to solve ?

############################################################################

Flag '-DOATPP_SQLITE_AMALGAMATION=ON' used by oatpp-sqlite module only

############################################################################
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DOATPP_BUILD_TESTS=OFF -DOATPP_SQLITE_AMALGAMATION=ON ..
make install -j $NPROC

cd ../../