configuratio fixes

This commit is contained in:
Vítor Santos Costa
2015-02-17 20:26:46 +00:00
parent d805a474a4
commit 291ec26d65
9 changed files with 221 additions and 80 deletions

View File

@@ -2,6 +2,8 @@
set( MYDDAS_SOURCES
myddas_mysql.c
myddas_odbc.c
myddas_postgres.c
myddas_sqlite3.c
myddas_util.c
myddas_initialization.c
myddas_shared.c
@@ -13,6 +15,8 @@ set( MYDDAS_PROLOG
pl/myddas.ypp
pl/myddas_assert_predicates.ypp
pl/myddas_mysql.ypp
pl/myddas_sqlite3.ypp
pl/myddas_postgres.ypp
pl/myddas_top_level.ypp
pl/myddas_errors.ypp
pl/myddas_prolog2sql.ypp
@@ -39,6 +43,7 @@ source_group(generated FILES ${GENERATED_SOURCES})
macro_optional_find_package(ODBC ON)
macro_optional_find_package(MySQL ON)
macro_optional_find_package(Sqlite3 ON)
macro_optional_find_package(PostgreSQL ON)
macro_log_feature (ODBC_FOUND "ODBC"
"Use ODBC Data-Base Interface "
@@ -48,11 +53,15 @@ macro_log_feature (MYSQL_FOUND "MySQL"
"Use MYSQL Data-Base Interface "
"http://www.mysql.org" FALSE)
macro_log_feature (SQLITE3_FOUND "SQLite3"
"SQL Light Data-Base "
"http://www.sqlite3.org" FALSE)
macro_log_feature (SQLITE3_FOUND "SQLite3"
"SQL Light Data-Base "
"http://www.sqlite3.org" FALSE)
if (ODBC_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND)
macro_log_feature (PostgreSQL_FOUND "PostgreSQL"
"PostgreSQL Data-Base "
"http://www.postgresql.org" FALSE)
if (ODBC_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND OR PostgreSQL_FOUND)
add_definitions (-DUSE_MYDDAS=1)
add_library (myddas SHARED ${MYDDAS_SOURCES})
target_link_libraries(myddas libYap)
@@ -66,14 +75,13 @@ if (ODBC_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND)
endif (ODBC_FOUND)
if (SQLITE3_FOUND)
# SQLITE3_INCLUDE_DIR - Where to find Sqlite 3 header files (directory)
# SQLITE3_LIBRARIES - Sqlite 3 libraries
# SQLITE3_LIBRARY_RELEASE - Where the release library is
# SQLITE3_LIBRARY_DEBUG - Where the debug library is
# SQLITE3_FOUND - Set to TRUE if we found everything (library, includes and executable)
add_definitions (-DMYDDAS_SQLITE3=1)
target_link_libraries(myddas ${SQLITE3_LIBRARIES})
include_directories (${SQLITE3_INCLUDE_DIR})
# SQLITE3_FOUND - system has Sqlite3
# SQLITE3_INCLUDE_DIRS - the Sqlite3 include directory
# SQLITE3_LIBRARIES - Link these to use Sqlite3
# SQLITE3_DEFINITIONS - Compiler switches required for using Sqlite3
add_definitions (-DMYDDAS_SQLITE3=1)
target_link_libraries(myddas ${SQLITE3_LIBRARIES})
include_directories (${SQLITE3_INCLUDE_DIRS})
endif (SQLITE3_FOUND)
if (MYSQL_FOUND)
@@ -85,6 +93,15 @@ if (ODBC_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND)
include_directories (${MYSQL_INCLUDE_DIR})
endif (MYSQL_FOUND)
if (PostgreSQL_FOUND)
# PostgreSQL_INCLUDE_DIRS - Include directories for PostgreSQL
# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries
# PostgreSQL_LIBRARIES - The PostgreSQL libraries.
add_definitions (-DMYDDAS_POSTGRES=1)
target_link_libraries(myddas ${PostgreSQL_LIBRARIES})
include_directories (${MYSQL_INCLUDE_DIRS})
endif (PostgreSQL_FOUND)
add_custom_target (plmyddas ALL DEPENDS ${GENERATED_SOURCES} ) # WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
endif (ODBC_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND)