]> prime8.dev >> repos - ttyd.git/commitdiff
cmake: search libwebsockets headers from LIBWEBSOCKETS_INCLUDE_DIRS
authorShuanglei Tao <tsl0922@gmail.com>
Sat, 15 Oct 2016 01:43:13 +0000 (09:43 +0800)
committerShuanglei Tao <tsl0922@gmail.com>
Sat, 15 Oct 2016 01:43:55 +0000 (09:43 +0800)
CMakeLists.txt

index 161f2384602da79485f25214aed64abcdeeea3e5..7f1533735fb222d775c25565400e5beb70fbb836 100644 (file)
@@ -1,9 +1,9 @@
 cmake_minimum_required(VERSION 2.8)
 
 # enable C99 mode
-if (CMAKE_VERSION VERSION_LESS "3.1")
+if(CMAKE_VERSION VERSION_LESS "3.1")
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
-else ()
+else()
     set (CMAKE_C_STANDARD 99)
 endif()
 
@@ -17,8 +17,9 @@ find_package(Libwebsockets ${LIBWEBSOCKETS_MIN_VERSION} QUIET)
 
 find_package(PkgConfig)
 
-# try to find libwebsockets with pkg-config
-if (NOT Libwebsockets_DIR)
+if(Libwebsockets_FOUND)
+    set(LIBWEBSOCKETS_INCLUDE_DIR ${LIBWEBSOCKETS_INCLUDE_DIR} ${LIBWEBSOCKETS_INCLUDE_DIRS})
+else() # try to find libwebsockets with pkg-config
     pkg_check_modules(Libwebsockets REQUIRED libwebsockets>=${LIBWEBSOCKETS_MIN_VERSION})
     find_path(LIBWEBSOCKETS_INCLUDE_DIR libwebsockets.h
             HINTS ${LIBWEBSOCKETS_INCLUDEDIR} ${LIBWEBSOCKETS_INCLUDE_DIRS})