EditorConfig support is going to be added to KTextEditor (D4537), but it needs to make it possible to call find_package(editorconfig), similarly as it’s done with LibGit2.
This diff is a copy of https://github.com/editorconfig/editorconfig-core-lua/blob/master/cmake/Modules/FindEditorConfig.cmake.
Details
- Reviewers
gszymaszek alexmerry - Group Reviewers
Frameworks Build System - Commits
- R39:6fa17cdccc06: add FindEditorConfig to ktexteditor if that proves to be useful, can be moved…
Diff Detail
- Repository
- R240 Extra CMake Modules
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Correct is that we want to write
find_package(editorconfig "0.12.0)
i.e., with a version. This is missing in this find module, see the LibGit2 find module. Could you extend this?
It seems there isn’t any version string in library headers (editorconfig.h, editorconfig_handle.h), is there any other cross-distribution way to obtain library version?
editorconfig-core-lua doesn’t check C library version (CMakeLists.txt:49). Actually I’m not sure if setting oldest acceptable version in KTextEditor is really needed.
Hm, looking at libgit2 I have:
-rwxr-xr-x 1 root root 906728 Dez 2 12:13 libgit2.so.0.24.0 lrwxrwxrwx 1 root root 17 Jan 7 20:05 libgit2.so.24 -> libgit2.so.0.24.0
Looking at editorconfig, I have:
lrwxrwxrwx 1 root root 20 Feb 12 17:17 libeditorconfig.so -> libeditorconfig.so.0 lrwxrwxrwx 1 root root 25 Feb 12 17:17 libeditorconfig.so.0 -> libeditorconfig.so.0.12.1 -rwxr-xr-x 1 root root 18320 Aug 17 12:42 libeditorconfig.so.0.12.1
So the shared library definitely has a version number. I cannot say anything with respect to binary compatibility guarantees of the editorconfig library, but in general, checking for a version is a good idea :-)
I think we need input from developers who know cmake and the extra-cmake-modules here.
find-modules/Findeditorconfig.cmake | ||
---|---|---|
2 ↗ | (On Diff #11308) |
|
FindLibGit2.cmake and other files include such fragment:
if(LIBGIT2_FOUND AND NOT TARGET LibGit2::LibGit2) add_library(LibGit2::LibGit2 UNKNOWN IMPORTED) set_target_properties(LibGit2::LibGit2 PROPERTIES IMPORTED_LOCATION "${LIBGIT2_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${LIBGIT2_DEFINITIONS}" INTERFACE_INCLUDE_DIRECTORIES "${LIBGIT2_INCLUDE_DIR}" ) endif()
Is something similar needed in EditorConfig’s case?
Hi, I think ATM only ktexteditor will need this, therefore I will add a small find module to the ktexteditor repo.
If this is proven to be useful for other frameworks, too, we can move it.