Commit c8593981 authored by Tom Finegan's avatar Tom Finegan

Explicitly support user supplied flags in the CMake build.

Add AOM_EXTRA_<TYPE>_FLAGS variables. Currently AS, C, CXX, and
LINKER are the available type values. These variables are added
to argument strings for each type as the last step in generation
to ensure that user flags have precedence over flags added by
the AOM build itself.

Change-Id: I8e01682ee6c7dad2253e01c446a5ced7d06596c7
parent 282e9f25
......@@ -454,6 +454,9 @@ if (BUILD_SHARED_LIBS)
set_target_properties(aom PROPERTIES SOVERSION 0)
endif ()
# Handle user supplied compile and link flags last to ensure they're obeyed.
set_user_flags()
# Aomedia documentation rule.
if (ENABLE_DOCS)
include(FindDoxygen)
......
......@@ -320,4 +320,37 @@ function (require_linker_flag flag)
endif ()
endfunction ()
# Appends flags in $AOM_EXTRA_<TYPE>_FLAGS variables to the flags used at build
# time.
function (set_user_flags)
# Linker flags are handled first because some C/CXX flags require that a
# linker flag is present at link time.
if (AOM_EXTRA_EXE_LINKER_FLAGS)
is_flag_present(AOM_EXE_LINKER_FLAGS "${AOM_EXTRA_EXE_LINKER_FLAGS}"
extra_present)
if (NOT ${extra_present})
require_linker_flag("${AOM_EXTRA_EXE_LINKER_FLAGS}")
endif ()
endif ()
if (AOM_EXTRA_AS_FLAGS)
# TODO(tomfinegan): assembler flag testing would be a good thing to have.
is_flag_present(AOM_AS_FLAGS "${AOM_EXTRA_AS_FLAGS}" extra_present)
if (NOT ${extra_present})
append_flag(AOM_AS_FLAGS "${AOM_EXTRA_AS_FLAGS}")
endif ()
endif ()
if (AOM_EXTRA_C_FLAGS)
is_flag_present(AOM_C_FLAGS "${AOM_EXTRA_C_FLAGS}" extra_present)
if (NOT ${extra_present})
require_c_flag("${AOM_EXTRA_C_FLAGS}" YES)
endif ()
endif ()
if (AOM_EXTRA_CXX_FLAGS)
is_flag_present(AOM_CXX_FLAGS "${AOM_EXTRA_CXX_FLAGS}" extra_present)
if (NOT ${extra_present})
require_cxx_flag("${AOM_EXTRA_CXX_FLAGS}" YES)
endif ()
endif ()
endfunction ()
endif () # AOM_BUILD_CMAKE_COMPILER_FLAGS_CMAKE_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment