diff options
author | Enrico Loparco (eloparco) <eloparco@cisco.com> | 2021-06-24 09:15:41 +0200 |
---|---|---|
committer | Enrico Loparco (eloparco) <eloparco@cisco.com> | 2021-06-24 09:15:41 +0200 |
commit | 229385955109b866a23c4ac2aa03d4d11044c39d (patch) | |
tree | 0591f9c2fc4144d62330337cc2b94c63dfeded54 /cmake/Modules/FindLibconfig.cmake | |
parent | 6ffbb5ed61733b8dbef39b1a9d437e899e9359d7 (diff) |
[HICN-708] Rebase with master
Signed-off-by: Enrico Loparco (eloparco) <eloparco@cisco.com>
Change-Id: I2122e1d61dd3b2e039972624ffbdbcb3c5610159
Diffstat (limited to 'cmake/Modules/FindLibconfig.cmake')
-rw-r--r-- | cmake/Modules/FindLibconfig.cmake | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cmake/Modules/FindLibconfig.cmake b/cmake/Modules/FindLibconfig.cmake new file mode 100644 index 000000000..55d2a0fad --- /dev/null +++ b/cmake/Modules/FindLibconfig.cmake @@ -0,0 +1,43 @@ +set(LIBCONFIG_SEARCH_PATH_LIST + ${LIBCONFIG_HOME} + $ENV{LIBCONFIG_HOME} + /usr/local + /opt + /usr +) + +find_path(LIBCONFIG_INCLUDE_DIR libconfig.h + HINTS ${LIBCONFIG_SEARCH_PATH_LIST} + PATH_SUFFIXES include + DOC "Find the libconfig include" +) + +if (WIN32) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + find_library(LIBCONFIG_LIBRARY NAMES libconfig.lib + HINTS ${LIBCONFIG_SEARCH_PATH_LIST} + PATH_SUFFIXES lib/x64 + DOC "Find the libconfig libraries" + ) + elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + find_library(LIBCONFIG_LIBRARY NAMES libconfig.lib + HINTS ${LIBCONFIG_SEARCH_PATH_LIST} + PATH_SUFFIXES lib/x32 + DOC "Find the libconfig libraries" + ) + endif() +else() + find_library(LIBCONFIG_LIBRARY NAMES config + HINTS ${LIBCONFIG_SEARCH_PATH_LIST} + PATH_SUFFIXES lib + DOC "Find the libconfig libraries" + ) +endif() + +set(LIBCONFIG_LIBRARIES ${LIBCONFIG_LIBRARY}) +set(LIBCONFIG_INCLUDE_DIRS ${LIBCONFIG_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libconfig LIBCONFIG_LIBRARIES LIBCONFIG_INCLUDE_DIRS) + +mark_as_advanced(LIBCONFIG_LIBRARIES LIBCONFIG_INCLUDE_DIRS) |