Commit e8534f0c authored by nicolas's avatar nicolas
Browse files

enhance findSoci.cmake + respect cmake variables naming convention

parent bf5715d5
...@@ -5,13 +5,10 @@ ...@@ -5,13 +5,10 @@
# #
# This module defines: # This module defines:
# SOCI_INCLUDE_DIRS = include dirs to be used when using the soci library # SOCI_INCLUDE_DIRS = include dirs to be used when using the soci library
# SOCI_LIBRARY = full path to the soci library # SOCI_LIBRARIES = full path to the soci library
# SOCI_VERSION = the soci version found (not yet. soci does not provide that info.) # SOCI_VERSION = the soci version found (not yet. soci does not provide that info.)
# SOCI_FOUND = true if soci was found # SOCI_FOUND = true if soci was found
# #
# This module respects:
# LIB_SUFFIX = (64|32|"") Specifies the suffix for the lib directory
#
# For each component you specify in find_package(), the following variables are set. # For each component you specify in find_package(), the following variables are set.
# #
# SOCI_${COMPONENT}_PLUGIN = full path to the soci plugin # SOCI_${COMPONENT}_PLUGIN = full path to the soci plugin
...@@ -26,38 +23,32 @@ ...@@ -26,38 +23,32 @@
# #
### Global Configuration Section ### Global Configuration Section
# #
SET(_SOCI_ALL_PLUGINS mysql odbc postgresql sqlite3) SET(_SOCI_ALL_PLUGINS mysql sqlite3)
SET(_SOCI_REQUIRED_VARS SOCI_INCLUDE_DIR SOCI_LIBRARY) SET(_SOCI_REQUIRED_VARS SOCI_INCLUDE_DIRS SOCI_LIBRARIES)
# #
### FIRST STEP: Find the soci headers. ### FIRST STEP: Find the soci headers.
# #
FIND_PATH( FIND_PATH(SOCI_INCLUDE_DIRS soci.h
SOCI_INCLUDE_DIR soci.h PATH_SUFFIXES "soci"
PATH "/usr/local"
PATH_SUFFIXES "" "soci"
DOC "Soci (http://soci.sourceforge.net) include directory") DOC "Soci (http://soci.sourceforge.net) include directory")
MARK_AS_ADVANCED(SOCI_INCLUDE_DIR) MARK_AS_ADVANCED(SOCI_INCLUDE_DIRS)
SET(SOCI_INCLUDE_DIRS ${SOCI_INCLUDE_DIR})
# #
### SECOND STEP: Find the soci core library. Respect LIB_SUFFIX ### SECOND STEP: Find the soci core library. Respect LIB_SUFFIX
# #
FIND_LIBRARY( FIND_LIBRARY(SOCI_LIBRARIES
SOCI_LIBRARY
NAMES soci_core NAMES soci_core
HINTS ${SOCI_INCLUDE_DIR}/.. PATH_SUFFIXES lib lib64)
PATH_SUFFIXES lib${LIB_SUFFIX}) MARK_AS_ADVANCED(SOCI_LIBRARIES)
MARK_AS_ADVANCED(SOCI_LIBRARY)
GET_FILENAME_COMPONENT(SOCI_LIBRARY_DIR ${SOCI_LIBRARY} PATH) GET_FILENAME_COMPONENT(SOCI_LIBRARY_DIR ${SOCI_LIBRARIES} PATH)
MARK_AS_ADVANCED(SOCI_LIBRARY_DIR) MARK_AS_ADVANCED(SOCI_LIBRARY_DIR)
# #
### THIRD STEP: Find all installed plugins if the library was found ### THIRD STEP: Find all installed plugins if the library was found
# #
IF(SOCI_INCLUDE_DIR AND SOCI_LIBRARY) IF(SOCI_INCLUDE_DIRS AND SOCI_LIBRARIES)
MESSAGE(STATUS "Soci found: Looking for plugins") MESSAGE(STATUS "Soci found: Looking for plugins")
FOREACH(plugin IN LISTS _SOCI_ALL_PLUGINS) FOREACH(plugin IN LISTS _SOCI_ALL_PLUGINS)
...@@ -65,8 +56,7 @@ IF(SOCI_INCLUDE_DIR AND SOCI_LIBRARY) ...@@ -65,8 +56,7 @@ IF(SOCI_INCLUDE_DIR AND SOCI_LIBRARY)
FIND_LIBRARY( FIND_LIBRARY(
SOCI_${plugin}_PLUGIN SOCI_${plugin}_PLUGIN
NAMES soci_${plugin} NAMES soci_${plugin}
HINTS ${SOCI_INCLUDE_DIR}/.. PATH_SUFFIXES lib lib64)
PATH_SUFFIXES lib${LIB_SUFFIX})
MARK_AS_ADVANCED(SOCI_${plugin}_PLUGIN) MARK_AS_ADVANCED(SOCI_${plugin}_PLUGIN)
IF(SOCI_${plugin}_PLUGIN) IF(SOCI_${plugin}_PLUGIN)
......
...@@ -158,7 +158,7 @@ set(LIBS ...@@ -158,7 +158,7 @@ set(LIBS
${ORTP_LIBRARIES} ${ORTP_LIBRARIES}
${XML2_LIBRARIES} ${XML2_LIBRARIES}
${BELR_LIBRARIES} ${BELR_LIBRARIES}
${SOCI_LIBRARY} ${SOCI_LIBRARIES}
) )
if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") if(WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
list(APPEND LIBS "Ws2_32") list(APPEND LIBS "Ws2_32")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment