--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -484,7 +484,7 @@
   # Configure nanobind: https://nanobind.readthedocs.io/en/latest/api_cmake.html
   nanobind_add_module(
     onnx_cpp2py_export
-    NB_STATIC NB_DOMAIN onnx STABLE_ABI FREE_THREADED LTO
+    NB_STATIC NB_DOMAIN onnx STABLE_ABI
     "${ONNX_ROOT}/onnx/cpp2py_export.cc")
 
   target_link_libraries(onnx_cpp2py_export PRIVATE $<BUILD_INTERFACE:onnx_object> $<BUILD_INTERFACE:onnx_proto_object>)
@@ -583,7 +583,10 @@
 
 install(TARGETS
   onnx onnx_proto
-  EXPORT ONNXTargets DESTINATION ${CMAKE_INSTALL_LIBDIR})
+  EXPORT ONNXTargets
+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
 install(EXPORT ONNXTargets
   DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ONNX"
--- a/onnx/onnx_pb.h
+++ b/onnx/onnx_pb.h
@@ -8,7 +8,7 @@
 // Defines ONNX_EXPORT and ONNX_IMPORT. On Windows, this corresponds to
 // different declarations (dllexport and dllimport). On Linux/Mac, it just
 // resolves to the same "default visibility" setting.
-#if defined(_MSC_VER)
+#if defined(_WIN32)
 #if defined(ONNX_BUILD_SHARED_LIBS) || defined(ONNX_BUILD_MAIN_LIB)
 #define ONNX_EXPORT __declspec(dllexport)
 #define ONNX_IMPORT __declspec(dllimport)
--- a/setup.py
+++ b/setup.py
@@ -29,7 +29,7 @@
 TOP_DIR = os.path.realpath(os.path.dirname(__file__))
 CMAKE_BUILD_DIR = os.path.join(TOP_DIR, ".setuptools-cmake-build")
 
-WINDOWS = os.name == "nt"
+WINDOWS = os.name == "nt" and 'MSC' in sys.version
 
 CMAKE = shutil.which("cmake3") or shutil.which("cmake")
 
