diff --git a/CMakeLists.txt b/CMakeLists.txt index e0824df..ed1aa1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,9 @@ add_definitions(/D_WIN32 /D_WINDOWS /DWINDOWS=1 /DZEND_WIN32=1 /DPHP_WIN32=1 /DW if(NOT CMAKE_CL_64) add_definitions(-D_USE_32BIT_TIME_T) endif(NOT CMAKE_CL_64) +if(WITH_THREAD_SAFETY) +add_definitions(-DZTS=1) +endif(WITH_THREAD_SAFETY) ENDIF(WIN32) string(SUBSTRING $ENV{VSCMD_VER} 0 2 VSCMD_VER) @@ -20,5 +23,8 @@ set_property(SOURCE example.i PROPERTY CPLUSPLUS ON) add_library(example STATIC example.cxx) swig_add_library(php_example TYPE MODULE LANGUAGE php7 SOURCES example.i) target_compile_options(php_example PRIVATE /D_WIN32 /D_WINDOWS /DWINDOWS=1 /DZEND_WIN32=1 /DPHP_WIN32=1 /DWIN32 /DNDebug /DNDEBUG /DZEND_DEBUG=0) -SWIG_LINK_LIBRARIES(php_example "C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src/$ENV{VSCMD_ARG_TGT_ARCH}/Release/php7.lib") +if(WITH_THREAD_SAFETY) +target_compile_options(php_example PRIVATE /DZTS=1) +endif(WITH_THREAD_SAFETY) +SWIG_LINK_LIBRARIES(php_example "C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src/$ENV{VSCMD_ARG_TGT_ARCH}/Release_TS/php7ts.lib") target_link_libraries(php_example example)