Skip to content

Commit

Permalink
cmake: updated backends build
Browse files Browse the repository at this point in the history
  • Loading branch information
snikulov committed Sep 28, 2012
1 parent d80b622 commit 7b8baed
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
38 changes: 31 additions & 7 deletions src/backends/CMakeLists.txt
@@ -1,9 +1,33 @@
colormsg(_HIBLUE_ "Configuring SOCI database backends:")

# TODO: Scan and add directories automatically --mloskot
add_subdirectory(empty)
add_subdirectory(mysql)
add_subdirectory(odbc)
add_subdirectory(oracle)
add_subdirectory(postgresql)
add_subdirectory(sqlite3)
# First, we'll investigate what can be found from database engines
foreach(dep ${SOCI_BACKENDS_DB_DEPENDENCIES})
string(TOUPPER ${dep} depUP)
find_package(${dep})
if(${dep}_FOUND OR ${depUP}_FOUND)
set(${depUP}_FOUND ON)
else()
set(${depUP}_FOUND OFF)
endif()
endforeach()

# get all files in backends
file(GLOB backend_dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)

# empty backend always on by default
set(EMPTY_FOUND ON)

# enable only found backends
foreach(dir ${backend_dirs})
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${dir})
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/CMakeLists.txt)
string(TOUPPER ${dir} dirUP)
if(${dirUP}_FOUND)
add_subdirectory(${dir})
message("added backend: ${dir}")
endif()
endif()
endif()
endforeach()

message(STATUS "")
7 changes: 5 additions & 2 deletions src/cmake/SociDependencies.cmake
Expand Up @@ -19,14 +19,17 @@
#
# List of SOCI dependncies
#
set(SOCI_BACKENDS_ALL_DEPENDENCIES
Boost
set(SOCI_BACKENDS_DB_DEPENDENCIES
MySQL
ODBC
Oracle
PostgreSQL
SQLite3)

set(SOCI_BACKENDS_ALL_DEPENDENCIES
Boost
${SOCI_BACKENDS_DB_DEPENDENCIES})

#
# Perform checks
#
Expand Down

0 comments on commit 7b8baed

Please sign in to comment.