Skip to content

Commit e7c5aa3

Browse files
tishionL-Super
authored andcommitted
feat: support static build for Windows
1 parent a9e024e commit e7c5aa3

File tree

1 file changed

+53
-18
lines changed

1 file changed

+53
-18
lines changed

src/CMakeLists.txt

+53-18
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,33 @@ if(OS_WINDOWS)
6767
QCEFVIEW_LIB
6868
)
6969

70-
target_link_options(QCefView PRIVATE
71-
"/DELAYLOAD:libcef.dll"
72-
)
73-
74-
target_link_libraries(QCefView
75-
PRIVATE
76-
d3d11
77-
d3dcompiler
78-
dcomp
79-
delayimp
80-
)
70+
if(BUILD_STATIC)
71+
target_link_options(QCefView
72+
PUBLIC
73+
"/DELAYLOAD:libcef.dll"
74+
)
75+
76+
target_link_libraries(QCefView
77+
PUBLIC
78+
d3d11
79+
d3dcompiler
80+
dcomp
81+
delayimp
82+
)
83+
else()
84+
target_link_options(QCefView
85+
PRIVATE
86+
"/DELAYLOAD:libcef.dll"
87+
)
88+
89+
target_link_libraries(QCefView
90+
PRIVATE
91+
d3d11
92+
d3dcompiler
93+
dcomp
94+
delayimp
95+
)
96+
endif()
8197

8298
add_custom_command(TARGET QCefView
8399
PRE_BUILD
@@ -168,11 +184,20 @@ if(OS_MACOS)
168184

169185
find_library(METAL_FRAMEWORK Metal)
170186
find_library(QUARTZCORE_FRAMEWORK QuartzCore)
171-
target_link_libraries(QCefView
172-
PRIVATE
173-
${METAL_FRAMEWORK}
174-
${QUARTZCORE_FRAMEWORK}
175-
)
187+
if(BUILD_STATIC)
188+
target_link_libraries(QCefView
189+
PUBLIC
190+
${METAL_FRAMEWORK}
191+
${QUARTZCORE_FRAMEWORK}
192+
)
193+
else()
194+
target_link_libraries(QCefView
195+
PRIVATE
196+
${METAL_FRAMEWORK}
197+
${QUARTZCORE_FRAMEWORK}
198+
)
199+
endif()
200+
176201

177202
set_target_properties(QCefView
178203
PROPERTIES
@@ -231,13 +256,23 @@ add_dependencies(QCefView
231256
CefViewCore::CefViewCore
232257
)
233258

259+
if(BUILD_STATIC)
260+
target_link_libraries(QCefView
261+
PUBLIC
262+
CefViewCore::CefViewCore
263+
)
264+
else()
265+
target_link_libraries(QCefView
266+
PRIVATE
267+
CefViewCore::CefViewCore
268+
)
269+
endif()
270+
234271
target_link_libraries(QCefView
235272
PUBLIC
236273
Qt${QT_VERSION_MAJOR}::Gui
237274
Qt${QT_VERSION_MAJOR}::Core
238275
Qt${QT_VERSION_MAJOR}::Widgets
239-
PRIVATE
240-
CefViewCore::CefViewCore
241276
)
242277

243278
# install QCefView files

0 commit comments

Comments
 (0)