diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2018-08-13 14:03:54 -0700 |
---|---|---|
committer | Mathias Preiner <mathias.preiner@gmail.com> | 2018-09-22 16:30:59 -0700 |
commit | 013a0fb7fe918d707604690a96ef6c0559af7440 (patch) | |
tree | 41d7f3b19b4761ad4fb7d40880f0d974e97cfd1c /cmake/FindCLN.cmake | |
parent | 7c3f54f21acf99681c34ced71c8033bafb853052 (diff) |
cmake: Add module finder for CLN.
Diffstat (limited to 'cmake/FindCLN.cmake')
-rw-r--r-- | cmake/FindCLN.cmake | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cmake/FindCLN.cmake b/cmake/FindCLN.cmake new file mode 100644 index 000000000..2cb33eb7e --- /dev/null +++ b/cmake/FindCLN.cmake @@ -0,0 +1,27 @@ +# Find CLN +# CLN_FOUND - system has CLN lib +# CLN_INCLUDE_DIR - the CLN include directory +# CLN_LIBRARIES - Libraries needed to use CLN + +find_path(CLN_INCLUDE_DIR NAMES cln/cln.h) +find_library(CLN_LIBRARIES NAMES cln) + + +if(CLN_INCLUDE_DIR) + file(STRINGS + "${CLN_INCLUDE_DIR}/cln/version.h" version_info + REGEX "^#define[ \t]+CL_VERSION_.*") + string(REGEX REPLACE + "^.*_MAJOR[ \t]+([0-9]+).*" "\\1" version_major "${version_info}") + string(REGEX REPLACE + "^.*_MINOR[ \t]+([0-9]+).*" "\\1" version_minor "${version_info}") + string(REGEX REPLACE + "^.*_PATCHLEVEL[ \t]+([0-9]+).*" "\\1" version_patch "${version_info}") + set(CLN_VERSION ${version_major}.${version_minor}.${version_patch}) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(CLN + REQUIRED_VARS CLN_INCLUDE_DIR CLN_LIBRARIES + VERSION_VAR CLN_VERSION) + mark_as_advanced(CLN_INCLUDE_DIR CLN_LIBRARIES) +endif() |