Browse Source

[cmake] cleanup cache variables if features get deactivated

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3014 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.37
Stefan Bühler 6 years ago
parent
commit
10f1490fb1
  1. 4
      cmake/FindLibEV.cmake
  2. 82
      src/CMakeLists.txt

4
cmake/FindLibEV.cmake

@ -31,7 +31,7 @@ if(NOT LIBEV_FOUND)
if(HAVE_LIBEV)
set(LIBEV_CFLAGS "" CACHE INTERNAL "")
set(LIBEV_LDFLAGS "-L${LIBEV_LIBDIR} -lev" CACHE INTERNAL "")
set(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE)
set(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev")
else()
message(STATUS "Couldn't find lib ev in ${LIBEV_LIBDIR}")
endif()
@ -49,7 +49,7 @@ if(NOT LIBEV_FOUND)
if(HAVE_LIBEV)
set(LIBEV_CFLAGS "" CACHE INTERNAL "")
set(LIBEV_LDFLAGS "-lev" CACHE INTERNAL "")
set(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE)
set(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev")
else()
message(STATUS "Couldn't find lib ev")
endif()

82
src/CMakeLists.txt

@ -52,12 +52,12 @@ endif()
if(WITH_LIBEV)
find_package(LibEV REQUIRED)
set(HAVE_LIBEV 1 FORCE)
set(HAVE_LIBEV 1)
endif()
if(WITH_LIBUNWIND)
pkg_check_modules(LIBUNWIND REQUIRED libunwind)
set(HAVE_LIBUNWIND 1 FORCE)
set(HAVE_LIBUNWIND 1)
endif()
if(WITH_WEBDAV_PROPS)
@ -101,8 +101,8 @@ check_include_files(crypt.h HAVE_CRYPT_H)
# check if we need libcrypt for crypt_r()
check_library_exists(crypt crypt_r "" HAVE_LIBCRYPT_CRYPT_R)
if(HAVE_LIBCRYPT_CRYPT_R)
set(HAVE_CRYPT_R 1 FORCE)
set(HAVE_LIBCRYPT 1 FORCE)
set(HAVE_CRYPT_R 1)
set(HAVE_LIBCRYPT 1)
else()
check_library_exists(crypt crypt "" HAVE_LIBCRYPT)
endif()
@ -184,7 +184,6 @@ macro(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
string(REPLACE "\n" "" ${_link_FLAGS} ${__link_FLAGS})
exec_program(${XCONFIG_EXECUTABLE} ARGS --cflags OUTPUT_VARIABLE __cflags)
string(REPLACE "\n" "" ${_cflags} ${__cflags})
else()
message(STATUS "found ${_package}: no")
endif()
@ -195,6 +194,9 @@ if(WITH_XATTR)
if(HAVE_ATTR_ATTRIBUTES_H)
check_library_exists(attr attr_get "" HAVE_XATTR)
endif()
else()
unset(HAVE_ATTR_ATTRIBUTES_H CACHE)
unset(HAVE_XATTR CACHE)
endif()
if(WITH_MYSQL)
@ -206,6 +208,9 @@ if(WITH_MYSQL)
if(HAVE_MYSQL_H)
check_library_exists(mysqlclient mysql_real_connect "" HAVE_MYSQL)
endif()
else()
unset(HAVE_MYSQL_H CACHE)
unset(HAVE_MYSQL CACHE)
endif()
if(WITH_OPENSSL)
@ -217,6 +222,10 @@ if(WITH_OPENSSL)
check_library_exists(ssl SSL_new "" HAVE_LIBSSL)
endif()
endif()
else()
unset(HAVE_OPENSSL_SSL_H CACHE)
unset(HAVE_LIBCRYPTO CACHE)
unset(HAVE_LIBSSL CACHE)
endif()
if(WITH_PCRE)
@ -267,7 +276,9 @@ if(WITH_PCRE)
if(NOT HAVE_LIBPCRE)
message(FATAL_ERROR "libpcre couldn't be found")
endif()
else()
unset(HAVE_PCRE_H CACHE)
unset(HAVE_LIBPCRE CACHE)
endif()
@ -295,12 +306,17 @@ if(WITH_XML)
if(NOT HAVE_LIBXML)
message(FATAL_ERROR "libxml2 couldn't be found")
endif()
else()
unset(HAVE_LIBXML_H CACHE)
unset(HAVE_LIBXML CACHE)
endif()
if(WITH_SQLITE3)
check_include_files(sqlite3.h HAVE_SQLITE3_H)
check_library_exists(sqlite3 sqlite3_reset "" HAVE_SQLITE3)
else()
unset(HAVE_SQLITE3_H CACHE)
unset(HAVE_SQLITE3 CACHE)
endif()
if(WITH_UUID)
@ -311,6 +327,10 @@ if(WITH_UUID)
else()
set(HAVE_LIBUUID 1)
endif()
else()
unset(HAVE_UUID_UUID_H CACHE)
unset(NEED_LIBUUID CACHE)
unset(HAVE_LIBUUID CACHE)
endif()
if(WITH_ZLIB)
@ -320,17 +340,16 @@ if(WITH_ZLIB)
set(ZLIB_LIBRARY z)
else()
find_path(ZLIB_INCLUDE_DIR zlib.h
/usr/local/include
/usr/include
/usr/local/include
/usr/include
)
set(ZLIB_NAMES z zlib zdll)
find_library(ZLIB_LIBRARY
NAMES ${ZLIB_NAMES}
PATHS /usr/lib /usr/local/lib
find_library(ZLIB_LIBRARY
NAMES ${ZLIB_NAMES}
PATHS /usr/lib /usr/local/lib
)
if(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY})
@ -340,14 +359,21 @@ if(WITH_ZLIB)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
include_directories(${ZLIB_INCLUDE_DIR})
endif()
endif()
else()
unset(HAVE_ZLIB_H CACHE)
unset(HAVE_LIBZ CACHE)
unset(ZLIB_INCLUDE_DIR CACHE)
unset(ZLIB_LIBRARY CACHE)
endif()
if(WITH_BZIP)
check_include_files(bzlib.h HAVE_BZLIB_H)
check_library_exists(bz2 BZ2_bzCompress "" HAVE_LIBBZ2)
else()
unset(HAVE_BZLIB_H CACHE)
unset(HAVE_LIBBZ2 CACHE)
endif()
if(WITH_LDAP)
@ -356,6 +382,11 @@ if(WITH_LDAP)
check_include_files(lber.h HAVE_LBER_H)
check_library_exists(lber ber_printf "" HAVE_LIBLBER)
set(LDAP_DEPRECATED 1) # Using deprecated ldap api
else()
unset(HAVE_LDAP_H CACHE)
unset(HAVE_LIBLDAP CACHE)
unset(HAVE_LBER_H CACHE)
unset(HAVE_LIBLBER CACHE)
endif()
if(WITH_LUA)
@ -363,6 +394,9 @@ if(WITH_LUA)
message(STATUS "found lua at: INCDIR: ${LUA_INCLUDE_DIRS} LIBDIR: ${LUA_LIBRARY_DIRS} LDFLAGS: ${LUA_LDFLAGS} CFLAGS: ${LUA_CFLAGS}")
set(HAVE_LIBLUA 1 "Have liblua")
set(HAVE_LUA_H 1 "Have liblua header")
else()
unset(HAVE_LIBLUA CACHE)
unset(HAVE_LUA_H CACHE)
endif()
if(WITH_FAM)
@ -372,24 +406,38 @@ if(WITH_FAM)
set(CMAKE_REQUIRED_LIBRARIES fam)
check_function_exists(FAMNoExists HAVE_FAMNOEXISTS)
endif()
else()
unset(HAVE_FAM_H CACHE)
unset(HAVE_LIBFAM CACHE)
unset(HAVE_FAMNOEXISTS CACHE)
endif()
if(WITH_GDBM)
check_include_files(gdbm.h HAVE_GDBM_H)
check_library_exists(gdbm gdbm_open "" HAVE_GDBM)
else()
unset(HAVE_GDBM_H CACHE)
unset(HAVE_GDBM CACHE)
endif()
if(WITH_MEMCACHE)
check_include_files(memcache.h HAVE_MEMCACHE_H)
check_library_exists(memcache mc_new "" HAVE_MEMCACHE)
else()
unset(HAVE_MEMCACHE_H CACHE)
unset(HAVE_MEMCACHE CACHE)
endif()
if(NOT BUILD_STATIC)
check_include_files(dlfcn.h HAVE_DLFCN_H)
else()
unset(HAVE_DLFCN_H CACHE)
endif()
if(HAVE_DLFCN_H)
check_library_exists(dl dlopen "" HAVE_LIBDL)
else()
unset(HAVE_LIBDL CACHE)
endif()
set(LIGHTTPD_VERSION_ID 10400)
@ -398,11 +446,11 @@ set(PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
exec_program(date ARGS "'+%b %d %Y %H:%M:%S UTC'" OUTPUT_VARIABLE PACKAGE_BUILD_DATE)
if(NOT SBINDIR)
set(SBINDIR "sbin")
set(SBINDIR "sbin")
endif()
if(NOT LIGHTTPD_MODULES_DIR)
set(LIGHTTPD_MODULES_DIR "lib${LIB_SUFFIX}/lighttpd")
set(LIGHTTPD_MODULES_DIR "lib${LIB_SUFFIX}/lighttpd")
endif()
if(NOT WIN32)
@ -478,7 +526,7 @@ add_and_install_library(mod_accesslog mod_accesslog.c)
add_and_install_library(mod_alias mod_alias.c)
add_and_install_library(mod_auth "mod_auth.c;http_auth.c")
if(NOT WIN32)
add_and_install_library(mod_cgi mod_cgi.c)
add_and_install_library(mod_cgi mod_cgi.c)
endif()
add_and_install_library(mod_cml "mod_cml.c;mod_cml_lua.c;mod_cml_funcs.c")
add_and_install_library(mod_compress mod_compress.c)

Loading…
Cancel
Save