Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 42ce4a0

Browse files
Fix "usage" message when invoking ar -V
https://bugs.webkit.org/show_bug.cgi?id=218255 <rdar://problem/70735674> Reviewed by Fujii Hironori. The Mac/BSD version of `ar` does not support the -V flag. This flag is used unconditionally in OptionsCommon.cmake when trying to determine if the installed `ar` supports the thinning of archives, leading to a "usage" message being emitted on macOS. Avoid this message by capturing the error-output. Examine the output to see if it's a "usage" message. If so, then treat the `ar` as one that does not support thinning. Any other error-output is printed as a warning. If there is no error-output, continue processing as normal. * Source/cmake/OptionsCommon.cmake: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@269076 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent eace146 commit 42ce4a0

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

ChangeLog

+20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
2020-10-27 Keith Rollin <[email protected]>
2+
3+
Fix "usage" message when invoking `ar -V`
4+
https://bugs.webkit.org/show_bug.cgi?id=218255
5+
<rdar://problem/70735674>
6+
7+
Reviewed by Fujii Hironori.
8+
9+
The Mac/BSD version of `ar` does not support the -V flag. This flag is
10+
used unconditionally in OptionsCommon.cmake when trying to determine
11+
if the installed `ar` supports the thinning of archives, leading to a
12+
"usage" message being emitted on macOS.
13+
14+
Avoid this message by capturing the error-output. Examine the output
15+
to see if it's a "usage" message. If so, then treat the `ar` as one
16+
that does not support thinning. Any other error-output is printed as a
17+
warning. If there is no error-output, continue processing as normal.
18+
19+
* Source/cmake/OptionsCommon.cmake:
20+
121
2020-10-27 Brian Burg <[email protected]>
222

323
Web Inspector: add ENABLE(INSPECTOR_EXTENSIONS) to feature defines

Source/cmake/OptionsCommon.cmake

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ add_definitions(-DHAVE_CONFIG_H=1)
77

88
option(USE_THIN_ARCHIVES "Produce all static libraries as thin archives" ON)
99
if (USE_THIN_ARCHIVES)
10-
execute_process(COMMAND ${CMAKE_AR} -V OUTPUT_VARIABLE AR_VERSION)
11-
if ("${AR_VERSION}" MATCHES "^GNU ar")
10+
execute_process(COMMAND ${CMAKE_AR} -V OUTPUT_VARIABLE AR_VERSION ERROR_VARIABLE AR_ERROR)
11+
if ("${AR_ERROR}" MATCHES "^usage:")
12+
# This `ar` doesn't understand "-V". Ignore the error and treat this as
13+
# an unsupported `ar`. TODO: Determine BSD or Xcode equivalent.
14+
elseif ("${AR_ERROR}")
15+
message(WARNING "Error from `ar`: ${AR_ERROR}")
16+
elseif ("${AR_VERSION}" MATCHES "^GNU ar")
1217
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
1318
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
1419
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> rT <TARGET> <LINK_FLAGS> <OBJECTS>")

0 commit comments

Comments
 (0)