-
Notifications
You must be signed in to change notification settings - Fork 881
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
Fix header file installation to respect CMAKE_INSTALL_INCLUDEDIR
#1125
Conversation
Previously, header files were installed uniformly under the include directory, ignoring the specified paths. This change ensures header files are installed in the appropriate directories under `CMAKE_INSTALL_INCLUDEDIR`.
0073acf
to
724d1aa
Compare
Thank you for addressing it every time. |
Let me confirm what you mean.
Is that right? It seems that github automatically edit the link on this comment. Here is non linked the same text:
|
I think that I misunderstand about #1124. #1124 is more fundamental approach. My decisionI will merge #1125 Then, I will release the merged c_master as c-6.0.2. If more fundamental solution is implemented (based on #1124), I will check it and merge it if it is better solution in the future. |
@redboltz
Sure. I think the current change in #1124 is a little bit. So I think we can handle it step by step to improve maintainability. |
When
CMAKE_INSTALL_INCLUDEDIR
are set to absolute path or relative path, the header files is installed in unspecifed places. This leads to incorrect paths that prevent the compiler from locating necessary header files.How to reproduce
Configure msgpack-c with
-DCMAKE_INSTALL_PREFIX=/tmp/local
and-DCMAKE_INSTALL_INCLUDEDIR=specified-include
And then build and install msgpack-c.
Compile
example/simple_c.c
using installed msgpack-c. The following error happens because the linker cannot find header files.Expected
Successfully compile
example/simple_c.c
using installed msgpack-c. We can execute simple_c like the following.Explain the problem in detail
The issue was caused by header files being installed under a uniform include directory, ignoring the specified
CMAKE_INSTALL_INCLUDEDIR
path. This resulted in incorrect paths during the installation process, causing the compiler to be unable to locate the necessary header files.For example, in the
How to reproduce
case, we expected that header files would be installed at/tmp/local/specified-include
because we passed-DCMAKE_INSTALL_PREFIX=/tmp/local
and-DCMAKE_INSTALL_INCLUDEDIR=specified-include
. And also, pkg-config expected this path too.However, these header files are installed under
/tmp/local/include/
, which is why the compiler cannot find the header files.Solution
The solution involves modifying the
CMakeLists.txt
to ensure that the header files are installed in the directories specified byCMAKE_INSTALL_INCLUDEDIR
.