Skip to content

Commit

Permalink
- Added missing CMake install rules for headers curlpp-config/pkg-con…
Browse files Browse the repository at this point in the history
…fig files

- Removed unuseful files
- Created a new build target for building examples
- Cleaned up build rules
- Added —-static-libs curlpp-config option
- Adding static library target
- Removed unusefull files (*.ins files were used by the template explicit instantiation)
  • Loading branch information
jpbarrette committed Feb 18, 2017
1 parent 12981ec commit da68a3a
Show file tree
Hide file tree
Showing 34 changed files with 100 additions and 3,059 deletions.
13 changes: 0 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,11 @@
*.dylib
*.lai
Makefile
Makefile.in
*~

build/
m4/
aclocal.m4
CMakeFiles/
aclocal.m4.bak
config.log
config.status
curlpp-config
curlpp.pc
curlpp.spec
include/curlpp/config.h
include/curlpp/config.h.in
include/curlpp/stamp-h1
libtool
autom4te.cache/

examples/example01
examples/example02
Expand Down
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ before_script:
- cmake ../

script:
- make
- make && sudo make install
- cd ../examples && mkdir build && cd build
- cmake ../
- make


install:
Expand Down
108 changes: 18 additions & 90 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set(CURLPP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CURLPP_BINARY_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})


#########################################################################################
# Root folders
Expand All @@ -32,6 +35,8 @@ message(STATUS "\tInputs of type .h and .hpp at: ${IncludeFolder}")
set(ExamplesFolder ${ProjectRootDir}examples/)
message(STATUS "\tInputs to be built as standalone examples are at: ${ExamplesFolder}")

add_subdirectory(extras)

#########################################################################################
# For more verbose displays
function(DisplayList Header ListToShow)
Expand All @@ -43,85 +48,14 @@ endfunction(DisplayList)

#########################################################################################
# File Lists
set(HeaderFileList
${IncludeFolder}utilspp/EmptyType.hpp
${IncludeFolder}utilspp/NullType.hpp
${IncludeFolder}utilspp/ThreadingSingle.hpp
${IncludeFolder}utilspp/TypeTrait.hpp
${IncludeFolder}utilspp/clone_ptr.hpp
${IncludeFolder}utilspp/TypeList.hpp
${IncludeFolder}utilspp/NonCopyable.hpp
${IncludeFolder}utilspp/SmartPtr.hpp
${IncludeFolder}utilspp/ThreadingFactoryMutex.hpp
${IncludeFolder}curlpp/Exception.hpp
${IncludeFolder}curlpp/Option.hpp
${IncludeFolder}curlpp/Info.hpp
${IncludeFolder}curlpp/Easy.hpp
${IncludeFolder}curlpp/Form.hpp
${IncludeFolder}curlpp/Types.hpp
${IncludeFolder}curlpp/OptionBase.hpp
${IncludeFolder}curlpp/Infos.hpp
${IncludeFolder}curlpp/Options.hpp
${IncludeFolder}curlpp/Multi.hpp
${IncludeFolder}curlpp/internal/OptionContainerType.hpp
${IncludeFolder}curlpp/internal/OptionContainer.hpp
${IncludeFolder}curlpp/internal/SList.hpp
${IncludeFolder}curlpp/internal/CurlHandle.hpp
${IncludeFolder}curlpp/internal/OptionSetter.hpp
${IncludeFolder}curlpp/internal/OptionList.hpp
${IncludeFolder}curlpp/cURLpp.hpp
${SrcFolder}curlpp/autolink.h
)
file(GLOB_RECURSE HeaderFileList "${IncludeFolder}*")
install(DIRECTORY include/utilspp/ DESTINATION "include/utilspp")
install(DIRECTORY include/curlpp/ DESTINATION "include/curlpp")
DisplayList("Using Header Files:" "${HeaderFileList}")

set(SourceFileList
${SrcFolder}curlpp/Form.cpp
${SrcFolder}curlpp/Exception.cpp
${SrcFolder}curlpp/Options.cpp
${SrcFolder}curlpp/Option.cpp
${SrcFolder}curlpp/Options.custom.ins
${SrcFolder}curlpp/Info.cpp
${SrcFolder}curlpp/Multi.cpp
${SrcFolder}curlpp/OptionBase.cpp
${SrcFolder}curlpp/internal/SList.cpp
${SrcFolder}curlpp/internal/OptionSetter.cpp
${SrcFolder}curlpp/internal/OptionList.cpp
${SrcFolder}curlpp/internal/CurlHandle.cpp
${SrcFolder}curlpp/Infos.cpp
${SrcFolder}curlpp/Easy.cpp
${SrcFolder}curlpp/cURLpp.cpp
)
file(GLOB_RECURSE SourceFileList "${SrcFolder}*")
DisplayList("Using Source Files:" "${SourceFileList}")

set(ExamplesFileList
${ExamplesFolder}example00.cpp
${ExamplesFolder}example01.cpp
${ExamplesFolder}example02.cpp
${ExamplesFolder}example03.cpp
${ExamplesFolder}example04.cpp
${ExamplesFolder}example05.cpp
${ExamplesFolder}example06.cpp
${ExamplesFolder}example07.cpp
${ExamplesFolder}example08.cpp
${ExamplesFolder}example09.cpp
${ExamplesFolder}example10.cpp
${ExamplesFolder}example11.cpp
${ExamplesFolder}example12.cpp
${ExamplesFolder}example13.cpp
${ExamplesFolder}example14.cpp
${ExamplesFolder}example16.cpp
${ExamplesFolder}example15.cpp
${ExamplesFolder}example17.cpp
${ExamplesFolder}example18.cpp
${ExamplesFolder}example19.cpp
${ExamplesFolder}example20.cpp
${ExamplesFolder}example21.cpp
${ExamplesFolder}example22.cpp
${ExamplesFolder}example23.cpp
${ExamplesFolder}example24.cpp
)
DisplayList("Using Example Files:" "${ExamplesFileList}")

#########################################################################################
# Look for dependencies

Expand All @@ -130,6 +64,7 @@ DisplayList("Using Example Files:" "${ExamplesFileList}")

message(STATUS "Looking for CURL")
include(FindCURL)
cmake_minimum_required(VERSION 3.0)
find_package(CURL REQUIRED)

if(${CURL_FOUND})
Expand All @@ -154,22 +89,15 @@ message(STATUS
"Defining the shared library for ${PROJECT_NAME} including "
"all source and header files not in examples."
)

add_library(${PROJECT_NAME} SHARED ${HeaderFileList} ${SourceFileList})
target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES})

# Create a meta target to create examples
add_custom_target(build_all_examples COMMENT A target that requires all the examples.)

message(STATUS "Creating build rules for Examples:")
foreach(Example ${ExamplesFileList})
message(STATUS "\tCreating build rule for ${Example}")
# Get the name without extension or directory
get_filename_component(ExampleName ${Example} NAME_WE)
# Define example executable
add_executable(${ExampleName} ${Example})
# Link example against curlpp
target_link_libraries(${ExampleName} ${PROJECT_NAME})
# make the meta target depend on this example.
add_dependencies(build_all_examples ${ExampleName})
endforeach(Example ${ExamplesFileList})
add_library(${PROJECT_NAME}_static STATIC ${HeaderFileList} ${SourceFileList})
target_link_libraries(${PROJECT_NAME}_static ${CURL_LIBRARIES})

install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_static
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static)

12 changes: 0 additions & 12 deletions doc/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit da68a3a

Please sign in to comment.