-
Notifications
You must be signed in to change notification settings - Fork 225
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
Issue using KTX-Software when fmt is already included #786
Comments
@aqnuep what is your recommendation? |
One way to fix this is to do a find_package for {fmt} and only if not found use the copy in this repo. @aqnuep? |
@M-Gjerde why are you including KTX-Software as a submodule with the CLI tools enabled? As a submodule you should only need the library so should set KTX_FEATURE_TOOLS to OFF. Without the tools, {fmt} will not be included. |
@MarkCallow Thank you for getting back to me. You're right, I'm not using the CLI tools when I use KTX as a submodule. However, setting KTX_FEATURE_TOOLS to OFF still includes fmt though. |
Thank you for the report. I'll fix that in the near future. |
Thank you, I appreciate that. |
Re-opening to remind me to fix the problem. |
I fixed this in a fork by checking if the target if(NOT TARGET fmt::fmt)
set(FMT_SYSTEM_HEADERS ON)
add_subdirectory(other_projects/fmt)
endif() I saw this being used in a CMake template. I could make a pull request with this change if it seems like a good way to fix it (it could also be used with other dependecies). |
I believe such a solution could work. Although I'd certainly try out using e.g. the |
The first fix is to put the following lines in CMakeLists.txt [EDIT: Not sure why the above link isn't causing the lines to be shown here. Apologies.] into an
block. If people actually want to build the tools with other projects that are already using fmt then we can add what is proposed here:
|
How to use installed in system libfmt? Why use embedded one? |
My dirty hack:
LDFLAGS+= -lfmt -L/usr/local/lib |
This has already been fixed, maybe an update to the latest commit on the master branch will solve this for you. |
I'm using last release 4.3.1. |
Does the standard build fail in the presence of a "system installed" libfmt or is it that you want to use the system one?
Because not everyone has a system-installed libfmt and because, as it is part of C++20, the need for such libraries and the libraries will disappear. |
Install stage failed - tried install include/fmt/*.h files which conflicts with files from system-installed libfmt.
Can I set |
What exact install command did you use. What system are you using? The installable packages produced by this project do not include any fmt/*.h headers. They are not needed in order to use libktx.
Build with C++20 hasn't been tested. I expect it will still use the embedded {fmt} library. I'd be happy to accept a PR to make the build work with C++20 provided a build with C++11 still works. |
FreeBSD 13.2-p10 amd64. Log of the install stage:
/tmp/work/usr/ports/graphics/khronos-texture/work/.build/cmake_install.cmake have lines:
/tmp/work/usr/ports/graphics/khronos-texture/work/.build/other_projects/fmt/cmake_install.cmake have lines:
Will |
With
|
It looks like this is happening because of the include of the fmt directory in the KTX-Software I'm not familiar with
This is what is run by the package builder and the packages do not include the fmt includes. |
|
Please try adding
just before line 1073 in KTX-Software's root CMakeList.txt and report back. |
Thanks!
Or build with |
Great. Please open a new issue with a title something like "Project install installs fmt lib", reference the patch in the comment above and the comment with the install log. I'll add the fix to the next release. The issue is to make sure I don't forget. |
Done. |
So I updated KTX-Software to a later release and it seems fmt as been added as a dependency to KTX-Software.
My issue is that I use KTX-Software as a submodule myself alongside fmt which makes my project break with:
[INFO] Adding FMT from directory: external/fmt
CMake Error at external/fmt/CMakeLists.txt:50 (add_library):
add_library cannot create target "fmt" because another target with the same
name already exists. The existing target is a static library created in
source directory
"----/KTX-Software/other_projects/fmt".
See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
external/fmt/CMakeLists.txt:285 (add_module_library)
Is there a way you can make fmt for KTX-Software optional? Or supply with an already built target?
Best Regards
The text was updated successfully, but these errors were encountered: