meltwater / served

A C++11 RESTful web server library
MIT License
710 stars 173 forks source link

served: support building both static and shared libraries #48

Closed AdrianDC closed 5 years ago

AdrianDC commented 5 years ago

Building both static and shared targets fails with the following error:

CMake Error at src/served/CMakeLists.txt:79 (ADD_LIBRARY):                                                                           
ADD_LIBRARY cannot create target "served" because another target with the                                                          
same name already exists.  The existing target is a static library created                                                         
in source directory "/media/SPHEREA/Git/tns-mars_aisc/served/src/served".                                                          
See documentation for policy CMP0002 for more details.                                                                             

Correction validated with :

cmake -DSERVED_BUILD_SHARED=ON -DSERVED_BUILD_STATIC=ON -DSERVED_BUILD_EXAMPLES=OFF -DSERVED_BUILD_RPM=ON ../served
make

Resulting RPM contents to validate the release:

make package
rpm -qlp ./libserved-*.rpm

/usr/include/served
/usr/include/served/methods.hpp
/usr/include/served/methods_handler.hpp
/usr/include/served/multiplexer.hpp
/usr/include/served/mux
/usr/include/served/mux/empty_matcher.hpp
/usr/include/served/mux/matchers.hpp
/usr/include/served/mux/regex_matcher.hpp
/usr/include/served/mux/segment_matcher.hpp
/usr/include/served/mux/static_matcher.hpp
/usr/include/served/mux/variable_matcher.hpp
/usr/include/served/net
/usr/include/served/net/connection.hpp
/usr/include/served/net/connection_manager.hpp
/usr/include/served/net/server.hpp
/usr/include/served/parameters.hpp
/usr/include/served/plugins.hpp
/usr/include/served/request.hpp
/usr/include/served/request_error.hpp
/usr/include/served/request_parser.hpp
/usr/include/served/request_parser_impl.hpp
/usr/include/served/response.hpp
/usr/include/served/served.hpp
/usr/include/served/status.hpp
/usr/include/served/uri.hpp
/usr/include/served/version.hpp
/usr/lib/libserved.a
/usr/lib/libserved.so
/usr/lib/libserved.so.1.4
/usr/lib/pkgconfig
/usr/lib/pkgconfig/served.pc
AdrianDC commented 5 years ago

Commit updated to enforce against make -j16 build race condition over target dependencies in the examples.

Jeffail commented 5 years ago

Awesome, thanks @AdrianDC, sorry for the delay responding to these PRs.