# CMakeLists.txt # # Description: cmake file for dagreater_pg psql database bindings for GREAT-ER # # Authors: # Andre Heinecke # # Copyright: # Copyright (C) 2011 by Intevation GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2, # or, at your option, any later version as published by the Free # Software Foundation # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. project(dagreater_pg) cmake_minimum_required(VERSION 2.6) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(CMAKE_DAGREATER_PG_VERSION_MAJOR 1) set(CMAKE_DAGREATER_PG_VERSION_MINOR 9) set(CMAKE_DAGREATER_PG_VERSION_PATCH 0) set(CMAKE_DAGREATER_PG_VERSION_STRING "${CMAKE_DAGREATER_PG_VERSION_MAJOR}.${CMAKE_DAGREATER_PG_VERSION_MINOR}.${CMAKE_DAGREATER_PG_VERSION_PATCH}") option(DAGERATER_ENABLE_TESTS "Enable tests" OFF) option(DAGREATER_DEBUG "Add debug output" OFF) if (DAGREATER_ENABLE_TESTS) message(STATUS "Testing is not yet implemented from cmake") add_subdirectory(tests) endif (DAGREATER_ENABLE_TESTS) find_package(Postgresql REQUIRED) find_package(PythonLibs) find_program(ECPG_EXECUTABLE ecpg REQUIRED) if (NOT ECPG_EXECUTABLE) message(ERROR "Embedded psql precompiler not found!") endif() if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(/we4700) endif() if (DAGREATER_DEBUG) add_definitions(-DDEBUG_MODE_ON=1) endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${POSTGRESQL_INCLUDE_DIR}) set(dagreater_pg_SRCS dagreater_pg.c gdagreater_pg.c daexplib_pg.h dagreater_pg.h gdaexplib_pg.h ) install(FILES daexplib_pg.h dagreater_pg.h datypes_pg.h gdaexplib_pg.h DESTINATION include/dagreater COMPONENT Devel ) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dagreater_pg.c COMMAND ${ECPG_EXECUTABLE} -o ${CMAKE_CURRENT_BINARY_DIR}/dagreater_pg.c ${CMAKE_CURRENT_SOURCE_DIR}/dagreater_pg.pgc DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dagreater_pg.pgc ) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gdagreater_pg.c COMMAND ${ECPG_EXECUTABLE} -o ${CMAKE_CURRENT_BINARY_DIR}/gdagreater_pg.c ${CMAKE_CURRENT_SOURCE_DIR}/gdagreater_pg.pgc DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gdagreater_pg.pgc ) add_library(dagreater_pg SHARED ${dagreater_pg_SRCS}) target_link_libraries(dagreater_pg ${POSTGRESQL_LIBRARIES} ${ECPG_LIBRARIES}) set_target_properties(dagreater_pg PROPERTIES VERSION ${CMAKE_DAGREATER_PG_VERSION_STRING} SOVERSION ${CMAKE_DAGREATER_PG_VERSION_MAJOR} LINK_INTERFACE_LIBRARIES "" DEFINE_SYMBOL DAGREATER_PG_MAKEDLL ) install(TARGETS dagreater_pg ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX} LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)