@@ -86,3 +86,48 @@ foreach(comp ${Blosc2_FIND_COMPONENTS})
8686 endif ()
8787endforeach ()
8888
89+ # Defines imported targets for Blosc2 inside a Python wheel
90+
91+ # ------------------------------
92+ # Shared library target
93+ # ------------------------------
94+ if (NOT TARGET Blosc2::blosc2_shared)
95+ add_library (Blosc2::blosc2_shared SHARED IMPORTED GLOBAL )
96+
97+ if (WIN32 )
98+ # MSVC: import library (.lib) + runtime DLL (.dll)
99+ set_target_properties (Blosc2::blosc2_shared PROPERTIES
100+ IMPORTED_IMPLIB "${CMAKE_CURRENT_LIST_DIR} /../blosc2_shared.lib"
101+ IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR} /../blosc2_shared.dll"
102+ INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR} /../../include"
103+ )
104+ else ()
105+ # Linux/macOS
106+ set_target_properties (Blosc2::blosc2_shared PROPERTIES
107+ IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR} /../blosc2_shared.so"
108+ INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR} /../../include"
109+ )
110+ endif ()
111+ endif ()
112+
113+ # ------------------------------
114+ # Static library target
115+ # ------------------------------
116+ if (NOT TARGET Blosc2::blosc2_static)
117+ add_library (Blosc2::blosc2_static STATIC IMPORTED GLOBAL )
118+
119+ if (MSVC )
120+ # Windows static library uses .lib
121+ set_target_properties (Blosc2::blosc2_static PROPERTIES
122+ IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR} /../blosc2_static.lib"
123+ INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR} /../../include"
124+ )
125+ else ()
126+ # Linux/macOS static library uses .a
127+ set_target_properties (Blosc2::blosc2_static PROPERTIES
128+ IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR} /../blosc2_static.a"
129+ INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR} /../../include"
130+ )
131+ endif ()
132+ endif ()
133+
0 commit comments