@@ -1,3 +1,3 @@ | |||||
[submodule "/home/bergmann/projects/dnpnode/projects/cppmicrohttpd/cmake/modules"] | |||||
path = /home/bergmann/projects/dnpnode/projects/cppmicrohttpd/cmake/modules | |||||
[submodule "cmake/modules"] | |||||
path = cmake/modules | |||||
url = b3rgmann@git.bergmann89.de:cpp/CmakeModules.git | url = b3rgmann@git.bergmann89.de:cpp/CmakeModules.git |
@@ -20,8 +20,8 @@ EndIf ( ) | |||||
# Project ######################################################################################### | # Project ######################################################################################### | ||||
Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppmicrohttpd-var.cmake ) | |||||
Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppmicrohttpd-options.cmake ) | Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppmicrohttpd-options.cmake ) | ||||
Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppmicrohttpd-var.cmake ) | |||||
Project ( cppmicrohttpd | Project ( cppmicrohttpd | ||||
DESCRIPTION "A simple library" | DESCRIPTION "A simple library" | ||||
VERSION "${CPPMICROHTTPD_VERSION}" ) | VERSION "${CPPMICROHTTPD_VERSION}" ) | ||||
@@ -1,8 +1,7 @@ | |||||
# cppmicrohttpd-config.cmake - package configuration file | # cppmicrohttpd-config.cmake - package configuration file | ||||
Message ( WARNING "Please configure the dependencies of this package!" ) | |||||
# Include ( CMakeFindDependencyMacro ) | |||||
# Find_Dependency ( <dependency> ) | |||||
Include ( CMakeFindDependencyMacro ) | |||||
Find_Dependency ( cppcore libmicrohttpd ) | |||||
Include ( FindPackageHandleStandardArgs ) | Include ( FindPackageHandleStandardArgs ) | ||||
Set ( ${CMAKE_FIND_PACKAGE_NAME}_CONFIG ${CMAKE_CURRENT_LIST_FILE} ) | Set ( ${CMAKE_FIND_PACKAGE_NAME}_CONFIG ${CMAKE_CURRENT_LIST_FILE} ) | ||||
@@ -10,6 +10,12 @@ Option ( CPPMICROHTTPD_INSTALL_SHARED | |||||
Option ( CPPMICROHTTPD_INSTALL_DEBUG | Option ( CPPMICROHTTPD_INSTALL_DEBUG | ||||
"Install the stripped debug informations of cppmicrohttpd." | "Install the stripped debug informations of cppmicrohttpd." | ||||
OFF ) | OFF ) | ||||
Option ( CPPMICROHTTPD_NO_STRIP | |||||
"Do not strip debug symbols from binary." | |||||
OFF ) | |||||
Option ( CPPMICROHTTPD_USE_GIT_VERSION | |||||
"Read the git tags to get the version of cppmicrohttpd" | |||||
ON ) | |||||
If ( NOT CPPMICROHTTPD_LOGGING ) | If ( NOT CPPMICROHTTPD_LOGGING ) | ||||
Set ( CPPMICROHTTPD_LOGGING none | Set ( CPPMICROHTTPD_LOGGING none | ||||
CACHE STRING "Specify how cppmicrohttpd should write log entries." ) | CACHE STRING "Specify how cppmicrohttpd should write log entries." ) | ||||
@@ -1,31 +1,44 @@ | |||||
# Version | # Version | ||||
Set ( CPPMICROHTTPD_VERSION_MAJOR 1 ) | |||||
Set ( CPPMICROHTTPD_VERSION_MINOR 0 ) | |||||
Set ( CPPMICROHTTPD_VERSION_PATCH 0 ) | |||||
Set ( CPPMICROHTTPD_VERSION_BUILD 0 ) | |||||
Set ( CPPMICROHTTPD_VERSION_SHORT "${CPPMICROHTTPD_VERSION_MAJOR}.${CPPMICROHTTPD_VERSION_MINOR}" ) | |||||
Set ( CPPMICROHTTPD_VERSION "${CPPMICROHTTPD_VERSION_SHORT}.${CPPMICROHTTPD_VERSION_PATCH}.${CPPMICROHTTPD_VERSION_BUILD}" ) | |||||
Set ( CPPMICROHTTPD_NAME "cppmicrohttpd-${CPPMICROHTTPD_VERSION_SHORT}" ) | |||||
Set ( CPPMICROHTTPD_OUTPUTNAME "cppmicrohttpd" ) | |||||
Set ( CPPMICROHTTPD_VERSION_MAJOR 1 ) | |||||
Set ( CPPMICROHTTPD_VERSION_MINOR 0 ) | |||||
Set ( CPPMICROHTTPD_VERSION_PATCH 0 ) | |||||
Set ( CPPMICROHTTPD_VERSION_BUILD 0 ) | |||||
Set ( CPPMICROHTTPD_VERSION_HASH "" ) | |||||
Set ( CPPMICROHTTPD_VERSION_BEHIND 0 ) | |||||
Set ( CPPMICROHTTPD_VERSION_DIRTY 0 ) | |||||
# Git Version | |||||
If ( CPPMICROHTTPD_USE_GIT_VERSION ) | |||||
Include ( git_helper OPTIONAL RESULT_VARIABLE HAS_GIT_HELPER ) | |||||
If ( HAS_GIT_HELPER ) | |||||
GitGetVersion ( ${CMAKE_CURRENT_LIST_DIR}/.. | |||||
CPPMICROHTTPD_VERSION_MAJOR | |||||
CPPMICROHTTPD_VERSION_MINOR | |||||
CPPMICROHTTPD_VERSION_PATCH | |||||
CPPMICROHTTPD_VERSION_BUILD | |||||
CPPMICROHTTPD_VERSION_HASH | |||||
CPPMICROHTTPD_VERSION_BEHIND | |||||
CPPMICROHTTPD_VERSION_DIRTY ) | |||||
EndIf ( ) | |||||
EndIf ( ) | |||||
# Strings | |||||
Set ( CPPMICROHTTPD_VERSION_SHORT "${CPPMICROHTTPD_VERSION_MAJOR}.${CPPMICROHTTPD_VERSION_MINOR}" ) | |||||
Set ( CPPMICROHTTPD_VERSION "${CPPMICROHTTPD_VERSION_SHORT}.${CPPMICROHTTPD_VERSION_PATCH}.${CPPMICROHTTPD_VERSION_BUILD}" ) | |||||
Set ( CPPMICROHTTPD_VERSION_COMPLETE "${CPPMICROHTTPD_VERSION}" ) | |||||
Set ( CPPMICROHTTPD_NAME "cppmicrohttpd-${CPPMICROHTTPD_VERSION_SHORT}" ) | |||||
Set ( CPPMICROHTTPD_OUTPUTNAME "cppmicrohttpd" ) | |||||
If ( CPPMICROHTTPD_VERSION_BEHIND ) | |||||
Set ( CPPMICROHTTPD_VERSION_COMPLETE "${CPPMICROHTTPD_VERSION_COMPLETE}+${CPPMICROHTTPD_VERSION_BEHIND}" ) | |||||
EndIf ( ) | |||||
# Install directories | # Install directories | ||||
Set ( CPPMICROHTTPD_INSTALL_DIR_INCLUDE "include/${CPPMICROHTTPD_NAME}" ) | |||||
Set ( CPPMICROHTTPD_INSTALL_DIR_LIB "lib" ) | |||||
Set ( CPPMICROHTTPD_INSTALL_DIR_SHARE "share/${CPPMICROHTTPD_NAME}" ) | |||||
Set ( CPPMICROHTTPD_INSTALL_DIR_INCLUDE "include/${CPPMICROHTTPD_NAME}" ) | |||||
Set ( CPPMICROHTTPD_INSTALL_DIR_LIB "lib" ) | |||||
Set ( CPPMICROHTTPD_INSTALL_DIR_SHARE "share/${CPPMICROHTTPD_NAME}" ) | |||||
# C Standard | # C Standard | ||||
Set ( CMAKE_C_STANDARD 11 ) | |||||
Set ( CMAKE_CXX_STANDARD 17 ) | |||||
Set ( CMAKE_C_STANDARD_REQUIRED ON ) | |||||
Set ( CMAKE_CXX_STANDARD_REQUIRED ON ) | |||||
# Git Version | |||||
Include ( git_helper OPTIONAL RESULT_VARIABLE HAS_GIT_HELPER ) | |||||
If ( HAS_GIT_HELPER ) | |||||
GitGetVersion ( ${CMAKE_CURRENT_LIST_DIR}/.. | |||||
CPPMICROHTTPD_VERSION_MAJOR | |||||
CPPMICROHTTPD_VERSION_MINOR | |||||
CPPMICROHTTPD_VERSION_PATCH | |||||
CPPMICROHTTPD_VERSION_BUILD | |||||
CPPMICROHTTPD_VERSION_HASH ) | |||||
EndIf ( ) | |||||
Set ( CMAKE_C_STANDARD 11 ) | |||||
Set ( CMAKE_CXX_STANDARD 17 ) | |||||
Set ( CMAKE_C_STANDARD_REQUIRED ON ) | |||||
Set ( CMAKE_CXX_STANDARD_REQUIRED ON ) |
@@ -27,33 +27,47 @@ Target_Link_Libraries ( cppmicrohttpd-test-helper | |||||
# Test ############################################################################################ | # Test ############################################################################################ | ||||
File ( GLOB_RECURSE CPPMICROHTTPD_TEST_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/cppmicrohttpd/*.h ) | |||||
File ( GLOB_RECURSE CPPMICROHTTPD_TEST_INLINE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/cppmicrohttpd/*.inl ) | |||||
File ( GLOB_RECURSE CPPMICROHTTPD_TEST_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/cppmicrohttpd/*.cpp ) | |||||
Add_Executable ( cppmicrohttpd-test | |||||
EXCLUDE_FROM_ALL | |||||
${CPPMICROHTTPD_TEST_HEADER_FILES} | |||||
${CPPMICROHTTPD_TEST_INLINE_FILES} | |||||
${CPPMICROHTTPD_TEST_SOURCE_FILES} ) | |||||
Target_Link_Libraries ( cppmicrohttpd-test | |||||
PUBLIC | |||||
cppmicrohttpd-test-helper | |||||
GTest::Main ) | |||||
File ( GLOB_RECURSE CPPMICROHTTPD_TEST_HEADER_FILES | |||||
${CMAKE_CURRENT_SOURCE_DIR}/*.h ) | |||||
File ( GLOB_RECURSE CPPMICROHTTPD_TEST_INLINE_FILES | |||||
${CMAKE_CURRENT_SOURCE_DIR}/*.inl ) | |||||
File ( GLOB_RECURSE CPPMICROHTTPD_TEST_SOURCE_FILES | |||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} | |||||
${CMAKE_CURRENT_SOURCE_DIR}/cppmicrohttpd/*.cpp ) | |||||
# pedantic | |||||
If ( HAS_PEDANTIC ) | |||||
Pedantic_Apply_Flags_Target ( cppmicrohttpd-test ALL ) | |||||
EndIf ( ) | |||||
ForEach ( FILE IN LISTS CPPMICROHTTPD_TEST_SOURCE_FILES ) | |||||
# add test | |||||
Get_Filename_Component ( TEST_DIR ${FILE} DIRECTORY ) | |||||
Get_Filename_Component ( TEST_NAME ${FILE} NAME_WE ) | |||||
Set ( TEST_NAME "${TEST_DIR}/${TEST_NAME}" ) | |||||
String ( REPLACE "\\" "-" TEST_NAME "${TEST_NAME}" ) | |||||
String ( REPLACE "/" "-" TEST_NAME "${TEST_NAME}" ) | |||||
String ( REPLACE "_" "-" TEST_NAME "${TEST_NAME}" ) | |||||
Set ( TEST_NAME "test-${TEST_NAME}" ) | |||||
Add_Executable ( ${TEST_NAME} | |||||
EXCLUDE_FROM_ALL | |||||
${CPPMICROHTTPD_TEST_HEADER_FILES} | |||||
${CPPMICROHTTPD_TEST_INLINE_FILES} | |||||
${FILE} ) | |||||
Target_Link_Libraries ( ${TEST_NAME} | |||||
PUBLIC | |||||
cppmicrohttpd-test-helper | |||||
GMock::Main ) | |||||
# optimization | |||||
If ( HAS_COTIRE ) | |||||
Cotire ( cppmicrohttpd-test ) | |||||
EndIf ( ) | |||||
# pedantic | |||||
If ( HAS_PEDANTIC ) | |||||
Pedantic_Apply_Flags_Target ( ${TEST_NAME} ALL ) | |||||
EndIf ( ) | |||||
# test | |||||
If ( HAS_CMAKE_TESTS ) | |||||
Add_CMake_Test ( NAME cppmicrohttpd TARGET cppmicrohttpd-test ) | |||||
Else ( ) | |||||
Add_Test ( NAME cppmicrohttpd COMMAND cppmicrohttpd-test ) | |||||
EndIf ( ) | |||||
# optimization | |||||
If ( HAS_COTIRE ) | |||||
Cotire ( ${TEST_NAME} ) | |||||
EndIf ( ) | |||||
# test | |||||
If ( HAS_CMAKE_TESTS ) | |||||
Add_CMake_Test ( NAME ${TEST_NAME} TARGET ${TEST_NAME} ) | |||||
Else ( ) | |||||
Add_Test ( NAME ${TEST_NAME} COMMAND ${TEST_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) | |||||
EndIf ( ) | |||||
EndForEach ( ) |