This is a small C++ Hello World
program testing a project build using CMake as build generator with integrated conan.io package manager consuming (using and linking) with SQLite3 library.
The C++ program main.cpp itself is trivial:
#include <iostream>
#include <sqlite3.h>
int main()
{
std::cout << "Hello World!" << std::endl;
std::cout << "SQLite3 version " << sqlite3_libversion() << std::endl;
return 0; // Success
}
- CMake, see how to install.
- conan.io package manager, see how to install.
- A C++ compiler
How to build - on Mac OS X and *nix:
First establish out-of-source build/
folder, so that source folder is not polluted:
$ mkdir build
$ cd build
Initialize your project with conan - this is using the conanfile.txt specifying that SQLite (v3.15.2) is an dependency and that conan should integrate with CMake:
$ conan install ..
💡 If you see error Try to build from source with --build then do the following to build the actual SQLite library from its source:
$ conan install --build SQLite3
Generate the build files using CMake:
$ cmake ..
Build the project:
$ make
If everything went successfully, you can run the built executable:
$ bin/mytest
Expected output:
Hello World!
SQLite version 3.15.2