Skip to content

Commit e1ea0e7

Browse files
committed
Adding workaround for define in Python.h
1 parent 2c7df32 commit e1ea0e7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ foreach(ver ${xtensor_python_version_defines})
2525
set(XTENSOR_PYTHON_VERSION_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" CACHE INTERNAL "")
2626
endif()
2727
endforeach()
28-
set(${PROJECT_NAME}_VERSION
28+
set(${PROJECT_NAME}_VERSION
2929
${XTENSOR_PYTHON_VERSION_MAJOR}.${XTENSOR_PYTHON_VERSION_MINOR}.${XTENSOR_PYTHON_VERSION_PATCH})
3030
message(STATUS "xtensor-python v${${PROJECT_NAME}_VERSION}")
3131

@@ -45,7 +45,7 @@ else()
4545
find_package(xtensor ${xtensor_REQUIRED_VERSION} REQUIRED)
4646
message(STATUS "Found xtensor: ${xtensor_INCLUDE_DIRS}/xtensor")
4747
endif()
48-
48+
4949
# Currently no required version for pybind11
5050
if(TARGET pybind11 OR TARGET pybind11::headers)
5151
# pybind11 has a variable that indicates its version already, so use that
@@ -80,6 +80,10 @@ target_include_directories(xtensor-python INTERFACE
8080
target_link_libraries(xtensor-python INTERFACE xtensor)
8181
get_target_property(inc_dir xtensor-python INTERFACE_INCLUDE_DIRECTORIES)
8282

83+
if(MSVC)
84+
set_property(TARGET xtensor-python PROPERTY /DHAVE_SNPRINTF)
85+
else()
86+
8387
OPTION(BUILD_TESTS "xtensor test suite" OFF)
8488
OPTION(DOWNLOAD_GTEST "build gtest from downloaded sources" OFF)
8589

0 commit comments

Comments
 (0)