Browse Source

[cmake] lowercase commands, whitespace cleanup, remove clutter in else(...), endif(...), endforeach(...)

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

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3013 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.37
Stefan Bühler 6 years ago
parent
commit
403afcd251
  1. 36
      CMakeLists.txt
  2. 120
      cmake/FindLibEV.cmake
  3. 76
      cmake/LighttpdMacros.cmake
  4. 1152
      src/CMakeLists.txt
  5. 8
      tests/CMakeLists.txt

36
CMakeLists.txt

@ -1,27 +1,27 @@
PROJECT(lighttpd C)
project(lighttpd C)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0 FATAL_ERROR)
cmake_minimum_required(VERSION 2.4.0 FATAL_ERROR)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
INCLUDE(CTest)
include(CTest)
ENABLE_TESTING()
enable_testing()
SET(CPACK_PACKAGE_VERSION_MAJOR 1)
SET(CPACK_PACKAGE_VERSION_MINOR 4)
SET(CPACK_PACKAGE_VERSION_PATCH 37)
SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION_MAJOR 1)
set(CPACK_PACKAGE_VERSION_MINOR 4)
set(CPACK_PACKAGE_VERSION_PATCH 37)
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README")
SET(CPACK_PACKAGE_VENDOR "jan@kneschke.de")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README")
set(CPACK_PACKAGE_VENDOR "jan@kneschke.de")
SET(CPACK_SOURCE_GENERATOR "TGZ")
SET(CPACK_SOURCE_IGNORE_FILES "/\\\\.;~$;/_;build/;CMakeFiles/;CMakeCache;gz$;Makefile\\\\.;trace;Testing/;foo;autom4te;cmake_install;CPack;\\\\.pem;ltmain.sh;configure;libtool;/config\\\\.;missing;autogen.sh;install-sh;Dart;aclocal;log$;Makefile$")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES "/\\\\.;~$;/_;build/;CMakeFiles/;CMakeCache;gz$;Makefile\\\\.;trace;Testing/;foo;autom4te;cmake_install;CPack;\\\\.pem;ltmain.sh;configure;libtool;/config\\\\.;missing;autogen.sh;install-sh;Dart;aclocal;log$;Makefile$")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
ADD_SUBDIRECTORY(src build)
#ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(tests)
add_subdirectory(src build)
#add_subdirectory(doc)
add_subdirectory(tests)

120
cmake/FindLibEV.cmake

