Skip to content

FIX: separated situation of building/installing on target_include_directories on cmake - #1966

Merged
dsnopek merged 1 commit into
godotengine:masterfrom
dalmurii:contrib
Apr 14, 2026
Merged

dsnopek merged 1 commit into
godotengine:masterfrom
dalmurii:contrib

Conversation

@dalmurii

@dalmurii dalmurii commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Basically it is not about "making export enabled". I am talking about a simple policy that included directories(for headers) must not be children of where root CMakeLists.txt is when being exported.
This check is hard-coded behaviour not to confuse the system, since installation in this context stands for a situation that several wanted files(headers, library files, etc) should move to another path then original.

Since we are not making any exportation of godot-cpp itself, you do not need to understand those to understand this request I am writing.

For detail, my stupid macro generator interface library is marked (could be installed) refers to godot-cpp, which expects godot-cpp to separate the directory to include.

Reading first sentence of this paragraph would help in this case.

@dalmurii
dalmurii requested a review from a team as a code owner April 7, 2026 14:04
@Ivorforce
Ivorforce requested a review from enetheru April 7, 2026 16:33
@Ivorforce Ivorforce added bug This has been identified as a bug cmake labels Apr 7, 2026
@enetheru

enetheru commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

@dalmurii
I'm happy to approve code that I understand the reason for, so I want you to imagine what it's like to receive a change with no description, no link to an issue, no conversation, etc. What appears obvious to you is not obvious to others, so without any context, what is one to understand from this change? What problem does it solve? What does it enable?

So for now, I await an update.

@dalmurii

dalmurii commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor Author

@enetheru

Sorry for lack of explanation.

CMake strictly requires the separation when adding inclusion for directories for C/C++.

Directory to include should not be prefixed by source (where the CMakeLists.txt) for installation, since guaranteeing installing will happen on source is barely possible.

Existing source was including full path of directory without condition, and that breaks the exportation of target being installed referring to it according to above.

I have branched it by two with generator expressions to fix this behaviour.

@enetheru

enetheru commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

We don't use any installation things at all right now, for reasons. This would be the first piece of code that explicitly caters to installation if merged.

Can you tell me about your extension workflow and how you currently use installation in that workflow?

@dalmurii

dalmurii commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

We don't use any installation things at all right now, for reasons. This would be the first piece of code that explicitly caters to installation if merged.

Can you tell me about your extension workflow and how you currently use installation in that workflow?

While installation is not possible in godot-cpp, one might want to export this project with his own.

I am the one trying this and faced this.

@dalmurii

dalmurii commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

Following is problematic on my side:

target_link_libraries(libdne-common # generated one with install
INTERFACE
	godot-cpp            # exported
	ae2f::Core 
	ae3f::met2d
	)

# godot-cpp now can be installed.
# tries also finding directories to include
# crashes when source-prefixed.
install(TARGETS godot-cpp EXPORT commonTargets)

Like this, godot-cpp could be installed despite the lack of installation script.

@enetheru

@enetheru

enetheru commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

OK excellent, thanks for providing more info.

If I am understanding you correctly, you're producing middle-ware using godot-cpp, that would be consumed by a third party(could also be your own project). CMake export workflow requires separation of the build/install to work properly.

Is that about right? I have to spend some time re-learning the install/export/import workflow that a lot of CMake user use.
Things like superbuilds, and in house pre-build distributions and the like could be supported with some changes like yours.

These things have been requested in the past, only to be shut down because they act too much like installs and we don't want package maintainers to start packaging godot-cpp. While we still don't want package maintainers to create packages, supporting the widely used export/import workflow is now OK.

I just haven't spent the time to really get stuck into it. I'll try to block out some time, so if you have any resources that will shorten my learning curve, feel free to link them.

@enetheru

enetheru commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

Since we don't have any other install/export based code in the repo, would making the files BUILD_INTERFACE only still work for you? Or do you need the INSTALL_INTERFACE for your project?

@dalmurii

dalmurii commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

I would check as soon as possible and if remove install interface part when not strictly necessary

@dalmurii

dalmurii commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

I have not seen above truely sorry, I am now responding it.
Basically it is not about "making export enabled". I am talking about a simple policy
that included directories(for headers) must not be children of where root CMakeLists.txt is when being exported.
This check is hard-coded behaviour not to confuse the system, since installation in this context stands for a situation that several wanted files(headers, library files, etc) should move to another path then original.

Since we don't have any other install/export based code in the repo, would making the files BUILD_INTERFACE only still work for you? Or do you need the INSTALL_INTERFACE for your project?

Turns out INSTALL_INTERFACE is not required since I am making a shared object and that needs no header to run for my use case. I am bloody idiot. I will remove any changes related to adding INSTALL_INTERFACE.

If I am understanding you correctly, you're producing middle-ware using godot-cpp, that would be consumed by a third party(could also be your own project). CMake export workflow requires separation of the build/install to work properly.

You are understanding correctly. For detail, my stupid macro generator interface library is marked (could be installed) refers to godot-cpp, which expects godot-cpp to separate the directory to include.

