New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export compile definitions for dependent targets #16834
Export compile definitions for dependent targets #16834
Conversation
b79362c
to
a29f491
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense. @tamiko ?
/rebuild |
@tjhei @gassmoeller @masterleinad Actually, no. We need to add the compile definitions to the This pull request simply works around the issue with our |
@gassmoeller Please have a look at the target configuration in So I am really not sure what issue you are working around here. I would like this changeset to be reverted and the issue to be fixed correctly. Edit: I am terribly sorry that I did not catch this pull request earlier. Let me elaborate a bit: Our goal is to move to the standard-CMake way of interfacing with external dependencies by using import targets. To this end the build system now supports this:
This means that everything necessary to compile correctly against the debug and release version has to be set as a target property on those two targets. (Which I just checked again - it is. Because if we would not set Now, of course we run into a couple of issues because of changing expectations: It is discouraged to set unnecessary compiler/linker flags as target property, because this creates a lot of problems for downstream projects. Thus, we only export the bare minimum of configuration to the two targets But in order to provide backward compatiblity we have a wrapper target |
@gassmoeller How can I reproduce the issue you have? |
I dont have time to look into this today, hopefully tomorrow (in the middle of a move), but I am ok reverting this if there is a better way. All I was seeing at the time was that NDEBUG was not picked up correctly by ASPECT when using the macro |
@tamiko: The simplest would be to run cmake for ASPECT in DebugRelease mode and check if it picks up NDEBUG correctly for release mode. It is a bit trickier, because I also made some changes to ASPECT CMakeLists in geodynamics/aspect#5621 and I dont remember how the issues were intertwined. |
@gassmoeller Roger. Checking. Edit: i can confirm that a small number of targets in aspect are not compiled with our compile definitions / compile flags. I have set up a modified deal.II that export
Here, the first two definitions come from the target definitions in In aspect, a huge majority of targets are also built with all definitions |
Thanks for checking. I will also take another look some time later, but in order to not disrupt the current build system let's move forward with #16924. |
I think #14491 accidentally removed the export of compile definitions from the cmake system (both from Config.cmake.in and the setup_target macro). They were still correctly set for compiling deal.II itself, but dependent targets would not pick them up and so e.g. algorithms in header files behave differently if they are executed from inside deal.II or outside (e.g.
#ifdef DEBUG
would be evaluated differently). Also the build output looks different (same flags different definitions) on dependent targets, which let me wonder for a while what we do wrong when outputting the ASPECT build configuration.ASPECT was also relying on the presence of NDEBUG definition for another dependent target to activate optimized mode (see discussion in #12503).
This change should restore the behavior before #14491.