title: Testing the MariaDB shared library using CMake
body: <p>I have built MariaDB 10.0.15 from source (with the WITH_EMBEDDED_SERVER flag) and would like to test its shared library using a simple program. I'm a total beginner with CMake.</p>
  
  <p>My program is the following one :</p>
  
  <pre><code>#include &lt;my_global.h&gt;
  #include &lt;mysql.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(int argc, char **argv)
  {
      MYSQL *con = mysql_init(NULL);
  
      if (con == NULL)
      {
          fprintf(stderr, "%s\n", mysql_error(con));
          exit(1);
      }
  
      if (mysql_real_connect(con, "localhost", "root", "root_pswd",
              NULL, 0, NULL, 0) == NULL)
      {
          fprintf(stderr, "%s\n", mysql_error(con));
          mysql_close(con);
          exit(1);
      }
  
      if (mysql_query(con, "CREATE DATABASE testdb"))
      {
          fprintf(stderr, "%s\n", mysql_error(con));
          mysql_close(con);
          exit(1);
      }
  
      mysql_close(con);
      exit(0);
  }
  </code></pre>
  
  <p>I created the following CMakeLists.txt file :</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8.4)
  project(mariadb_simple_test)
  
  add_subdirectory(/usr/src/mariadb-10.0.15/libmysqld mariadb)
  
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  
  set(SOURCE_FILES main.cpp)
  add_executable(mariadb_simple_test ${SOURCE_FILES})
  </code></pre>
  
  <p>Is this the good way of doing it ? When trying to build it, CMake complains with the following error : <em>Unknown CMake command "ADD_CONVENIENCE_LIBRARY"</em>, which makes me think that some CMake module is probably missing, but why ?</p>