Skip to content

Ensure module output directory is generated in configure stage #521

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

Merged
merged 1 commit into from
Oct 2, 2021

Conversation

awvwgk
Copy link
Member

@awvwgk awvwgk commented Sep 11, 2021

  • dependent projects using the stdlib's build interface will resolve the module output directory before it is created and error without this fix

- subprojects using the stdlib's build interface will resolve the module
  output directory before it is created and error without this fix
@awvwgk awvwgk added the reviewers needed This patch requires extra eyes label Sep 11, 2021
@awvwgk awvwgk requested review from jvdp1 and milancurcic September 18, 2021 08:42
@awvwgk awvwgk added the build: cmake Issue with stdlib's CMake build files label Sep 18, 2021
@ivan-pi
Copy link
Member

ivan-pi commented Sep 20, 2021

Is this something I can test, by forking stdlib-cmake-example and trying to build a project with several modules?

@awvwgk
Copy link
Member Author

awvwgk commented Sep 20, 2021

I'm already fixing this behaviour in the CMake example, you would have to remove my fix from there first to check:

https://github.com/fortran-lang/stdlib-cmake-example/blob/61e5fb0a1df900d8ebfe216b0f60f1a5eeefcdf9/config/cmake/Findfortran_stdlib.cmake#L149-L151

@awvwgk
Copy link
Member Author

awvwgk commented Sep 25, 2021

Won't happen with a single dependency, so this can't be tested with the CMake example.

I usually hit issues with non-existent include directories when working with five to six interdependent CMake projects and multiple levels of dependencies, looks something like this:

CMake Error in CMakeLists.txt:
  Imported target "toml-f::toml-f" includes non-existent path

    "/home/awvwgk/projects/src/git/mctc-tools/tblite/__build/_deps/toml-f-build/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

This error is usually gone on the second CMake run since all module directories are generated after the first run, even if it was unsuccessful because one target tried to access the module directory of a dependency before it was created.

I'm usually fixing this in my find modules by moving the module directory generation to an earlier point. Did cost me some time to figure this out and it is a quite unintuitive error. I guess users of stdlib have a low chance of ever encountering this issue and if they are able to build the required complexity in CMake they might also be able to figure out the hack to fix this. Still, it would be preferable if we can mitigate this issue directly in stdlib.

Copy link
Member

@ivan-pi ivan-pi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not well versed in CMake, but the change is small and I trust you have tested this so +1.

As a side note: do you think it makes sense to add a link in your comment, e.g. "see PR #521", or is this unnecessary because it can always be queried using git?

Copy link
Member

@milancurcic milancurcic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. Thank you.

@awvwgk awvwgk removed the reviewers needed This patch requires extra eyes label Oct 2, 2021
@awvwgk awvwgk merged commit 5905dfb into fortran-lang:master Oct 2, 2021
@awvwgk awvwgk deleted the mkdir branch October 2, 2021 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build: cmake Issue with stdlib's CMake build files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants