I am working on some Native android project with CMake. Where I am having an issue stating above error.
I have created a method for logging from c files.
void log_android(int prio, const char *fmt, ...) {
if (prio >= loglevel) {
char line[1024];
va_list argptr;
va_start(argptr, fmt);
vsprintf(line, fmt, argptr);
__android_log_print(prio, TAG, line);
va_end(argptr);
}
}
While compiling this I am getting issue String is not String literal
on __android_log_print(prio, TAG, line);
near word line
.
It says its potentially insecure [-Werror,-Wformat-security]
After doing some R&D I found that I need to use certain cppFlags inside CMAKE
APP_CFLAGS += -Wno-error=format-security
. But I am not certain where should I place this code inside my CMakeLists.txt
.
I tried to use these methods inside CMakeLists.txt
set(compiler_c_flags "-Wno-error=format-security")
set(compiler_cpp_flags "-Wno-error=format-security")
But no success please help.