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
This commit is contained in:
parent
4494ce468a
commit
2b2c196558
@ -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 ()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user