From 9a6775837a831d2acac0211ec2796717b8a81536 Mon Sep 17 00:00:00 2001 From: Omar Alvarez Date: Tue, 18 Jun 2019 10:18:05 +0200 Subject: [PATCH 1/3] CMake support --- CMakeLists.txt | 29 +++++++++++++++++++++++++++++ httplib.h => include/httplib.h | 0 2 files changed, 29 insertions(+) create mode 100644 CMakeLists.txt rename httplib.h => include/httplib.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6907638 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.7.0) +project(httplib) + +set(CMAKE_CXX_STANDARD 11) + +# Include +include(GNUInstallDirs) +include(ExternalProject) + +add_library(${PROJECT_NAME} INTERFACE) +target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_11) + +target_include_directories(${PROJECT_NAME} INTERFACE + $ + $) + +install(TARGETS ${PROJECT_NAME} EXPORT httplibConfig + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + +install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) + +install(EXPORT httplibConfig DESTINATION share/httplib/cmake) + +export(TARGETS ${PROJECT_NAME} FILE httplibConfig.cmake) + +#add_subdirectory(example) +#add_subdirectory(test) \ No newline at end of file diff --git a/httplib.h b/include/httplib.h similarity index 100% rename from httplib.h rename to include/httplib.h From 0c74d1f57112d275f05362ec4934049d86a8dc44 Mon Sep 17 00:00:00 2001 From: Omar Alvarez Date: Tue, 18 Jun 2019 10:18:20 +0200 Subject: [PATCH 2/3] Fix tests --- test/Makefile | 8 ++++---- test/test.vcxproj | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/Makefile b/test/Makefile index 8a1b572..1de08b9 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,15 +1,15 @@ -CC = clang++ -#CC = g++ +#CC = clang++ +CC = g++ CFLAGS = -ggdb -O0 -std=c++11 -DGTEST_USE_OWN_TR1_TUPLE -I.. -I. -Wall -Wextra -Wtype-limits -OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto +OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto -I../include ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz all : test ./test -test : test.cc ../httplib.h Makefile cert.pem +test : test.cc ../include/httplib.h Makefile cert.pem $(CC) -o test $(CFLAGS) test.cc gtest/gtest-all.cc gtest/gtest_main.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) -lpthread cert.pem: diff --git a/test/test.vcxproj b/test/test.vcxproj index 3f15c7c..c03d586 100644 --- a/test/test.vcxproj +++ b/test/test.vcxproj @@ -86,7 +86,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ./;../ + ./;../include Console @@ -101,7 +101,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ./;../ + ./;../include Console @@ -118,7 +118,7 @@ true true WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ./;../ + ./;../include Console @@ -137,7 +137,7 @@ true true WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ./;../ + ./;../include Console From 511057d557daef83164fe26742c5e54e4fe59045 Mon Sep 17 00:00:00 2001 From: Omar Alvarez Date: Fri, 21 Jun 2019 10:19:22 +0200 Subject: [PATCH 3/3] Update CMake files to use old file hierarchy --- CMakeLists.txt | 2 +- include/httplib.h => httplib.h | 0 test/Makefile | 8 ++++---- test/test.vcxproj | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) rename include/httplib.h => httplib.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6907638..02e7e69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ add_library(${PROJECT_NAME} INTERFACE) target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_11) target_include_directories(${PROJECT_NAME} INTERFACE - $ + $ $) install(TARGETS ${PROJECT_NAME} EXPORT httplibConfig diff --git a/include/httplib.h b/httplib.h similarity index 100% rename from include/httplib.h rename to httplib.h diff --git a/test/Makefile b/test/Makefile index 1de08b9..8a1b572 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,15 +1,15 @@ -#CC = clang++ -CC = g++ +CC = clang++ +#CC = g++ CFLAGS = -ggdb -O0 -std=c++11 -DGTEST_USE_OWN_TR1_TUPLE -I.. -I. -Wall -Wextra -Wtype-limits -OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto -I../include +OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz all : test ./test -test : test.cc ../include/httplib.h Makefile cert.pem +test : test.cc ../httplib.h Makefile cert.pem $(CC) -o test $(CFLAGS) test.cc gtest/gtest-all.cc gtest/gtest_main.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) -lpthread cert.pem: diff --git a/test/test.vcxproj b/test/test.vcxproj index c03d586..3f15c7c 100644 --- a/test/test.vcxproj +++ b/test/test.vcxproj @@ -86,7 +86,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ./;../include + ./;../ Console @@ -101,7 +101,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ./;../include + ./;../ Console @@ -118,7 +118,7 @@ true true WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ./;../include + ./;../ Console @@ -137,7 +137,7 @@ true true WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - ./;../include + ./;../ Console