@@ -12,7 +12,6 @@ option(VIX_ORM_USE_MYSQL "Enable MySQL Connector/C++ driver" ON)
1212option (VIX_ORM_REQUIRE_MYSQL "Fail if MySQL requested but not found" OFF )
1313
1414option (VIX_ORM_USE_SQLITE "Enable SQLite3 driver" OFF )
15- option (VIX_ORM_ENABLE_SANITIZERS "Enable sanitizers in Debug builds" ON )
1615option (VIX_ORM_BUILD_TOOLS "Build ORM CLI tools (migrator)" ON )
1716
1817# ---------------- language / PIC ----------------
@@ -26,7 +25,6 @@ set(_WARNINGS_GNU
2625 -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual -Wpedantic
2726)
2827set (_WARNINGS_MSVC /W4 /permissive-)
29- set (_SAN_DBG_GNU -fsanitize=address,undefined)
3028
3129# ---------------- optional deps ----------------
3230find_package (spdlog QUIET CONFIG)
@@ -197,6 +195,10 @@ target_include_directories(vix_orm PUBLIC
197195)
198196# ORM depends on Vix Core (Config.hpp, http, json, etc.)
199197target_link_libraries (vix_orm PUBLIC vix::core)
198+ # Inherit umbrella sanitizers if present
199+ if (VIX_ENABLE_SANITIZERS AND TARGET vix_sanitizers)
200+ target_link_libraries (vix_orm PUBLIC vix_sanitizers)
201+ endif ()
200202if (MSVC )
201203 target_compile_options (vix_orm PRIVATE ${_WARNINGS_MSVC} )
202204else ()
@@ -234,27 +236,19 @@ endif()
234236# ============================================================
235237# examples
236238# ============================================================
237-
238- function (vix_enable_sanitizers tgt)
239- if (CMAKE_BUILD_TYPE MATCHES "Debug"
240- AND VIX_ORM_ENABLE_SANITIZERS
241- AND NOT MSVC )
242- target_compile_options (${tgt} PRIVATE -fsanitize=address,undefined)
243- target_link_options (${tgt} PRIVATE -fsanitize=address,undefined)
244- endif ()
245- endfunction ()
246-
247239function (vix_add_orm_example name file)
248240 add_executable (${name} ${file} )
249241 target_link_libraries (${name} PRIVATE vix::orm)
250242
243+ if (VIX_ENABLE_SANITIZERS AND TARGET vix_sanitizers)
244+ target_link_libraries (${name} PRIVATE vix_sanitizers)
245+ endif ()
246+
251247 if (MSVC )
252248 target_compile_options (${name} PRIVATE ${_WARNINGS_MSVC} )
253249 else ()
254250 target_compile_options (${name} PRIVATE ${_WARNINGS_GNU} )
255251 endif ()
256-
257- vix_enable_sanitizers(${name} )
258252endfunction ()
259253
260254if (VIX_ORM_BUILD_EXAMPLES)
@@ -288,8 +282,14 @@ endif()
288282# ============================================================
289283# install / export via umbrella export-set "VixTargets"
290284# ============================================================
291- if (DEFINED VIX_UMBRELLA_BUILD) # ou un flag que tu définis depuis l’umbrella
292- install (TARGETS vix_orm EXPORT VixTargets ...)
285+ if (DEFINED VIX_UMBRELLA_BUILD)
286+ install (TARGETS vix_orm
287+ EXPORT VixTargets
288+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
289+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
290+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
291+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
292+ )
293293else ()
294294 install (TARGETS vix_orm
295295 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
0 commit comments