Ask Your Question

Revision history [back]

How to add compiler flags to some auto-generated cpp files in the CMake process?

Hi all,

I'm trying to compile OpenCV 3.4.0 while enabling the flag -mtune=cortex-57.cortex-53 for some Aarch64 platform. The thing is that if I enable this flag the compiler crashes when compiling whatever file that includes the accum.simd.hpp header file, which defines some functions for using NEON instruction. This is a known issue in other projects like here!topic/webm-discuss/_Y3Q0CkL2t0.

I have been able to partially solve this after overriding this specific flag for the file ./modules/imgproc/src/accum.dispatch.cpp (which is a file that adds the mentioned header) by adding the next line in the ./modules/imgproc/CMakeList.txt: set_target_properties(src/accum.dispatch.cpp COMPILE_FLAGS -mtune=generic)

However, there are also some files (at least one) that is auto-generated when configuring OpenCV through CMake such as accum.neon.cpp, which also includes accum.simd.hpp, so it makes the compiler crashes. I tried to use the same kind of solution as before, but I do not know how to add flags in CMake to these auto-generated flags. ┬┐Do you know how to do it?

Thanks in advance!