cmake: move testing of compile flag in environment to top CMakeLists.txt
This moves the test of compile flags set in environment from generic toolchain to top-level ${ZEPHYR_BASE}/CMakeLists.txt. In order to cleanup and make Zephyr CMake modules more generic then the testing of specific compile flags and warn user is not really a toolchain module responsible but a implementation detail of the project itself as to how compile flags should be applied in a project. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
356960bcb5
commit
9a12f8b68b
|
@ -131,6 +131,17 @@ foreach(optional_include_dir
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
# Don't inherit compiler flags from the environment
|
||||||
|
foreach(var AFLAGS CFLAGS CXXFLAGS CPPFLAGS LDFLAGS)
|
||||||
|
if(DEFINED ENV{${var}})
|
||||||
|
message(WARNING "The environment variable '${var}' was set to $ENV{${var}}, "
|
||||||
|
"but Zephyr ignores flags from the environment. Use 'cmake "
|
||||||
|
"-DEXTRA_${var}=$ENV{${var}}' instead."
|
||||||
|
)
|
||||||
|
unset(ENV{${var}})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
zephyr_compile_definitions(
|
zephyr_compile_definitions(
|
||||||
KERNEL
|
KERNEL
|
||||||
__ZEPHYR__=1
|
__ZEPHYR__=1
|
||||||
|
|
|
@ -20,15 +20,6 @@ if(NOT TOOLCHAIN_ROOT)
|
||||||
endif()
|
endif()
|
||||||
zephyr_file(APPLICATION_ROOT TOOLCHAIN_ROOT)
|
zephyr_file(APPLICATION_ROOT TOOLCHAIN_ROOT)
|
||||||
|
|
||||||
# Don't inherit compiler flags from the environment
|
|
||||||
foreach(var AFLAGS CFLAGS CXXFLAGS CPPFLAGS LDFLAGS)
|
|
||||||
if(DEFINED ENV{${var}})
|
|
||||||
message(WARNING "The environment variable '${var}' was set to $ENV{${var}},
|
|
||||||
but Zephyr ignores flags from the environment. Use 'cmake -DEXTRA_${var}=$ENV{${var}}' instead.")
|
|
||||||
unset(ENV{${var}})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# Host-tools don't unconditionally set TOOLCHAIN_HOME anymore,
|
# Host-tools don't unconditionally set TOOLCHAIN_HOME anymore,
|
||||||
# but in case Zephyr's SDK toolchain is used, set TOOLCHAIN_HOME
|
# but in case Zephyr's SDK toolchain is used, set TOOLCHAIN_HOME
|
||||||
if("${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "zephyr")
|
if("${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "zephyr")
|
||||||
|
|
Loading…
Reference in New Issue