@@ -273,11 +273,6 @@ if(PHP_EXT_ODBC_VERSION AND NOT PHP_EXT_ODBC_VERSION MATCHES "^0x[0-9A-Fa-f]+$")
273273 )
274274endif ()
275275
276- unset (PHP_ODBC_CFLAGS CACHE )
277- unset (PHP_ODBC_LFLAGS CACHE )
278- unset (PHP_ODBC_LIBS CACHE )
279- unset (PHP_ODBC_TYPE CACHE )
280-
281276if (NOT PHP_EXT_ODBC)
282277 return ()
283278endif ()
@@ -332,7 +327,7 @@ if(PHP_EXT_ODBC_TYPE STREQUAL "ibm-db2" AND TARGET ODBC::ODBC)
332327endif ()
333328
334329################################################################################
335- # Set variables for main/build-defs.h and config.h file.
330+ # Configure config.h file.
336331################################################################################
337332
338333# Set PHP_ODBC_TYPE for configuration header value.
@@ -394,7 +389,7 @@ if(NOT PHP_EXT_ODBC_TYPE MATCHES "^(dbmaker|solid)$")
394389 set (HAVE_SQLDATASOURCES TRUE )
395390endif ()
396391
397- if (TARGET ODBC::ODBC)
392+ if (TARGET ODBC::ODBC AND NOT ODBC_DRIVER STREQUAL "Windows" )
398393 block(PROPAGATE PHP_ODBC_BUILD_DEFINITIONS_CODE)
399394 get_target_property (definitions ODBC::ODBC INTERFACE_COMPILE_DEFINITIONS )
400395 get_target_property (options ODBC::ODBC INTERFACE_COMPILE_OPTIONS)
@@ -430,37 +425,18 @@ if(TARGET ODBC::ODBC)
430425 list (JOIN ldflags " " ldflags)
431426 list (JOIN libs " " libs)
432427
433- set (PHP_ODBC_CFLAGS "${cflags} " CACHE INTERNAL "ODBC CFLAGS" )
434- set (PHP_ODBC_LFLAGS "${ldflags} " CACHE INTERNAL "ODBC linker flags" )
435- set (PHP_ODBC_LIBS "${libs} " CACHE INTERNAL "ODBC libraries" )
436- set (PHP_ODBC_TYPE "${PHP_ODBC_TYPE} " CACHE INTERNAL "ODBC type" )
437-
438- if (
439- NOT ODBC_DRIVER STREQUAL "Windows"
440- AND NOT EXISTS ${PHP_SOURCE_DIR} /main/build -defs.h.in
441- )
442- set (
443- PHP_ODBC_BUILD_DEFINITIONS_CODE
444- [[
428+ string (CONFIGURE [[
445429/* The compile options that PHP odbc extension was built with. */
446- #define PHP_ODBC_CFLAGS "@PHP_ODBC_CFLAGS @"
430+ #define PHP_ODBC_CFLAGS "@cflags @"
447431
448432/* The linker flags that PHP odbc extension was built with. */
449- #define PHP_ODBC_LFLAGS "@PHP_ODBC_LFLAGS @"
433+ #define PHP_ODBC_LFLAGS "@ldflags @"
450434
451435/* The libraries linker flags that PHP odbc extension was built with. */
452- #define PHP_ODBC_LIBS "@PHP_ODBC_LIBS @"
436+ #define PHP_ODBC_LIBS "@libs @"
453437
454438/* The ODBC library used in the PHP odbc extension. */
455- #define PHP_ODBC_TYPE "@PHP_ODBC_TYPE@"]]
456- )
457-
458- string (
459- CONFIGURE
460- "${PHP_ODBC_BUILD_DEFINITIONS_CODE} "
461- PHP_ODBC_BUILD_DEFINITIONS_CODE
462- )
463- endif ()
439+ #define PHP_ODBC_TYPE "@PHP_ODBC_TYPE@"]] PHP_ODBC_BUILD_DEFINITIONS_CODE)
464440 endblock()
465441endif ()
466442
0 commit comments