Commit 85ef2342 authored by Tom Finegan's avatar Tom Finegan

Add cmake utility functions for setting C/CXX/AS/LD flags.

BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76

Change-Id: I495d50eec653d67e44929a8317e308e9c9570e00
parent 37e0cb10
......@@ -119,7 +119,8 @@ function (add_asm_library lib_name asm_sources dependent_target)
set(asm_object "${asm_lib_obj_dir}/${asm_source_name}.o")
add_custom_command(OUTPUT "${asm_object}"
COMMAND ${YASM_EXECUTABLE}
ARGS -f ${objformat}
ARGS ${AOM_AS_FLAGS}
-f ${objformat}
-I${AOM_ROOT} -I${AOM_CONFIG_DIR}
-o "${asm_object}" "${asm_source}"
DEPENDS "${asm_source}"
......
......@@ -171,3 +171,50 @@ function (add_preproc_definition preproc_def)
add_c_preproc_definition(${preproc_def})
add_cxx_preproc_definition(${preproc_def})
endfunction ()
# Adds $flag to assembler command line.
function (append_as_flag flag)
unset(AS_FLAG_FOUND CACHE)
string(FIND "${AOM_AS_FLAGS}" "${flag}" AS_FLAG_FOUND)
if (${AS_FLAG_FOUND} EQUAL -1)
set(AOM_AS_FLAGS "${AOM_AS_FLAGS} ${flag}" CACHE STRING "" FORCE)
endif ()
endfunction ()
# Adds $flag to the C compiler command line.
function (append_c_flag flag)
unset(C_FLAG_FOUND CACHE)
string(FIND "${CMAKE_C_FLAGS}" "${flag}" C_FLAG_FOUND)
if (${C_FLAG_FOUND} EQUAL -1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}" CACHE STRING "" FORCE)
endif ()
endfunction ()
# Adds $flag to the CXX compiler command line.
function (append_cxx_flag flag)
unset(CXX_FLAG_FOUND CACHE)
string(FIND "${CMAKE_CXX_FLAGS}" "${flag}" CXX_FLAG_FOUND)
if (${CXX_FLAG_FOUND} EQUAL -1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" CACHE STRING "" FORCE)
endif ()
endfunction ()
# Adds $flag to the C and CXX compiler command lines.
function (append_compiler_flag flag)
append_c_flag(${flag})
append_cxx_flag(${flag})
endfunction ()
# Adds $flag to the executable linker command line.
function (append_exe_linker_flag flag)
unset(LINKER_FLAG_FOUND CACHE)
string(FIND "${CMAKE_EXE_LINKER_FLAGS}" "${flag}" LINKER_FLAG_FOUND)
if (${LINKER_FLAG_FOUND} EQUAL -1)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}" CACHE STRING
"" FORCE)
endif ()
endfunction ()
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