0

I want to add some flags to the c and c++ compiler in the following file. How should I do this so as not to encounter an error?

FLAGS = -O3 -g -fno-reorder-blocks-and-partition -Wl,--emit-relocs

Please also mention the flags that need to be removed for these flags to work.

file cmake in github

please guide me.

thanks.

this file is HPHPCompiler.cmake from HHVM project.

Zahra Heydari
  • 55
  • 1
  • 4
  • Best to check first, if the build type `RelWithDebInfo` already provides you with `-O3` and `-g` You adding debug info to ALL configurations would definetly be unexpected behaviour. – fabian Jul 02 '22 at 06:59
  • thanks @fabian . Please explain more if possible, I have very little knowledge about this. On the other hand, the -fno-reorder-blocks-and-partition -Wl, --emit-relocs flags are more important to me. Because I want the relocation mode of functions and blocks to be activated so that I can use optimizations such as BOLT. – Zahra Heydari Jul 02 '22 at 08:25
  • If you're asking about what I mean with "configuration": For single configuration generators such as `Unix Makefiles` you can specify [`CMAKE_BUILD_TYPE`](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html) as cache variable during configuration. As for adding other flags: The `add_compile_options` and `add_link_options` may work for you, with generator expressions for limiting the flags to some configurations. (I won't reaearch the the meaning/valid combinations of those flags and which compilers they are applicable to.) – fabian Jul 02 '22 at 08:37

0 Answers0