Bug #2650
setting cxxflags might be incompatible to CMAKE_BUILD_TYPE-induced settings
Status: | Closed | Start date: | 09/06/2016 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | J. Moringen | % Done: | 0% | |
Category: | - | |||
Target version: | 0.7 |
Description
Setting cxxflags leads to the option -DCMAKE_CXX_FLAGS=${cxxflags}.
However, you also set -DCMAKE_BUILD_TYPE=RelWithDebInfo.
In standard cmake this leads to a combination of flags like so: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO},
which may override settings taken in cxxflags. Is this intended?
History
#1 Updated by J. Moringen over 6 years ago
R. Haschke wrote:
Setting cxxflags leads to the option -DCMAKE_CXX_FLAGS=${cxxflags}.
However, you also set -DCMAKE_BUILD_TYPE=RelWithDebInfo.
In standard cmake this leads to a combination of flags like so: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO},
which may override settings taken in cxxflags. Is this intended?
I think it is. Lars implemented the current behavior with the rationale that CXX_FLAGS
should work across all project natures.
Did you run into problems with this behavior?
As an aside: this project only contains the source code of the generator. The issue at hand is related to templates which are maintained in https://opensource.cit-ec.de/projects/citk/repository
#2 Updated by R. Haschke over 6 years ago
I didn't run into serious issues. But a -O1 option which I have set on purpose in cxxflags was overriden by CMAKE_CXX_FLAGS_RELWITHDEBINFO.
#3 Updated by L. Schillingmann over 6 years ago
Lets check on a way to remove this default behaviour if any intentional compiler flag configuration is set.
#4 Updated by R. Haschke over 6 years ago
I guess, the template and variable replacement mechanism is not powerful enough to do so. You would need an if-clause, wouldn't you?
#5 Updated by R. Haschke over 6 years ago
I pushed some changes to make CMAKE_BUILD_TYPE configurable along with cxxflags (using variable cmake.build.type). This will resolve the issue.
The default of this variable is RelWithDebInfo (Debug in ci), thus preserving previous behaviour.
I also cleaned up the templates a little bit and cherry-picked some stuff from our lsp-famula branch into master.
#6 Updated by J. Moringen over 6 years ago
- Status changed from New to Feedback
We're done with this issue, right?
#7 Updated by R. Haschke over 6 years ago
If you like my changes, yes ;-)
#8 Updated by J. Moringen over 6 years ago
- Status changed from Feedback to Closed
R. Haschke wrote:
If you like my changes, yes ;-)
The changes are pushed to master already. Thus all amendments should be tracked in separate issues on opensource.cit-ec.de .
#9 Updated by L. Schillingmann over 6 years ago
Thanks Robert. Checked my current distribution. At least your changes do not cause any breakage so far ;)
#10 Updated by J. Moringen over 6 years ago
- Target version set to 0.8
#11 Updated by J. Moringen over 6 years ago
- Assignee set to J. Moringen
- Target version changed from 0.8 to 0.7