zephyr/cmake
Marc Herbert 46353438e8 zephyr_library_compile_options(): silently de-duplicate
PR #14776 / commit 915a353255 changed function
zephyr_library_compile_options() to use MD5 instead of RANDOM for build
reproduction reasons. As later predicted by Sebastian Bøe in the PR
(thx), the names generated for these pseudo-libraries won't be unique
anymore if the exact same flag gets added more than once.

To reproduce the issue, simply add the following two lines in some
CMakeLists.txt file like samples/hello_world/CMakeLists.txt:

zephyr_library_compile_options("-Dfubar=barfu")
zephyr_library_compile_options("-Dfubar=barfu")

cmake will then fail like this:

 CMake Error at zephyr/cmake/extensions.cmake:403 (add_library):
  add_library cannot create target
  "options_interface_lib_e689fdb7eb15d801c2f95dd61301fc5e" because
  another target with the same name already exists.  The existing
  target is an interface library created in source directory
  "zephyr/samples/hello_world".  See documentation for
  policy CMP0002 for more details.
 Call Stack (most recent call first):
  CMakeLists.txt:9 (zephyr_library_compile_options)

As requested by Sebastian, silently discard duplicate options just like
CMake does.

Fixes #15093

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-04-04 08:11:14 -04:00
..
app
backports
compiler host-gcc/target.cmake: stop discarding CMAKE_<tool>_FLAGS for x86 2019-03-21 00:21:27 -07:00
emu cmake: add debugserver target for nsim 2019-03-20 00:35:43 -07:00
flash
ide
reports
toolchain host-tools.cmake: Corrected sdk download url 2019-03-21 09:07:53 -05:00
usage
util
ccache.cmake
cfb.cmake
dts.cmake
extensions.cmake zephyr_library_compile_options(): silently de-duplicate 2019-04-04 08:11:14 -04:00
extra_flags.cmake
fpu-for-gcc-m-cpu.cmake
gcc-m-cpu.cmake
generic_toolchain.cmake
git.cmake
hex.cmake
host-tools.cmake west: require version 0.5.6 2019-03-25 22:46:56 -04:00
kconfig.cmake kconfig: Move Kconfig.modules to the root build directory 2019-03-28 09:23:02 -04:00
kobj.cmake
pristine.cmake
python.cmake
target_toolchain.cmake
version.cmake
zephyr_module.cmake zephyr_module.cmake: restore ability to build without modules 2019-04-01 03:10:26 +08:00