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)
187
187
target_sources (${target} PRIVATE quickjs-libc.c )
188
188
endif ()
189
189
endmacro ()
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 ()
190
198
191
199
set (qjs_sources
192
200
cutils.c
@@ -249,6 +257,7 @@ add_executable(qjsc
249
257
qjsc.c
250
258
)
251
259
add_qjs_libc_if_needed (qjsc )
260
+ add_static_if_needed (qjsc )
252
261
target_compile_definitions (qjsc PRIVATE ${qjs_defines} )
253
262
target_link_libraries (qjsc qjs )
254
263
@@ -262,17 +271,12 @@ add_executable(qjs_exe
262
271
qjs.c
263
272
)
264
273
add_qjs_libc_if_needed (qjs_exe )
274
+ add_static_if_needed (qjs_exe )
265
275
set_target_properties (qjs_exe PROPERTIES
266
276
OUTPUT_NAME "qjs"
267
277
)
268
278
target_compile_definitions (qjs_exe PRIVATE ${qjs_defines} )
269
279
target_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 ()
276
280
if (NOT WIN32 )
277
281
set_target_properties (qjs_exe PROPERTIES ENABLE_EXPORTS TRUE )
278
282
endif ()
You can’t perform that action at this time.
0 commit comments