dbcppp icon indicating copy to clipboard operation
dbcppp copied to clipboard

Support using as CMake dependency

Open CorvetteCole opened this issue 3 years ago • 7 comments

Another project that recently implemented this in a PR can be seen here: https://github.com/tplgy/cppcodec/pull/76.

Basically, allows massively simplified project configuration. The end goal for me is that I can do something like the following in my CMakeLists.txt:

# fetch dbcppp
FetchContent_Declare(
        libdbcppp
        GIT_REPOSITORY https://github.com/xR3b0rn/dbcppp
        GIT_TAG 54ce78ad53442db94e03d16a4fd5f3b339dab193
)
FetchContent_MakeAvailable(libdbcppp)

Another project that supports this is argparse (https://github.com/p-ranav/argparse#cmake-integration).

This did not work when I tested this with your project, I tried to get it working but ran out of time and the CMake files are quite complex. Please let me know what you think about this

CorvetteCole avatar Sep 27 '22 16:09 CorvetteCole

The above code snippet works fine in CMake, but I can not import or access the library in my code

CorvetteCole avatar Sep 27 '22 16:09 CorvetteCole

I also think this could be somehow related to #96 . After seeing that, I figured it would work but unfortunately not

CorvetteCole avatar Sep 27 '22 17:09 CorvetteCole

Been trying to get Conan working with this library: https://github.com/conan-io/conan-center-index/pull/13826 I do have a patch file that allows it to work with the Conan packaging system, but get access violations when building as a dll. I can see about porting over some of the functionality.

Nomalah avatar Oct 28 '22 21:10 Nomalah

it would be great if you managed to get the above CMake code snippet I provided above working. Would be very thankful!

CorvetteCole avatar Oct 28 '22 22:10 CorvetteCole

Do you have a public project I could test with?

Nomalah avatar Oct 29 '22 00:10 Nomalah

Do you have a public project I could test with?

@Nomalah I know this is a lot late, but here: https://github.com/CorvetteCole/dbcppp-cmake

It seems to pull it in as I'd expect, but can't find the actual import when compiling. Can not figure it out. If you comment out the dbcppp import in main.cpp it will compile properly. Would really appreciate it if you figured that out!!

CorvetteCole avatar Jan 10 '23 23:01 CorvetteCole

I also included argparse as an example imported in the same way (except it works)

CorvetteCole avatar Jan 10 '23 23:01 CorvetteCole