have to spend some time re-learning the install/export/import workflow that a lot of CMake user use. Things like superbuilds, and in house pre-build distributions and the like could be supported with some changes like yours.

So since we are not making any exportation of godot-cpp itself, you do not need to understand those to understand this request I am writing.

I just haven't spent the time to really get stuck into it. I'll try to block out some time, so if you have any resources that will shorten my learning curve, feel free to link them.

Reading first sentence of this paragraph would help in this case.

@enetheru

enetheru commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

Great, I'm glad I we seem to have an understanding, I'll approve the merge now as the changes are appropriate, just squash the commits, and we'll get someone to approve the workflow.

Cheers.
@dsnopek, @Ivorforce can we get an approval for the workflow? I don't have access.

dalmurii added a commit to dalmurii/godot-cpp that referenced this pull request Apr 8, 2026
…ectories on cmake

SEE:	godotengine#1966

 Changes to be committed:
	- modified:   binding_generator.py
	- modified:   cmake/godotcpp.cmake
	- modified:   include/godot_cpp/core/object.hpp
@dalmurii

dalmurii commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

Commits has been squashed.

@enetheru enetheru left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Preventing the fully qualified paths from ending up in middle ware extensions that do want to perform install/export is a good thing.

There are probably more things that we can to towards this end, but for now this solves a real problem for someone so I approve.

@enetheru enetheru left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

some additional changes have crept in that sholdnt be there.

@dalmurii

dalmurii commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

I think I've falsely squashed? I will try staging only one file manually

@enetheru

enetheru commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

And if you can edit the description for anyone who views in the future that would also be good, cheers.

dalmurii added a commit to dalmurii/godot-cpp that referenced this pull request Apr 8, 2026
…ectories on cmake

SEE:	godotengine#1966

 Changes to be committed:
	- modified:   cmake/godotcpp.cmake
@dalmurii

dalmurii commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

I have not seen above truely sorry, I am now responding it. Basically it is not about "making export enabled". I am talking about a simple policy that included directories(for headers) must not be children of where root CMakeLists.txt is when being exported. This check is hard-coded behaviour not to confuse the system, since installation in this context stands for a situation that several wanted files(headers, library files, etc) should move to another path then original.

Since we don't have any other install/export based code in the repo, would making the files BUILD_INTERFACE only still work for you? Or do you need the INSTALL_INTERFACE for your project?

Turns out INSTALL_INTERFACE is not required since I am making a shared object and that needs no header to run for my use case. I am bloody idiot. I will remove any changes related to adding INSTALL_INTERFACE.

If I am understanding you correctly, you're producing middle-ware using godot-cpp, that would be consumed by a third party(could also be your own project). CMake export workflow requires separation of the build/install to work properly.

You are understanding correctly. For detail, my stupid macro generator interface library is marked (could be installed) refers to godot-cpp, which expects godot-cpp to separate the directory to include.

have to spend some time re-learning the install/export/import workflow that a lot of CMake user use. Things like superbuilds, and in house pre-build distributions and the like could be supported with some changes like yours.

So since we are not making any exportation of godot-cpp itself, you do not need to understand those to understand this request I am writing.

I just haven't spent the time to really get stuck into it. I'll try to block out some time, so if you have any resources that will shorten my learning curve, feel free to link them.

Reading first sentence of this paragraph would help in this case.

Would summarising this enough?

@enetheru
enetheru self-requested a review April 8, 2026 13:23

@enetheru enetheru left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@enetheru

enetheru commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

Would summarising this enough?

good plan.

@dalmurii

dalmurii commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

Checks seems to be failing? I will try resolving gersemi thing.

@Ivorforce

Copy link
Copy Markdown
Member

I recommend installing pre-commit and just running it locally. Saves you from guessing the correct indentation / style to use.

…ectories on cmake

SEE:	godotengine#1966

 Changes to be committed:
	- modified:   cmake/godotcpp.cmake
@dalmurii

dalmurii commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor Author

I recommend installing pre-commit and just running it locally. Saves you from guessing the correct indentation / style to use.

Oh this is very convenient

@dalmurii

Copy link
Copy Markdown
Contributor Author

Do I have additional job required?

@enetheru

Copy link
Copy Markdown
Collaborator

Do I have additional job required?

nah, things just take time.

@dsnopek
dsnopek merged commit 4862a9d into godotengine:master Apr 14, 2026
10 checks passed
@dsnopek

dsnopek commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

Thanks!

@dalmurii
dalmurii deleted the contrib branch April 15, 2026 00:50
@dalmurii

Copy link
Copy Markdown
Contributor Author

Appreciation from me as a contribution beginner for direction kind sir

Ivorforce pushed a commit to Ivorforce/godot-cpp that referenced this pull request Jun 8, 2026
…ectories on cmake

SEE:	godotengine#1966

 Changes to be committed:
	- modified:   cmake/godotcpp.cmake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This has been identified as a bug cherrypick:4.5 cmake

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants