Ask Your Question

Build with optimization flags

asked 2019-04-19 05:59:50 -0500

alcoan gravatar image

I would like to build opencv4 with the following optimization flags:

-march=native -O3 -flto

What is the right way to specify those flags?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-04-19 10:40:24 -0500

Yashas gravatar image

updated 2019-06-23 11:10:51 -0500

You can add -march=native -O3 to CMAKE_CXX_FLAGS (or to CMAKE_CXX_FLAGS_config where config is RELEASE, DEBUG, etc).

You can enable LTO by setting ENABLE_LTO build option.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-04-19 05:59:50 -0500

Seen: 96 times

Last updated: Jun 23