aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/FindConfig.cmake37
1 files changed, 35 insertions, 2 deletions
diff --git a/cmake/Modules/FindConfig.cmake b/cmake/Modules/FindConfig.cmake
index 5361d9611..11e764d21 100644
--- a/cmake/Modules/FindConfig.cmake
+++ b/cmake/Modules/FindConfig.cmake
@@ -1,6 +1,39 @@
-FIND_PATH(CONFIG_INCLUDE_DIR libconfig.h /usr/include /usr/local/include)
+set(LIBCONFIG_SEARCH_PATH_LIST
+ ${LIBCONFIG_HOME}
+ $ENV{LIBCONFIG_HOME}
+ /usr/local
+ /opt
+ /usr
+)
+
+find_path(CONFIG_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(CONFIG_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(CONFIG_LIBRARY NAMES libconfig.lib
+ HINTS ${LIBCONFIG_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib/x32
+ DOC "Find the libconfig libraries"
+ )
+ endif()
+else()
+ find_library(CONFIG_LIBRARY NAMES config
+ HINTS ${LIBCONFIG_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the libconfig libraries"
+ )
+endif()
-FIND_LIBRARY(CONFIG_LIBRARY NAMES config PATH /usr/lib /usr/local/lib)
IF (CONFIG_INCLUDE_DIR AND CONFIG_LIBRARY)
SET(CONFIG_FOUND TRUE)