cmake: Fix CMAKE_REQUIRED_FLAGS corruption

The --print-memory-usage check was accidentally corrupting the
CMAKE_REQUIRED_FLAGS variable due to a variable de-referencing bug.

This was affecting app CMakeLists.txt code that was using
CMAKE_REQUIRED_FLAGS.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2017-12-27 15:21:54 +01:00 committed by Anas Nashif
parent 5fb5adb34f
commit c34b7a3f65

View file

@ -807,10 +807,10 @@ if(CONFIG_OUTPUT_PRINT_MEMORY_USAGE)
set(option ${LINKERFLAGPREFIX},--print-memory-usage) set(option ${LINKERFLAGPREFIX},--print-memory-usage)
string(MAKE_C_IDENTIFIER check${option} check) string(MAKE_C_IDENTIFIER check${option} check)
set(SAVED_CMAKE_REQUIRED_FLAGS CMAKE_REQUIRED_FLAGS) set(SAVED_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${option}") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${option}")
check_c_compiler_flag("" ${check}) check_c_compiler_flag("" ${check})
set(CMAKE_REQUIRED_FLAGS SAVED_CMAKE_REQUIRED_FLAGS) set(CMAKE_REQUIRED_FLAGS ${SAVED_CMAKE_REQUIRED_FLAGS})
target_link_libraries_ifdef(${check} zephyr_prebuilt ${option}) target_link_libraries_ifdef(${check} zephyr_prebuilt ${option})
endif() endif()