Linker error with CMake
<p>I'm using JetBrains CLion for pure C (C ANSI) development, I know it's target is C++, but my company works only with C and
CLion uses only CMake as build system.</p>

<p>My system is a Debian Jessie system and sqlite3 and libsqlite3-dev are installed.</p>

<p>I'm trying to build a simple sqlite3 project like this:</p>

<pre><code>#include &lt;sqlite3.h&gt;
#include &lt;stdio.h&gt;

    int main() {
    sqlite3 *sqlConnection;
    int ret;
    ret = sqlite3_open("database/path.db, &amp;sqlConnection);
    if (ret) {
        printf("Ups ... can't open %d", ret);
    }
    do_some_queries(sqlConnection);
    return 0;
}
</code></pre>

<p>The automatic generated CMakeLists.txt is the follwing.</p>

<pre><code>cmake_minimum_required(VERSION 3.3)


project(Project)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp )
add_executable(Project ${SOURCE_FILES})
</code></pre>

<p>When build, either through Clion, either through command line, I get linker errors:</p>

<pre><code>...
undefined reference to `sqlite3_prepare_v2'
undefined reference to `sqlite3_column_int'
undefined reference to `sqlite3_open'
...
</code></pre>

<p>I know I must point out to CMake where sqlite3 is, but I can't find a way of doing this. </p>

<p>"find_package" and "find_library" may do it, but I can't find how.</p>

<p>I've also found <a href="https://github.com/LuaDist/libsqlite3/blob/master/cmake/FindSQLite3.cmake" rel="nofollow">this Cmake file</a>, but could not used successfully.</p>

<p>So, how do I integrate sqlite3 with Cmake ?</p>