vivienneanthony

Find My Sql

Oct 29th, 2015
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 2.28 KB | None | 0 0
  1. # - Try to find Mysql-Connector-C++
  2. # Once done, this will define
  3. #
  4. #  MYSQLCONNECTORCPP_FOUND - system has Mysql-Connector-C++ installed
  5. #  MYSQLCONNECTORCPP_INCLUDE_DIRS - the Mysql-Connector-C++ include directories
  6. #  MYSQLCONNECTORCPP_LIBRARIES - link these to use Mysql-Connector-C++
  7. #
  8. # The user may wish to set, in the CMake GUI or otherwise, this variable:
  9. #  MYSQLCONNECTORCPP_ROOT_DIR - path to start searching for the module
  10.  
  11.  
  12. # Set default path
  13. if(WIN32)
  14.     set(MYSQLCONNECTORCPP_ROOT_DIR "C:\\Program Files")
  15. else()
  16.     set(MYSQLCONNECTORCPP_ROOT_DIR
  17.        ${MYSQLCONNECTORCPP_ROOT_DIR}
  18.            CACHE
  19.            PATHS
  20.            "/usr/local")
  21. endif()
  22.  
  23. #find path and library
  24. if(WIN32)
  25.      find_path(MYSQLCONNECTORCPP_INCLUDE_DIR
  26.                 mysql_connection.h
  27.         PATHS
  28.         ${MYSQLCONNECTORCPP_ROOT_DIR}  
  29.                 HINTS
  30.                 PATH_SUFFIXES
  31.                 include)
  32.  
  33.     find_library(MYSQLCONNECTORCPP_LIBRARY
  34.                 NAMES
  35.                 mysqlcppconn
  36.             mysqlcppconn-static
  37.         PATHS
  38.         ${MYSQLCONNECTORCPP_ROOT_DIR}  
  39.                 HINTS                
  40.                 PATH_SUFFIXES
  41.         lib64
  42.                 lib)    
  43. else()
  44.         find_path(MYSQLCONNECTORCPP_INCLUDE_DIR
  45.                 mysql_connection.h
  46.                 HINTS
  47.                 ${MYSQLCONNECTORCPP_ROOT_DIR}
  48.                 PATH_SUFFIXES
  49.                 include)
  50.                
  51.         find_library(MYSQLCONNECTORCPP_LIBRARY
  52.                 NAMES
  53.                 mysqlcppconn
  54.                 mysqlcppconn-static
  55.                 HINTS
  56.                 ${MYSQLCONNECTORCPP_ROOT_DIR}
  57.                 PATH_SUFFIXES
  58.                 lib64
  59.                 lib)
  60.  
  61. endif()
  62.  
  63. mark_as_advanced(MYSQLCONNECTORCPP_INCLUDE_DIR MYSQLCONNECTORCPP_LIBRARY)
  64.  
  65. include(FindPackageHandleStandardArgs)
  66.  
  67. find_package_handle_standard_args(MysqlConnectorCpp
  68.         DEFAULT_MSG
  69.         MYSQLCONNECTORCPP_INCLUDE_DIR
  70.         MYSQLCONNECTORCPP_LIBRARY)
  71.  
  72. MESSAGE("NOT FOUND")
  73.  
  74. if(MYSQLCONNECTORCPP_FOUND)
  75.         set(MYSQLCONNECTORCPP_INCLUDE_DIRS "${MYSQLCONNECTORCPP_INCLUDE_DIR}") # Add any dependencies here
  76.         set(MYSQLCONNECTORCPP_LIBRARIES "${MYSQLCONNECTORCPP_LIBRARY}") # Add any dependencies here
  77.         mark_as_advanced(MYSQLCONNECTORCPP_ROOT_DIR)   
  78. endif()
Advertisement
Add Comment
Please, Sign In to add comment