@@ -0,0 +1 @@ | |||
build/** |
@@ -1,3 +1,3 @@ | |||
[submodule "/home/bergmann/projects/dnpnode/projects/cppcurl/cmake/modules"] | |||
path = /home/bergmann/projects/dnpnode/projects/cppcurl/cmake/modules | |||
[submodule "cmake/modules"] | |||
path = cmake/modules | |||
url = b3rgmann@git.bergmann89.de:cpp/CmakeModules.git |
@@ -20,8 +20,8 @@ EndIf ( ) | |||
# Project ######################################################################################### | |||
Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppcurl-var.cmake ) | |||
Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppcurl-options.cmake ) | |||
Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cppcurl-var.cmake ) | |||
Project ( cppcurl | |||
DESCRIPTION "A simple library" | |||
VERSION "${CPPCURL_VERSION}" ) | |||
@@ -1,8 +1,7 @@ | |||
# cppcurl-config.cmake - package configuration file | |||
Message ( WARNING "Please configure the dependencies of this package!" ) | |||
# Include ( CMakeFindDependencyMacro ) | |||
# Find_Dependency ( <dependency> ) | |||
Include ( CMakeFindDependencyMacro ) | |||
Find_Dependency ( CURL ) | |||
Include ( FindPackageHandleStandardArgs ) | |||
Set ( ${CMAKE_FIND_PACKAGE_NAME}_CONFIG ${CMAKE_CURRENT_LIST_FILE} ) | |||
@@ -13,3 +13,6 @@ Option ( CPPCURL_INSTALL_DEBUG | |||
Option ( CPPCURL_NO_STRIP | |||
"Do not strip debug symbols from binary." | |||
OFF ) | |||
Option ( CPPCURL_USE_GIT_VERSION | |||
"Read the git tags to get the version of cppcurl" | |||
ON ) |
@@ -1,31 +1,44 @@ | |||
# Version | |||
Set ( CPPCURL_VERSION_MAJOR 1 ) | |||
Set ( CPPCURL_VERSION_MINOR 0 ) | |||
Set ( CPPCURL_VERSION_PATCH 0 ) | |||
Set ( CPPCURL_VERSION_BUILD 0 ) | |||
Set ( CPPCURL_VERSION_SHORT "${CPPCURL_VERSION_MAJOR}.${CPPCURL_VERSION_MINOR}" ) | |||
Set ( CPPCURL_VERSION "${CPPCURL_VERSION_SHORT}.${CPPCURL_VERSION_PATCH}.${CPPCURL_VERSION_BUILD}" ) | |||
Set ( CPPCURL_NAME "cppcurl-${CPPCURL_VERSION_SHORT}" ) | |||
Set ( CPPCURL_OUTPUTNAME "cppcurl" ) | |||
Set ( CPPCURL_VERSION_MAJOR 1 ) | |||
Set ( CPPCURL_VERSION_MINOR 0 ) | |||
Set ( CPPCURL_VERSION_PATCH 0 ) | |||
Set ( CPPCURL_VERSION_BUILD 0 ) | |||
Set ( CPPCURL_VERSION_HASH "" ) | |||
Set ( CPPCURL_VERSION_BEHIND 0 ) | |||
Set ( CPPCURL_VERSION_DIRTY 0 ) | |||
# Git Version | |||
If ( CPPCURL_USE_GIT_VERSION ) | |||
Include ( git_helper OPTIONAL RESULT_VARIABLE HAS_GIT_HELPER ) | |||
If ( HAS_GIT_HELPER ) | |||
GitGetVersion ( ${CMAKE_CURRENT_LIST_DIR}/.. | |||
CPPCURL_VERSION_MAJOR | |||
CPPCURL_VERSION_MINOR | |||
CPPCURL_VERSION_PATCH | |||
CPPCURL_VERSION_BUILD | |||
CPPCURL_VERSION_HASH | |||
CPPCURL_VERSION_BEHIND | |||
CPPCURL_VERSION_DIRTY ) | |||
EndIf ( ) | |||
EndIf ( ) | |||
# Strings | |||
Set ( CPPCURL_VERSION_SHORT "${CPPCURL_VERSION_MAJOR}.${CPPCURL_VERSION_MINOR}" ) | |||
Set ( CPPCURL_VERSION "${CPPCURL_VERSION_SHORT}.${CPPCURL_VERSION_PATCH}.${CPPCURL_VERSION_BUILD}" ) | |||
Set ( CPPCURL_VERSION_COMPLETE "${CPPCURL_VERSION}" ) | |||
Set ( CPPCURL_NAME "cppcurl-${CPPCURL_VERSION_SHORT}" ) | |||
Set ( CPPCURL_OUTPUTNAME "cppcurl" ) | |||
If ( CPPCURL_VERSION_BEHIND ) | |||
Set ( CPPCURL_VERSION_COMPLETE "${CPPCURL_VERSION_COMPLETE}+${CPPCURL_VERSION_BEHIND}" ) | |||
EndIf ( ) | |||
# Install directories | |||
Set ( CPPCURL_INSTALL_DIR_INCLUDE "include/${CPPCURL_NAME}" ) | |||
Set ( CPPCURL_INSTALL_DIR_LIB "lib" ) | |||
Set ( CPPCURL_INSTALL_DIR_SHARE "share/${CPPCURL_NAME}" ) | |||
Set ( CPPCURL_INSTALL_DIR_INCLUDE "include/${CPPCURL_NAME}" ) | |||
Set ( CPPCURL_INSTALL_DIR_LIB "lib" ) | |||
Set ( CPPCURL_INSTALL_DIR_SHARE "share/${CPPCURL_NAME}" ) | |||
# 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}/.. | |||
CPPCURL_VERSION_MAJOR | |||
CPPCURL_VERSION_MINOR | |||
CPPCURL_VERSION_PATCH | |||
CPPCURL_VERSION_BUILD | |||
CPPCURL_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 ) |
@@ -1 +1 @@ | |||
Subproject commit a50f6505f4989b1d96449ba7cd498f8bf2880427 | |||
Subproject commit 4953cd4cc849afdfa02a6057b5a2011fb62e91a6 |
@@ -65,7 +65,7 @@ namespace cppcurl | |||
::exception(T_error err, const std::string& msg) | |||
: _what (__impl::get_error_str<T_error>()(err) + "(" + std::to_string(static_cast<int>(err)) + "): " + msg) | |||
, error (err) | |||
, error_str (get_error_str<T_error>()(err)) | |||
, error_str (__impl::get_error_str<T_error>()(err)) | |||
{ } | |||
template<typename T_error> | |||
@@ -11,33 +11,47 @@ If ( NOT "${GTest_FOUND}" ) | |||
Return ( ) | |||
EndIf ( ) | |||
File ( GLOB_RECURSE CPPCURL_TEST_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h ) | |||
File ( GLOB_RECURSE CPPCURL_TEST_INLINE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.inl ) | |||
File ( GLOB_RECURSE CPPCURL_TEST_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) | |||
Add_Executable ( cppcurl-test | |||
EXCLUDE_FROM_ALL | |||
${CPPCURL_TEST_HEADER_FILES} | |||
${CPPCURL_TEST_INLINE_FILES} | |||
${CPPCURL_TEST_SOURCE_FILES} ) | |||
Target_Link_Libraries ( cppcurl-test | |||
PUBLIC | |||
cppcurl | |||
GTest::Main ) | |||
# pedantic | |||
If ( HAS_PEDANTIC ) | |||
Pedantic_Apply_Flags_Target ( cppcurl-test ALL ) | |||
EndIf ( ) | |||
# optimization | |||
If ( HAS_COTIRE ) | |||
Cotire ( cppcurl-test ) | |||
EndIf ( ) | |||
# test | |||
If ( HAS_CMAKE_TESTS ) | |||
Add_CMake_Test ( NAME cppcurl TARGET cppcurl-test ) | |||
Else ( ) | |||
Add_Test ( NAME cppcurl COMMAND cppcurl-test ) | |||
EndIf ( ) | |||
File ( GLOB_RECURSE CPPCURL_TEST_HEADER_FILES | |||
${CMAKE_CURRENT_SOURCE_DIR}/*.h ) | |||
File ( GLOB_RECURSE CPPCURL_TEST_INLINE_FILES | |||
${CMAKE_CURRENT_SOURCE_DIR}/*.inl ) | |||
File ( GLOB_RECURSE CPPCURL_TEST_SOURCE_FILES | |||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} | |||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) | |||
ForEach ( FILE IN LISTS CPPCURL_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 | |||
${CPPCURL_TEST_HEADER_FILES} | |||
${CPPCURL_TEST_INLINE_FILES} | |||
${FILE} ) | |||
Target_Link_Libraries ( ${TEST_NAME} | |||
PUBLIC | |||
cppcurl | |||
GTest::Main ) | |||
# pedantic | |||
If ( HAS_PEDANTIC ) | |||
Pedantic_Apply_Flags_Target ( ${TEST_NAME} ALL ) | |||
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 ( ) |
@@ -5,6 +5,6 @@ | |||
using namespace ::testing; | |||
using namespace ::cppcurl; | |||
TEST(cppcurl, dummy) | |||
TEST(cppcurl_tests, dummy) | |||
{ | |||
} |