-
Notifications
You must be signed in to change notification settings - Fork 145
CMake: Fix LIBDATADIR default and use FULL_INCLUDEDIR for installed targets #1422
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
base: master
Are you sure you want to change the base?
Conversation
@hyyoxhk can you provide log? |
Sorry for the unclear description, I revised the title and content here is the log for building fcitx5-qt in yocto
patch-1 fixed this bug patch-2 fixes the problem that I cannot find FCITX_INSTALL_LIBDATADIR correctly in the board
|
Ok, what you really want to do is:
The reason that you need to do this is you want to cross compile or whatever, the final install prefix will be /prefix/a, but you have to build it under a different prefix |
Yes, that's it. |
I can't reproduce the double path thing for libdatadir. What's the exact parameter you used? And also, the first thing you hit isn't "couldn't find Fcitx5CompilerSettings?" how did you avoid that? I have my own solution here but I wonder if you have already done anything? |
fcitx5's Compilation parameters (from yocto do_configure) fcitx5-qt's Compilation parameters (from yocto do_configure)
I just add CMAKE_SYSROOT to find additional Fcitx5CompilerSettings.cmake --- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,7 +59,7 @@ if (BUILD_ONLY_PLUGIN)
# Dup a little bit option here.
include(CompilerSettings)
else()
-include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
+include("${CMAKE_SYSROOT}${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
find_package(Gettext REQUIRED)
endif() |
Building fcitx5-qt () in Yocto/OpenEmbedded failed during the do_configre step due to search-time path handling. The generated install interfaces used non-absolute include paths, and LIBDATADIR resolution conflicted with DESTDIR/sysroot staging.
This patch ensures installed targets expose absolute include directories in their INTERFACE properties.
In the top-level CMakeLists.txt, set the default for CMAKE_INSTALL_LIBDATADIR to ${CMAKE_INSTALL_LIBDIR} (non-full), and then let GNUInstallDirs_get_absolute_install_dir compute the absolute CMAKE_INSTALL_FULL_LIBDATADIR. This avoids double-prefix issues under DESTDIR.
Rationale: Yocto relocates installs into a staged sysroot, and absolute include directories in installed target interfaces avoid incorrect or non-relocatable paths. Deferring LIBDATADIR to the non-full variant prevents incorrect path composition when the absolute path is computed later, fixing the do_configure error.
Impact: No behavior change for standard builds. Fixes installation in Yocto/OE environments; aligns with common CMake packaging practices for exported targets.
Motivation: This fix was made because software that depends on fcitx5 failing to do_configure in Yocto.