![]() The configure.cxxflags contain configure.optflags byĭefault. ![]() Therefore, be sure to add "-NDEBUG" to theĬonfigure.cflags if you want to turn off assertions in release builds! Otherwise overrule the optimization flags, as they are set by default ![]() They are set via the Release flags CMAKE_C_FLAGS_RELEASE, which would The configure.cflags contain configure.optflags by default. also toĬMake upstream ticket #12928 "CMake silently ignores CPPFLAGS" The compiler flags for all build types (CMAKE_C_FLAGS,ĬMAKE_CXX_FLAGS) are used, as they are usually empty. The configure.cppflags are added to the C/C++ compiler flags as CMakeĭoes not honor separately CPPFLAGS (it uses usually add_definitions()įor that). The configure.cppflags, configure.optflags, configure.cflags,Ĭonfigure.cxxflags, configure.ldflags are handled by setting the Improve the CMake PortGroup so that it handles the configure.*flags. Thus, Release builds are compiled with optimizationĠ002-Improve-CMake-PortGroup-to-handle-the-configure-flags.patch Ports, which are configured by CMake, honor the configure.optflags set This reverts the changes made to the CMake Portfile in r110069 so that Therefore, I had a look to the CMake port group to fix the issue with the following uploaded patches:Ġ001-Fix-the-CMake-port-specific-part-of-ticket-40648.patchįix the CMake-port-specific part of this ticket. Is there no blacklisting solution available? I’ve got a vague idea that we could write a function a bit like this, but it seems inelegant… I’m also not sure that CMAKE_CXX_FLAGS would actually populate those target properties.As a regular CMake user, I'm also affected by this annoying issue. If we then ever wanted to re-instate the foo flag, we’d have to remove that property from thousands of targets. The trouble is my code base is very large, so step (3) would involve adding a property to thousands of targets. Add the needs_foo property to every target apart from frobnicator.Add the above generator expression for the foo flag,.Remove foo from the flags that are applied to all targets (CMAKE_CXX_FLAGS at the moment, or the myflags INTERFACE in your example),.If I’ve understood correctly, the process for removing a flag “foo” from the “frobnicator” target would be something like this: I’m not sure how well whitelisting flags like that will work for me. If I set CMAKE_CXX_FLAGS as a non-cache variable, does it apply to all targets in the current directory and below? If I have two targets in the same directory, declare one, then change CMAKE_CXX_FLAGS and declare the other, are my new CMAKE_CXX_FLAGS applied to just the second target?).įor (2) the same work-around applies, but I wonder if there’s some way to entirely exclude a target from CMAKE_CXX_FLAGS, CMAKE_BUILD_TYPE, etc.? ![]() (Side note - the scoping rules are also not clear to me. It’s also prone to break in future when new build types are added. This is cumbersome, because the number of flags that need to be changed increases linearly with the number of CMAKE_BUILD_TYPEs. Some targets require their own entirely custom set of build flags, and don’t want to use CMAKE_CXX_FLAGS (and friends) at all.įor (1), the best idea I have is to get CMAKE_CXX_FLAGS and friends, manually remove the flags I don’t want, and re-set those variables on a directory level.However, I need to remove or disable certain flags for those targets, Some targets want almost all the compile flags given by CMAKE_CXX_FLAGS and friends.In the codebase in which I’m currently working, there are two scenarios where I might want to remove compile flags from a target: ![]()
0 Comments
Leave a Reply. |