@@ -32,35 +32,39 @@ endmacro()
32
32
33
33
34
34
### Macro: find_component
35
- #
36
- # Check the given component by invoking pkgconfig and
35
+ #
36
+ # Check the given component by invoking pkgconfig and
37
37
# then looking up the libraries and include directories.
38
- # @todo: WIN and MAC OSX.
39
38
#
40
39
macro (find_component COMPONENT PKGCONFIG LIBRARY HEADER )
41
40
if (NOT WIN32 )
42
- # use pkg-config to get the directories and then use these values
43
- # in the FIND_PATH() and FIND_LIBRARY() calls
41
+ # use pkg-config to get the directories
44
42
find_package (PkgConfig )
45
43
if (PKG_CONFIG_FOUND )
46
44
pkg_check_modules (PC_${COMPONENT} ${PKGCONFIG} )
47
45
endif ()
46
+ # find include
47
+ find_path (${COMPONENT} _INCLUDE_DIR
48
+ ${HEADER}
49
+ HINTS ${PC_${COMPONENT}_INCLUDEDIR} ${PC_${COMPONENT}_INCLUDE_DIR}
50
+ )
51
+ # find lib
52
+ find_library (${COMPONENT} _LIBRARIES
53
+ NAMES ${LIBRARY}
54
+ HINTS ${PC_${COMPONENT}_LIBDIR} ${PC_${COMPONENT}_LIBRARY_DIRS}
55
+ )
56
+ # set definition and version
57
+ set (${COMPONENT} _DEFINITIONS ${PC_${COMPONENT}_CFLAGS_OTHER} CACHE STRING "The ${COMPONENT} CFLAGS." )
58
+ set (${COMPONENT} _VERSION ${PC_${COMPONENT}_VERSION} CACHE STRING "The ${COMPONENT} version number." )
59
+ else ()
60
+ # find include
61
+ find_path (${COMPONENT} _INCLUDE_DIR ${HEADER} )
62
+ # find lib
63
+ file (GLOB_RECURSE ${COMPONENT} _LIBRARIES "${CMAKE_PREFIX_PATH} /*${COMPONENT} .lib" )
64
+ # @todo: define definition and version
48
65
endif ()
49
66
50
- find_path (${COMPONENT} _INCLUDE_DIR
51
- ${HEADER}
52
- HINTS ${PC_${COMPONENT}_INCLUDEDIR} ${PC_${COMPONENT}_INCLUDE_DIR}
53
- )
54
-
55
- find_library (${COMPONENT} _LIBRARIES
56
- NAMES ${LIBRARY}
57
- HINTS ${PC_${COMPONENT}_LIBDIR} ${PC_${COMPONENT}_LIBRARY_DIRS}
58
- )
59
-
60
- set (${COMPONENT} _DEFINITIONS ${PC_${COMPONENT}_CFLAGS_OTHER} CACHE STRING "The ${COMPONENT} CFLAGS." )
61
- set (${COMPONENT} _VERSION ${PC_${COMPONENT}_VERSION} CACHE STRING "The ${COMPONENT} version number." )
62
-
63
- # Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIR is present.
67
+ # Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIR is present.
64
68
if (${COMPONENT} _LIBRARIES AND ${COMPONENT} _INCLUDE_DIR )
65
69
set (${COMPONENT} _FOUND TRUE )
66
70
else ()
0 commit comments