File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,14 @@ macro(add_qjs_libc_if_needed target)
187187 target_sources (${target} PRIVATE quickjs-libc.c)
188188 endif ()
189189endmacro ()
190+ macro (add_static_if_needed target )
191+ if (BUILD_STATIC_QJS_EXE OR MINGW)
192+ target_link_options (${target} PRIVATE -static )
193+ if (MINGW)
194+ target_link_options (${target} PRIVATE -static -libgcc)
195+ endif ()
196+ endif ()
197+ endmacro ()
190198
191199set (qjs_sources
192200 cutils.c
@@ -249,6 +257,7 @@ add_executable(qjsc
249257 qjsc.c
250258)
251259add_qjs_libc_if_needed(qjsc)
260+ add_static_if_needed(qjsc)
252261target_compile_definitions (qjsc PRIVATE ${qjs_defines} )
253262target_link_libraries (qjsc qjs)
254263
@@ -262,17 +271,12 @@ add_executable(qjs_exe
262271 qjs.c
263272)
264273add_qjs_libc_if_needed(qjs_exe)
274+ add_static_if_needed(qjs_exe)
265275set_target_properties (qjs_exe PROPERTIES
266276 OUTPUT_NAME "qjs"
267277)
268278target_compile_definitions (qjs_exe PRIVATE ${qjs_defines} )
269279target_link_libraries (qjs_exe qjs)
270- if (BUILD_STATIC_QJS_EXE OR MINGW)
271- target_link_options (qjs_exe PRIVATE -static )
272- if (MINGW)
273- target_link_options (qjs_exe PRIVATE -static -libgcc)
274- endif ()
275- endif ()
276280if (NOT WIN32 )
277281 set_target_properties (qjs_exe PROPERTIES ENABLE_EXPORTS TRUE )
278282endif ()
You can’t perform that action at this time.
0 commit comments