Skip to content

Commit 454c724

Browse files
committed
feat: keep CefViewWing target name but only change the output name
1 parent f2089f2 commit 454c724

File tree

2 files changed

+39
-33
lines changed

2 files changed

+39
-33
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output/$<CONFIG>/
8888
if(NOT CEFVIEW_WING_NAME)
8989
set(DEFAULT_CEFVIEW_WING_NAME "CefViewWing")
9090
message(STATUS
91-
"CEFVIEW_WING_NAME is empty, use default version ${DEFAULT_CEFVIEW_WING_NAME}\n"
91+
"CEFVIEW_WING_NAME is empty, use default output name: ${DEFAULT_CEFVIEW_WING_NAME}\n"
9292
"You can change the name by adding -DCEFVIEW_WING_NAME=xxx to commandline for generation")
9393
set(CEFVIEW_WING_NAME ${DEFAULT_CEFVIEW_WING_NAME} CACHE STRING "CefViewWing Helper Process Name" FORCE)
9494
endif()
@@ -185,9 +185,9 @@ set(CefViewCore_INCLUDE_PATH
185185
add_subdirectory(src)
186186

187187
if(OS_MACOS)
188-
set(CefViewCore_HELPER_TARGETS "${CEFVIEW_WING_NAME};${CEFVIEW_WING_NAME}_gpu;${CEFVIEW_WING_NAME}_plugin;${CEFVIEW_WING_NAME}_renderer")
188+
set(CefViewCore_HELPER_TARGETS "CefViewWing;CefViewWing_gpu;CefViewWing_plugin;CefViewWing_renderer")
189189
else()
190-
set(CefViewCore_HELPER_TARGETS "${CEFVIEW_WING_NAME}")
190+
set(CefViewCore_HELPER_TARGETS "CefViewWing")
191191
endif()
192192

193193
get_directory_property(IS_CURRENT_IN_SUBDIRECTORY PARENT_DIRECTORY)

src/CMakeLists.txt

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -193,27 +193,32 @@ if(OS_WINDOWS)
193193
endif()
194194

195195
# Create Helper executable target.
196-
add_executable(${CEFVIEW_WING_NAME} WIN32
196+
add_executable(CefViewWing WIN32
197197
${CefViewCore_SHARED_SRC_FILES}
198198
${CefViewWing_SRC_FILES}
199199
${CefViewWing_PLATFORM_SRC_FILES}
200200
${CefViewWing_WIN_RESOURCE_FILE}
201201
)
202202

203-
SET_EXECUTABLE_TARGET_PROPERTIES(${CEFVIEW_WING_NAME})
204-
target_link_options(${CEFVIEW_WING_NAME}
203+
SET_EXECUTABLE_TARGET_PROPERTIES(CefViewWing)
204+
set_target_properties(CefViewWing
205+
PROPERTIES
206+
OUTPUT_NAME ${CEFVIEW_WING_NAME}
207+
)
208+
209+
target_link_options(CefViewWing
205210
PRIVATE
206211
"/MANIFEST"
207212
)
208213

209-
target_include_directories(${CEFVIEW_WING_NAME}
214+
target_include_directories(CefViewWing
210215
PUBLIC
211216
${CefViewCore_INCLUDE_PATH}
212217
PRIVATE
213218
"${CMAKE_CURRENT_SOURCE_DIR}/Shared"
214219
)
215220

216-
add_dependencies(${CEFVIEW_WING_NAME}
221+
add_dependencies(CefViewWing
217222
libcef_lib
218223
libcef_dll_wrapper
219224
)
@@ -234,46 +239,46 @@ if(OS_WINDOWS)
234239
list(APPEND _helper_libs cef_sandbox_lib)
235240
endif()
236241

237-
target_link_libraries(${CEFVIEW_WING_NAME}
242+
target_link_libraries(CefViewWing
238243
${_helper_libs}
239244
)
240245

241246
# Add the Helper as a dependency of the main executable target.
242-
add_dependencies(CefViewCore ${CEFVIEW_WING_NAME})
247+
add_dependencies(CefViewCore CefViewWing)
243248

244-
add_custom_command(TARGET ${CEFVIEW_WING_NAME}
249+
add_custom_command(TARGET CefViewWing
245250
POST_BUILD
246251

247252
# embed the manifest file
248253
COMMAND mt.exe
249254
-manifest "\"${CMAKE_CURRENT_SOURCE_DIR}\\CefWing\\win\\CefViewWing.manifest\""
250-
-outputresource:\"$<TARGET_FILE:${CEFVIEW_WING_NAME}>\"
255+
-outputresource:\"$<TARGET_FILE:CefViewWing>\"
251256
252257
# copy cef binary files
253258
# 1 copy the cef resources to output dir
254259
COMMAND ${CMAKE_COMMAND} -E copy_directory
255260
"${CEF_RESOURCE_DIR}"
256-
"$<TARGET_FILE_DIR:${CEFVIEW_WING_NAME}>"
261+
"$<TARGET_FILE_DIR:CefViewWing>"
257262
258263
# copy all cef binary files to output dir
259264
COMMAND ${CMAKE_COMMAND} -E copy_directory
260265
"${CEF_BINARY_DIR}"
261-
"$<TARGET_FILE_DIR:${CEFVIEW_WING_NAME}>"
266+
"$<TARGET_FILE_DIR:CefViewWing>"
262267
263268
# move libcef.lib to lib output
264269
COMMAND ${CMAKE_COMMAND} -E rename
265-
"$<TARGET_FILE_DIR:${CEFVIEW_WING_NAME}>/libcef.lib"
270+
"$<TARGET_FILE_DIR:CefViewWing>/libcef.lib"
266271
"$<TARGET_LINKER_FILE_DIR:libcef_dll_wrapper>/libcef.lib"
267272
)
268273
269274
if(USE_SANDBOX AND CEF_VERSION_MAJOR LESS 138)
270275
add_custom_command(
271-
TARGET ${CEFVIEW_WING_NAME}
276+
TARGET CefViewWing
272277
POST_BUILD
273278
274279
# move cef_sandbox.lib to lib output
275280
COMMAND ${CMAKE_COMMAND} -E rename
276-
"$<TARGET_FILE_DIR:${CEFVIEW_WING_NAME}>/cef_sandbox.lib"
281+
"$<TARGET_FILE_DIR:CefViewWing>/cef_sandbox.lib"
277282
"$<TARGET_LINKER_FILE_DIR:libcef_dll_wrapper>/cef_sandbox.lib"
278283
)
279284
endif()
@@ -291,28 +296,29 @@ if(OS_LINUX)
291296
)
292297
293298
# Create Helper executable target.
294-
add_executable(${CEFVIEW_WING_NAME}
299+
add_executable(CefViewWing
295300
${CefViewCore_SHARED_SRC_FILES}
296301
${CefViewWing_SRC_FILES}
297302
${CefViewWing_PLATFORM_SRC_FILES}
298303
)
299304
300-
SET_EXECUTABLE_TARGET_PROPERTIES(${CEFVIEW_WING_NAME})
305+
SET_EXECUTABLE_TARGET_PROPERTIES(CefViewWing)
301306
302-
set_target_properties(${CEFVIEW_WING_NAME}
307+
set_target_properties(CefViewWing
303308
PROPERTIES
304309
INSTALL_RPATH "$ORIGIN"
305310
BUILD_WITH_INSTALL_RPATH TRUE
311+
OUTPUT_NAME ${CEFVIEW_WING_NAME}
306312
)
307313
308-
target_include_directories(${CEFVIEW_WING_NAME}
314+
target_include_directories(CefViewWing
309315
PUBLIC
310316
${CefViewCore_INCLUDE_PATH}
311317
PRIVATE
312318
"${CMAKE_CURRENT_SOURCE_DIR}/Shared"
313319
)
314320
315-
add_dependencies(${CEFVIEW_WING_NAME}
321+
add_dependencies(CefViewWing
316322
libcef_lib
317323
libcef_dll_wrapper
318324
)
@@ -323,30 +329,30 @@ if(OS_LINUX)
323329
${CEF_STANDARD_LIBS}
324330
)
325331
326-
target_link_libraries(${CEFVIEW_WING_NAME}
332+
target_link_libraries(CefViewWing
327333
${_helper_libs}
328334
)
329335
330336
# Add the Helper as a dependency of the main executable target.
331-
add_dependencies(CefViewCore ${CEFVIEW_WING_NAME})
337+
add_dependencies(CefViewCore CefViewWing)
332338
333339
# copy cef binary files
334-
add_custom_command(TARGET ${CEFVIEW_WING_NAME}
340+
add_custom_command(TARGET CefViewWing
335341
POST_BUILD
336342
337343
# copy cef binary files
338344
# .1 copy the cef resources to output dir
339345
COMMAND ${CMAKE_COMMAND} -E copy_directory
340346
"${CEF_RESOURCE_DIR}"
341-
"$<TARGET_FILE_DIR:${CEFVIEW_WING_NAME}>"
347+
"$<TARGET_FILE_DIR:CefViewWing>"
342348
343349
# copy all cef binary files to output dir
344350
COMMAND ${CMAKE_COMMAND} -E copy_directory
345351
"${CEF_BINARY_DIR}"
346-
"$<TARGET_FILE_DIR:${CEFVIEW_WING_NAME}>"
352+
"$<TARGET_FILE_DIR:CefViewWing>"
347353
)
348354
349-
SET_LINUX_SUID_PERMISSIONS(${CEFVIEW_WING_NAME} "$<TARGET_FILE_DIR:${CEFVIEW_WING_NAME}>/chrome-sandbox")
355+
SET_LINUX_SUID_PERMISSIONS(CefViewWing "$<TARGET_FILE_DIR:CefViewWing>/chrome-sandbox")
350356
endif() # OS_LINUX
351357
352358
if(OS_MACOS)
@@ -380,7 +386,7 @@ if(OS_MACOS)
380386
list(GET _suffix_list 2 _plist_suffix)
381387
382388
# Define Helper target and output names.
383-
set(_helper_target "${CEFVIEW_WING_NAME}${_target_suffix}")
389+
set(_helper_target "CefViewWing${_target_suffix}")
384390
set(_helper_output_name "${CEFVIEW_WING_NAME}${_name_suffix}")
385391
386392
# Create Helper executable target.
@@ -425,16 +431,16 @@ if(OS_MACOS)
425431
endforeach()
426432
427433
# copy cef binary files to the output folder
428-
add_custom_command(TARGET ${CEFVIEW_WING_NAME}
434+
add_custom_command(TARGET CefViewWing
429435
POST_BUILD
430436
431437
# copy the cef framework to output directory
432438
COMMAND ${CMAKE_COMMAND} -E copy_directory
433439
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
434-
"$<TARGET_BUNDLE_DIR:${CEFVIEW_WING_NAME}>/../Chromium Embedded Framework.framework"
440+
"$<TARGET_BUNDLE_DIR:CefViewWing>/../Chromium Embedded Framework.framework"
435441
VERBATIM
436442
)
437443
endif() # OS_MACOS
438444
439-
# add alias for heper process target
440-
add_executable(CefViewCore::CefViewWing ALIAS ${CEFVIEW_WING_NAME})
445+
# add alias for helper process target
446+
add_executable(CefViewCore::CefViewWing ALIAS CefViewWing)

0 commit comments

Comments
 (0)