[arch-general] Removing compiler flag from CMake output

Delcypher delcypher at gmail.com
Thu Oct 9 14:26:57 UTC 2014


> How do I remove that compiler flag from CMake output?
>
> I already tried adding -frtti to CXXFLAGS in makepkg.conf, but this
> didn't change the compiler flags. I also tried to add it as an
> environment variable to the cmake call in PKGBUILD and add a
>
> set(CMAKE_CXX_FLAGS "-frtti")

That isn't a good idea that overwrites CMAKE_CXX_FLAGS entirely rather
than appending.

Regardless of that there are several ways of specifying flags. It can
be done at the target level (e.g. target_compile_definitions(mylib
COMPILE_OPTIONS ...) ) or globally using CMAKE_CXX_FLAGS_*. There are
several flags for different release types, e.g.

CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_RELEASE
CMAKE_CXX_FLAGS

I believe there are other ways to set flags as well. You should look
at how the developers have set their flags in their CMakeLists.txt
files and do it the same way.

As a hack you could check what's set the CMake cache and manually change it

$ make edit_cache

HTH


More information about the arch-general mailing list