Warning, /sdk/codevis/thirdparty/soci/cmake/SociDependencies.cmake is written in an unsupported language. File is not indexed.
0001 ################################################################################
0002 # SociDependencies.cmake - part of CMake configuration of SOCI library
0003 #
0004 # Based on BoostExternals.cmake from CMake configuration for Boost
0005 ################################################################################
0006 # Copyright (C) 2010 Mateusz Loskot <mateusz@loskot.net>
0007 # Copyright (C) 2009 Troy Straszheim
0008 #
0009 # Distributed under the Boost Software License, Version 1.0.
0010 # (See accompanying file LICENSE_1_0.txt or copy at
0011 # http://www.boost.org/LICENSE_1_0.txt)
0012 ################################################################################
0013 # Macros in this module:
0014 #
0015 # soci_backend - defines a database backend for SOCI library
0016 #
0017 ################################################################################
0018
0019 #
0020 # List of SOCI dependncies
0021 #
0022 set(SOCI_CORE_DEPENDENCIES
0023 Threads
0024 )
0025
0026 set(SOCI_BACKENDS_DB_DEPENDENCIES
0027 MySQL
0028 ODBC
0029 Oracle
0030 PostgreSQL
0031 SQLite3
0032 Firebird
0033 DB2)
0034
0035 set(SOCI_ALL_DEPENDENCIES
0036 ${SOCI_CORE_DEPENDENCIES}
0037 ${SOCI_BACKENDS_DB_DEPENDENCIES})
0038
0039 #
0040 # Perform checks
0041 #
0042 colormsg(_HIBLUE_ "Looking for SOCI dependencies:")
0043
0044 macro(boost_external_report NAME)
0045
0046 set(VARNAME ${NAME})
0047 string(TOUPPER ${NAME} VARNAMEU)
0048
0049 set(VARNAMES ${ARGV})
0050 list(REMOVE_AT VARNAMES 0)
0051
0052 # Test both, given original name and uppercase version too
0053 if(NOT ${VARNAME}_FOUND AND NOT ${VARNAMEU}_FOUND)
0054 colormsg(_RED_ "WARNING: ${NAME} libraries not found, some features will be disabled.")
0055 endif()
0056
0057 foreach(variable ${VARNAMES})
0058 if(${VARNAMEU}_FOUND)
0059 boost_report_value(${VARNAMEU}_${variable})
0060 elseif(${VARNAME}_FOUND)
0061 boost_report_value(${VARNAME}_${variable})
0062 endif()
0063 endforeach()
0064 endmacro()
0065
0066 #
0067 # Some externals default to OFF
0068 #
0069 option(WITH_VALGRIND "Run tests under valgrind" OFF)
0070
0071 #
0072 # Detect available dependencies
0073 #
0074 foreach(external ${SOCI_ALL_DEPENDENCIES})
0075 string(TOUPPER "${external}" EXTERNAL)
0076
0077 # For historical reasons we use both WITH_xxx and SOCI_xxx options, and
0078 # setting either of them to e.g. OFF should disable the corresponding
0079 # dependency.
0080 option(WITH_${EXTERNAL} "Attempt to find and configure ${external}" ON)
0081 option(SOCI_${EXTERNAL} "Attempt to build ${external} backend" ON)
0082
0083 if(NOT WITH_${EXTERNAL})
0084 set(disabled_var "WITH")
0085 elseif(NOT SOCI_${EXTERNAL})
0086 set(disabled_var "SOCI")
0087 endif()
0088
0089 if(NOT DEFINED disabled_var)
0090 colormsg(HICYAN "${external}:")
0091 include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/dependencies/${external}.cmake)
0092 else()
0093 set(${EXTERNAL}_FOUND FALSE CACHE BOOL "${external} found" FORCE)
0094 colormsg(HICYAN "${external}:" YELLOW "disabled, since ${disabled_var}_${EXTERNAL}=OFF")
0095 unset(disabled_var)
0096 endif()
0097
0098 if(NOT ${EXTERNAL}_FOUND)
0099 set(SOCI_${EXTERNAL} OFF)
0100 endif()
0101 endforeach()