fix: link static ElaWidgetTools on Windows
Propagate ELAWIDGETTOOLS_LIBRARY to consumers when the Windows build uses the static ElaWidgetTools library. This avoids dllimport symbols such as __imp_ZN7ElaMenu... under MinGW. Document the stale-build workaround.
This commit is contained in:
@@ -41,6 +41,14 @@ if(NOT MSVC)
|
||||
# 第三方库内部仍使用少量 Qt 已弃用 API,抑制其告警但不修改其源码。
|
||||
target_compile_options(ElaWidgetTools PRIVATE -Wno-deprecated-declarations)
|
||||
endif()
|
||||
if(WIN32 AND ELAWIDGETTOOLS_BUILD_STATIC_LIB)
|
||||
# ElaProperty.h 默认把使用方当作动态库客户端(dllimport)。静态链接时必须让
|
||||
# 使用方也看到 ELAWIDGETTOOLS_LIBRARY,否则 MinGW 会生成 __imp_ 前缀符号。
|
||||
target_compile_definitions(ElaWidgetTools INTERFACE ELAWIDGETTOOLS_LIBRARY)
|
||||
if(MSVC)
|
||||
target_compile_options(ElaWidgetTools INTERFACE /wd4251 /wd4275)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(tests)
|
||||
|
||||
Reference in New Issue
Block a user