annotate cmake/FindJansson.cmake @ 116:0a6683615c73

cmake: change build system, continue #2487 @3h
author David Demelier <markand@malikania.fr>
date Sat, 03 Oct 2020 18:32:01 +0200
parents
children 71b3b7036de7 3bfaaf5342a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
116
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
1 # FindJansson
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
2 # -----------
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
3 #
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
4 # Find Jansson library, this modules defines:
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
5 #
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
6 # Jansson_INCLUDE_DIRS, where to find jansson.h
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
7 # Jansson_LIBRARIES, where to find library
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
8 # Jansson_FOUND, if it is found
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
9 #
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
10 # The following imported targets will be available:
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
11 #
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
12 # Jansson::Jansson, if found.
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
13 #
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
14
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
15 find_path(Jansson_INCLUDE_DIR NAMES jansson.h)
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
16 find_library(Jansson_LIBRARY NAMES libjansson jansson)
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
17
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
18 include(FindPackageHandleStandardArgs)
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
19
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
20 find_package_handle_standard_args(
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
21 Jansson
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
22 FOUND_VAR Jansson_FOUND
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
23 REQUIRED_VARS Jansson_LIBRARY Jansson_INCLUDE_DIR
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
24 )
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
25
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
26 if (Jansson_FOUND)
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
27 set(Jansson_LIBRARIES ${Jansson_LIBRARY})
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
28 set(Jansson_INCLUDE_DIRS ${Jansson_INCLUDE_DIR})
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
29
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
30 if (NOT TARGET Jansson::Jansson)
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
31 add_library(Jansson::Jansson UNKNOWN IMPORTED)
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
32 set_target_properties(
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
33 Jansson::Jansson
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
34 PROPERTIES
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
35 IMPORTED_LINK_INTERFACE_LANGUAGES "C"
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
36 IMPORTED_LOCATION "${Jansson_LIBRARY}"
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
37 INTERFACE_INCLUDE_DIRECTORIES "${Jansson_INCLUDE_DIRS}"
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
38 )
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
39 endif ()
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
40 endif ()
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
41
0a6683615c73 cmake: change build system, continue #2487 @3h
David Demelier <markand@malikania.fr>
parents:
diff changeset
42 mark_as_advanced(Jansson_INCLUDE_DIR Jansson_LIBRARY)