[CMake] include restbed in my project

J Decker d3ck0r at gmail.com
Wed May 9 19:17:49 EDT 2018


So I have all these third party libraries I keep a copy of...
https://github.com/d3x0r/SACK/tree/master/src/contrib

So libressl for example, has cmakelists.txt

https://github.com/d3x0r/SACK/blob/master/CMakeLists.txt#L680
add_subdirectory( src/contrib/libressl/${LIBRESSL_VERSION} )

which I aliased a bit for upgrade/migration/regression...

I also link optionally to bullet...

IF( EXISTS ${BULLET_SOURCE}/CMakeLists.txt )
   # setup a bunch of options...
add_subdirectory( ${BULLET_SOURCE} bullet )


In the second case, bullet is outside my source tree, (next to it with
other top level projects), so I have to specify a name to be used in the
CMAKE_BINARY_DIR  (bullet) to use for temporary space to build...

and then just link like any other included target

target_link_libaraies( myThing bullet ssl tls crypto )


it's really not that hard, and if you don't understand add_subdirectory....
well... I can't imagine such a world it's so good for breaking up things
into related funcational groups...


On Wed, May 9, 2018 at 4:10 PM, Christofer Jennings <bozmoz at gmail.com>
wrote:

> Thanks for the reply. I haven't figured out how to use add_subdirectories
> like you suggested but I was able to get it working based on this
> https://github.com/josesj/rest-json-cpp-boilerplate
>
> It uses find_package and etc. ... maybe a little overkill, I don't know.
> But at least I got off the ground. :)
>
> On Sat, May 5, 2018 at 12:09 PM J Decker <d3ck0r at gmail.com> wrote:
>
>> for such things I often include the sources in my tree and just
>> 'add_subdirectory( "extra/restbed" )'
>> it's cleaner to do a external project rule...
>> which can download/checkout sources and then build those and the output
>> is findable by other projects just by referencing the targets.
>> https://cmake.org/cmake/help/latest/module/ExternalProject.html
>>
>> On Sat, May 5, 2018 at 11:21 AM, Christofer Jennings <bozmoz at gmail.com>
>> wrote:
>>
>>> Hi All,
>>>
>>> How do you use a 3rd party dependency like restbed in a cmake build?
>>>
>>> Total nube here. First dive into CMake and haven't done C++ for a long
>>> long time. So forgive my ignorance :) This could just as easily be an "I
>>> forgot C++" as an "I don't know CMake"...
>>>
>>> I'm trying to use restbed. I've got it to compile and self test with
>>> `cmake, `make install`, and `make test` as directed on the site:
>>> https://github.com/Corvusoft/restbed#build
>>> It makes a `distribution` folder with `include` and `library`
>>> sub-folders. The `library` has .a and .so or .dylib files. The `include`
>>> folder just has headers, and a `restbed` file with #includes in it.
>>>
>>> I'm using the example on the same page as starting point:
>>> https://github.com/Corvusoft/restbed#example
>>>
>>> ... I could list out my failed attempts but I don't think it'd help.
>>> Basically find_package doesn't find it, and other things I've tried don't
>>> work. I'm digging around online but so far nothing seems to fit--which
>>> makes me think it's something really really simple that I just don't
>>> understand.
>>>
>>> Thanks!
>>> -Chris
>>>
>>>
>>>
>>>
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Please keep messages on-topic and check the CMake FAQ at:
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Kitware offers various services to support the CMake community. For more
>>> information on each offering, please visit:
>>>
>>> CMake Support: http://cmake.org/cmake/help/support.html
>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/
>>> opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> https://cmake.org/mailman/listinfo/cmake
>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180509/db12d09b/attachment-0001.html>


More information about the CMake mailing list