aboutsummaryrefslogtreecommitdiff
path: root/cmake/FindJsonC.cmake
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2020-10-11 18:17:01 +0200
committerJan200101 <sentrycraft123@gmail.com>2020-10-11 18:17:01 +0200
commit7d4e2f33a619b1f46a8f2ba00afa22edca6579e8 (patch)
treec4af21c3d2c727929d9489b3c931cc4b64898bf2 /cmake/FindJsonC.cmake
parent26b0417ced82ad849e08db8e8aed0d5529c2b433 (diff)
downloadpolecat-7d4e2f33a619b1f46a8f2ba00afa22edca6579e8.tar.gz
polecat-7d4e2f33a619b1f46a8f2ba00afa22edca6579e8.zip
replace meson with cmake
meson is nice but its completly foreign to me and leaves targets to compile to (e.g Makefile) might revisit in the future but now right now
Diffstat (limited to 'cmake/FindJsonC.cmake')
-rw-r--r--cmake/FindJsonC.cmake41
1 files changed, 41 insertions, 0 deletions
diff --git a/cmake/FindJsonC.cmake b/cmake/FindJsonC.cmake
new file mode 100644
index 0000000..9dfcf4a
--- /dev/null
+++ b/cmake/FindJsonC.cmake
@@ -0,0 +1,41 @@
+#
+# JSONC_INCLUDE_DIRS
+# JSONC_LIBRARIES
+
+find_package(PkgConfig QUIET)
+if (PKG_CONFIG_FOUND)
+ pkg_check_modules(_JSONC QUIET json-c)
+endif()
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_lib_suffix 64)
+else()
+ set(_lib_suffix 32)
+endif()
+
+find_path(JSONC_INC
+ NAMES json-c/json.h
+ HINTS
+ ENV jsoncPath${_lib_suffix}
+ ENV jsoncPath
+ ${_JSONC_INCLUDE_DIRS}
+ PATHS
+ /usr/include /usr/local/include)
+
+find_library(JSONC_LIB
+ NAMES ${_JSONC_LIBRARIES} jsonc json-c
+ HINTS
+ ENV jsoncPath${_lib_suffix}
+ ENV jsoncPath
+ ${_JSONC_LIBRARY_DIRS}
+ PATHS
+ /usr/lib /usr/local/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(JsonC DEFAULT_MSG JSONC_LIB JSONC_INC)
+mark_as_advanced(JSON_INC JSON_LIB)
+
+if(JSONC_FOUND)
+ set(JSONC_INCLUDE_DIRS ${JSONC_INC})
+ set(JSONC_LIBRARIES ${JSONC_LIB})
+endif() \ No newline at end of file