Tidy up the formatting of the mysql tests

Signed-off-by: aneejit1 <aneejit1@gmail.com>
pull/21/head
aneejit1 4 years ago committed by TDE Gitea
parent b751988425
commit 6b36c71829

@ -265,15 +265,16 @@ endif( WITH_MP4V2 )
if( WITH_MYSQL ) if( WITH_MYSQL )
#### check for MySql or Mariadb #### check for MySql or Mariadb
message( STATUS "Check for MariaDB or MySQL" ) message( STATUS "Check for MariaDB or MySQL" )
find_program( MYSQL_CONFIG NAMES mariadb_config mysql_config ) find_program( MYSQL_CONFIG NAMES mariadb_config mysql_config )
if( NOT MYSQL_CONFIG )
if( NOT MYSQL_CONFIG )
tde_message_fatal( "MySql support is requested but neither MySql or Mariadb have been found on your system" ) tde_message_fatal( "MySql support is requested but neither MySql or Mariadb have been found on your system" )
else() else()
macro( _mysql_config __type __var ) macro( _mysql_config __type __var )
execute_process( execute_process(
COMMAND ${MYSQL_CONFIG} --${__type} COMMAND ${MYSQL_CONFIG} --${__type}
OUTPUT_VARIABLE ${__var} OUTPUT_VARIABLE ${__var}
@ -282,50 +283,48 @@ macro( _mysql_config __type __var )
if( _result ) if( _result )
tde_message_fatal( "Unable to run ${MYSQL_CONFIG}!" ) tde_message_fatal( "Unable to run ${MYSQL_CONFIG}!" )
endif() endif()
endmacro() endmacro()
_mysql_config( include MYSQL_INCLUDE_DIRS ) _mysql_config( include MYSQL_INCLUDE_DIRS )
_mysql_config( libs MYSQL_LIBRARIES ) _mysql_config( libs MYSQL_LIBRARIES )
if( MYSQL_INCLUDE_DIRS ) if( MYSQL_INCLUDE_DIRS )
string( REGEX REPLACE "(^| +)-I" ";" MYSQL_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}" ) string( REGEX REPLACE "(^| +)-I" ";" MYSQL_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}" )
endif() endif()
if( MYSQL_LIBRARIES ) if( MYSQL_LIBRARIES )
string( REGEX REPLACE "(^| +)-l" ";" MYSQL_LIBRARIES "${MYSQL_LIBRARIES}" ) string( REGEX REPLACE "(^| +)-l" ";" MYSQL_LIBRARIES "${MYSQL_LIBRARIES}" )
endif( ) endif( )
set( MYSQL_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE )
set( MYSQL_LIBRARIES "${MYSQL_LIBRARIES}" CACHE INTERNAL "" FORCE )
message( STATUS " includes ${MYSQL_INCLUDE_DIRS} ") set( MYSQL_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE )
message( STATUS " libraries ${MYSQL_LIBRARIES} ") set( MYSQL_LIBRARIES "${MYSQL_LIBRARIES}" CACHE INTERNAL "" FORCE )
set( USE_MYSQL 1 )
tde_save_and_set( CMAKE_REQUIRED_INCLUDES ${MYSQL_INCLUDE_DIRS} ) message( STATUS " includes ${MYSQL_INCLUDE_DIRS} ")
message( STATUS " libraries ${MYSQL_LIBRARIES} ")
set( USE_MYSQL 1 )
check_cxx_source_compiles(" tde_save_and_set( CMAKE_REQUIRED_INCLUDES ${MYSQL_INCLUDE_DIRS} )
#include <mysql.h>
typedef struct st_mysql MYSQL;
int main(int, char**) check_cxx_source_compiles("
{ #include <mysql.h>
typedef struct st_mysql MYSQL;
int main(int, char**)
{
return 1; return 1;
}" }"
HAVE_STRUCT_ST_MYSQL ) HAVE_STRUCT_ST_MYSQL )
if( HAVE_STRUCT_ST_MYSQL ) if( HAVE_STRUCT_ST_MYSQL )
set( MYSQL_STRUCT "st_mysql" ) set( MYSQL_STRUCT "st_mysql" )
else() else()
check_cxx_source_compiles(" check_cxx_source_compiles("
#include <mysql.h> #include <mysql.h>
typedef struct MYSQL MYSQL; typedef struct MYSQL MYSQL;
int main() int main()
{ {
return 1; return 1;
}" }"
HAVE_STRUCT_MYSQL ) HAVE_STRUCT_MYSQL )
if( HAVE_STRUCT_MYSQL ) if( HAVE_STRUCT_MYSQL )
@ -333,11 +332,12 @@ int main()
else() else()
tde_message_fatal( "MySQL is requested, but it is not possible to determine the type of MySQL structure" ) tde_message_fatal( "MySQL is requested, but it is not possible to determine the type of MySQL structure" )
endif() endif()
endif() endif()
tde_restore( CMAKE_REQUIRED_INCLUDES )
tde_restore( CMAKE_REQUIRED_INCLUDES ) endif( NOT MYSQL_CONFIG )
endif( NOT MYSQL_CONFIG )
endif( WITH_MYSQL ) endif( WITH_MYSQL )

Loading…
Cancel
Save