@ -1,70 +1,70 @@
SET(LIBEV_PATH "" CACHE PATH "Base path for include/ev.h and lib/libev*")
SET(LIBEV_INCLUDE_PATH "" CACHE PATH "Include path for ev.h")
SET(LIBEV_LIBDIR "" CACHE PATH "Path containing libev")
set(LIBEV_PATH "" CACHE PATH "Base path for include/ev.h and lib/libev*")
set(LIBEV_INCLUDE_PATH "" CACHE PATH "Include path for ev.h")
set(LIBEV_LIBDIR "" CACHE PATH "Path containing libev")
IF(LIBEV_PATH)
SET(LIBEV_INCLUDE_PATH "${LIBEV_PATH}/include" CACHE PATH "Include path for ev.h" FORCE)
SET(LIBEV_LIBDIR "${LIBEV_PATH}/lib" CACHE PATH "Path containing libev" FORCE)
ENDIF(LIBEV_PATH)
if(LIBEV_PATH)
set(LIBEV_INCLUDE_PATH "${LIBEV_PATH}/include" CACHE PATH "Include path for ev.h" FORCE)
set(LIBEV_LIBDIR "${LIBEV_PATH}/lib" CACHE PATH "Path containing libev" FORCE)
endif()
IF(LIBEV_INCLUDE_PATH)
INCLUDE_DIRECTORIES(${LIBEV_INCLUDE_PATH})
ENDIF(LIBEV_INCLUDE_PATH)
if(LIBEV_INCLUDE_PATH)
include_directories(${LIBEV_INCLUDE_PATH})
endif()
# Use cached result
IF(NOT LIBEV_FOUND)
UNSET(HAVE_EV_H)
UNSET(HAVE_LIBEV)
UNSET(HAVE_EV_H CACHE)
UNSET(HAVE_LIBEV CACHE)
UNSET(LIBEV_CFLAGS)
UNSET(LIBEV_LDFLAGS)
if(NOT LIBEV_FOUND)
unset(HAVE_EV_H)
unset(HAVE_LIBEV)
unset(HAVE_EV_H CACHE)
unset(HAVE_LIBEV CACHE)
unset(LIBEV_CFLAGS)
unset(LIBEV_LDFLAGS)
IF(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR)
SET(CMAKE_REQUIRED_INCLUDES ${LIBEV_INCLUDE_PATH})
# MESSAGE(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}")
CHECK_INCLUDE_FILES(ev.h HAVE_EV_H)
IF(HAVE_EV_H)
# MESSAGE(STATUS "Looking for lib ev in ${LIBEV_LIBDIR}")
CHECK_LIBRARY_EXISTS(ev ev_time "${LIBEV_LIBDIR}" HAVE_LIBEV)
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)
ELSE(HAVE_LIBEV)
MESSAGE(STATUS "Couldn't find lib ev in ${LIBEV_LIBDIR}")
ENDIF(HAVE_LIBEV)
ELSE(HAVE_EV_H)
MESSAGE(STATUS "Couldn't find <ev.h> in ${LIBEV_INCLUDE_PATH}")
ENDIF(HAVE_EV_H)
ELSE(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR)
if(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR)
set(CMAKE_REQUIRED_INCLUDES ${LIBEV_INCLUDE_PATH})
# message(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}")
check_include_files(ev.h HAVE_EV_H)
if(HAVE_EV_H)
# message(STATUS "Looking for lib ev in ${LIBEV_LIBDIR}")
check_library_exists(ev ev_time "${LIBEV_LIBDIR}" HAVE_LIBEV)
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)
else()
message(STATUS "Couldn't find lib ev in ${LIBEV_LIBDIR}")
endif()
else()
message(STATUS "Couldn't find <ev.h> in ${LIBEV_INCLUDE_PATH}")
endif()
else()
pkg_check_modules(LIBEV libev)
IF(NOT LIBEV_FOUND)
# MESSAGE(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}")
CHECK_INCLUDE_FILES(ev.h HAVE_EV_H)
IF(HAVE_EV_H)
# MESSAGE(STATUS "Looking for lib ev")
CHECK_LIBRARY_EXISTS(ev ev_time "" HAVE_LIBEV)
IF(HAVE_LIBEV)
SET(LIBEV_CFLAGS "" CACHE INTERNAL "")
SET(LIBEV_LDFLAGS "-lev" CACHE INTERNAL "")
SET(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE)
ELSE(HAVE_LIBEV)
MESSAGE(STATUS "Couldn't find lib ev")
ENDIF(HAVE_LIBEV)
ELSE(HAVE_EV_H)
MESSAGE(STATUS "Couldn't find <ev.h>")
ENDIF(HAVE_EV_H)
ENDIF(NOT LIBEV_FOUND)
ENDIF(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR)
if(NOT LIBEV_FOUND)
# message(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}")
check_include_files(ev.h HAVE_EV_H)
if(HAVE_EV_H)
# message(STATUS "Looking for lib ev")
check_library_exists(ev ev_time "" HAVE_LIBEV)
if(HAVE_LIBEV)
set(LIBEV_CFLAGS "" CACHE INTERNAL "")
set(LIBEV_LDFLAGS "-lev" CACHE INTERNAL "")
set(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE)
else()
message(STATUS "Couldn't find lib ev")
endif()
else()
message(STATUS "Couldn't find <ev.h>")
endif()
endif()
endif()
ENDIF(NOT LIBEV_FOUND)
endif()
IF(NOT LIBEV_FOUND)
IF(LibEV_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find libev")
ENDIF(LibEV_FIND_REQUIRED)
ENDIF(NOT LIBEV_FOUND)
if(NOT LIBEV_FOUND)
if(LibEV_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libev")
endif()
endif()
MARK_AS_ADVANCED(LIBEV_PATH LIBEV_INCLUDE_PATH LIBEV_LIBDIR)
mark_as_advanced(LIBEV_PATH LIBEV_INCLUDE_PATH LIBEV_LIBDIR)

76
cmake/LighttpdMacros.cmake

@ -1,43 +1,43 @@
## our modules are without the "lib" prefix
MACRO(ADD_AND_INSTALL_LIBRARY LIBNAME SRCFILES)
IF(BUILD_STATIC)
ADD_LIBRARY(${LIBNAME} STATIC ${SRCFILES})
TARGET_LINK_LIBRARIES(lighttpd ${LIBNAME})
ELSE(BUILD_STATIC)
ADD_LIBRARY(${LIBNAME} SHARED ${SRCFILES})
SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} ${LIBNAME})
## Windows likes to link it this way back to app!
IF(WIN32)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS lighttpd.lib)
ENDIF(WIN32)
macro(ADD_AND_INSTALL_LIBRARY LIBNAME SRCFILES)
if(BUILD_STATIC)
add_library(${LIBNAME} STATIC ${SRCFILES})
target_link_libraries(lighttpd ${LIBNAME})
else()
add_library(${LIBNAME} SHARED ${SRCFILES})
set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} ${LIBNAME})
## Windows likes to link it this way back to app!
if(WIN32)
set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS lighttpd.lib)
endif()
IF(APPLE)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
ENDIF(APPLE)
ENDIF(BUILD_STATIC)
ENDMACRO(ADD_AND_INSTALL_LIBRARY)
if(APPLE)
set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
endif()
endif()
endmacro(ADD_AND_INSTALL_LIBRARY)
MACRO(LEMON_PARSER SRCFILE)
GET_FILENAME_COMPONENT(SRCBASE ${SRCFILE} NAME_WE)
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.c ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.h
COMMAND ${CMAKE_BINARY_DIR}/build/lemon
ARGS -q ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c
DEPENDS ${CMAKE_BINARY_DIR}/build/lemon ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c
COMMENT "Generating ${SRCBASE}.c from ${SRCFILE}"
)
ENDMACRO(LEMON_PARSER)
macro(LEMON_PARSER SRCFILE)
get_filename_component(SRCBASE ${SRCFILE} NAME_WE)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.c ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.h
COMMAND ${CMAKE_BINARY_DIR}/build/lemon
ARGS -q ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c
DEPENDS ${CMAKE_BINARY_DIR}/build/lemon ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c
COMMENT "Generating ${SRCBASE}.c from ${SRCFILE}"
)
endmacro(LEMON_PARSER)
MACRO(ADD_TARGET_PROPERTIES _target _name)
SET(_properties)
FOREACH(_prop ${ARGN})
SET(_properties "${_properties} ${_prop}")
ENDFOREACH(_prop)
GET_TARGET_PROPERTY(_old_properties ${_target} ${_name})
MESSAGE("adding property to ${_target} ${_name}:" ${_properties})
IF(NOT _old_properties)
# in case it's NOTFOUND
SET(_old_properties)
ENDIF(NOT _old_properties)
SET_TARGET_PROPERTIES(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}")
ENDMACRO(ADD_TARGET_PROPERTIES)
macro(ADD_TARGET_PROPERTIES _target _name)
set(_properties)
foreach(_prop ${ARGN})
set(_properties "${_properties} ${_prop}")
endforeach()
get_target_property(_old_properties ${_target} ${_name})
message("adding property to ${_target} ${_name}:" ${_properties})
if(NOT _old_properties)
# in case it's NOTFOUND
set(_old_properties)
endif()
set_target_properties(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}")
endmacro(ADD_TARGET_PROPERTIES)

1152
src/CMakeLists.txt

File diff suppressed because it is too large

8
tests/CMakeLists.txt

@ -1,4 +1,4 @@
SET(T_FILES
set(T_FILES
prepare.sh
cachable.t
core-404-handler.t
@ -28,9 +28,9 @@ SET(T_FILES
cleanup.sh
)
FOREACH(it ${T_FILES})
ADD_TEST(NAME ${it} COMMAND "${lighttpd_SOURCE_DIR}/tests/wrapper.sh"
foreach(it ${T_FILES})
add_test(NAME ${it} COMMAND "${lighttpd_SOURCE_DIR}/tests/wrapper.sh"
"${lighttpd_SOURCE_DIR}/tests"
"${lighttpd_BINARY_DIR}"
"${lighttpd_SOURCE_DIR}/tests/${it}")
ENDFOREACH(it)
endforeach()

Loading…
Cancel
Save