Skip to content

Commit

Permalink
smex/cmake: move -Wl,EL option to target_linker_options() for clang
Browse files Browse the repository at this point in the history
-Wl,EL is a linker option, not a compiler option and clang does not
like it at compilation time; it fails like this:
```
cd smex
cmake -B build -DCMAKE_C_COMPILER=clang
make -C build

clang-15: error: -Wl,-EL: 'linker' input unused
          [-Werror,-Wunused-command-line-argument]
```

Reported by @andyross in google/oss-fuzz#10342

oss-fuzz does not need smex at all but this one-line fix is just
faster and simpler than a bigger CMake re-architecture just for
oss-fuzz.

Also simplify this for clang compatibility:
```
error: unknown warning option '-Wimplicit-fallthrough=3'; did you mean
     '-Wimplicit-fallthrough'? [-Werror,-Wunknown-warning-option]
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
  • Loading branch information
marc-hb authored and kv2019i committed May 22, 2023
1 parent 38f3f5d commit ee58fef
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion smex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ add_executable(smex

# In addition to the usual flags from CMAKE_BUILD_TYPE
target_compile_options(smex PRIVATE
-Wall -Werror -Wl,-EL -Wmissing-prototypes -Wimplicit-fallthrough=3
-Wall -Werror -Wmissing-prototypes -Wimplicit-fallthrough
)

target_link_options(smex PRIVATE
-Wall -Werror -Wl,-EL
)

target_include_directories(smex PRIVATE
Expand Down

0 comments on commit ee58fef

Please sign in to comment.