EditorConfig module
ClosedPublic

Authored by cullmann on Feb 12 2017, 10:17 PM.

Details

Summary

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.

Diff Detail

Repository
R240 Extra CMake Modules
Lint
Lint Skipped
Unit
Unit Tests Skipped
gszymaszek retitled this revision from to EditorConfig module.
gszymaszek updated this object.
gszymaszek edited the test plan for this revision. (Show Details)
gszymaszek set the repository for this revision to R240 Extra CMake Modules.
gszymaszek added a project: Frameworks.
Restricted Application added a project: Build System. · View Herald TranscriptFeb 12 2017, 10:17 PM

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.

gszymaszek updated this revision to Diff 11308.Feb 13 2017, 8:42 PM

Added version checking support.

dhaumann added inline comments.Feb 14 2017, 12:19 PM
find-modules/Findeditorconfig.cmake
2 ↗(On Diff #11308)
  1. Please add yourself as copyright holder.
  1. Could you have a look at the comments at the very top of the other find modules in the extra-cmake-modules? There, you can find a ".rst" header that contains documentation about the find module, see e.g. libgit2 again. Could you add this documentation as well for this find module?
gszymaszek updated this revision to Diff 11329.Feb 14 2017, 1:16 PM

Added description.

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?

cullmann commandeered this revision.Feb 18 2017, 4:36 PM
cullmann added a reviewer: gszymaszek.
cullmann added a subscriber: cullmann.

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.

This revision was automatically updated to reflect the committed changes.