summaryrefslogtreecommitdiffstats
path: root/Tests/FindPostgreSQL/Test/main.c
blob: 2cfeed0da2b279f0bafc89ae701a834cc8995c92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <libpq-fe.h>
#include <stdio.h>
#include <string.h>

int main()
{
  int version = PQlibVersion();
  int major = version / 10000;
  int minor = version % 10000;
  char version_string[100];
  snprintf(version_string, sizeof(version_string), "%d.%d", major, minor);
  printf("Found PostgreSQL version %s, expected version %s\n", version_string,
         CMAKE_EXPECTED_POSTGRESQL_VERSION);
  return strcmp(version_string, CMAKE_EXPECTED_POSTGRESQL_VERSION);
}