From 2b2c19655891c3620cee521b704349f57f6cea9a Mon Sep 17 00:00:00 2001 From: Tom Finegan Date: Mon, 23 Jan 2017 10:58:45 -0800 Subject: [PATCH] cmake: Fix required flag check. It always passed after first test due to lack of CACHE in unset() call. Also: - Fix flag name in error message. - Use actual flag instead of hard coded -std=c++11 Change-Id: I29c0dc4fd0f5ce97f658919a5739e15831a00281 --- build/cxx_flags.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/cxx_flags.cmake b/build/cxx_flags.cmake index 8cb9bd0..9e96889 100644 --- a/build/cxx_flags.cmake +++ b/build/cxx_flags.cmake @@ -42,14 +42,14 @@ function (require_cxx_flag cxx_flag) string(FIND "${CMAKE_CXX_FLAGS}" "${cxx_flag}" CXX_FLAG_FOUND) if (${CXX_FLAG_FOUND} EQUAL -1) - unset(LIBWEBM_HAVE_CXX_FLAG) + unset(LIBWEBM_HAVE_CXX_FLAG CACHE) message("Checking CXX compiler flag support for: " ${cxx_flag}) check_cxx_compiler_flag("${cxx_flag}" LIBWEBM_HAVE_CXX_FLAG) if (NOT LIBWEBM_HAVE_CXX_FLAG) message(FATAL_ERROR - "${PROJECT_NAME} requires support for CXX flag: ${flag}.") + "${PROJECT_NAME} requires support for CXX flag: ${cxx_flag}.") endif () - set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}" CACHE STRING "" FORCE) + set(CMAKE_CXX_FLAGS "${cxx_flag} ${CMAKE_CXX_FLAGS}" CACHE STRING "" FORCE) endif () endfunction ()