[CDRIVER-1052] CMakeLists.txt build is incomplete and makes the driver unusable for the C++ driver Created: 14/Dec/15  Updated: 27/Jan/16  Resolved: 14/Jan/16

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.3.0
Fix Version/s: 1.3.1

Type: Bug Priority: Minor - P4
Reporter: Jean-Bernard Jansen Assignee: Hannes Magnusson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All.


Backwards Compatibility: Fully Compatible

 Description   

The CMakeLists.txt is missing installation instructions for a header file and for pkg-config files.

Therefore, a installation with the CMakeLists.txt makes pkg-config unable to detect the library. This affects for instance any build of the C++ driver.

The missing header affects at least the build of the new C++ driver.



 Comments   
Comment by Githook User [ 27/Jan/16 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: Merge remote-tracking branch 'upstream/r1.3'

Comment by Githook User [ 27/Jan/16 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: Merge remote-tracking branch 'upstream/r1.3'

Comment by Githook User [ 27/Jan/16 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-1052: update NEWS
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/f918fa43759be50d6901bf5b28548c3f135fde3a

Comment by Githook User [ 27/Jan/16 ]

Author:

{u'name': u'Jean-Bernard Jansen', u'email': u'jeanbernard@jansen.fr'}

Message: Fix CDRIVER-1052: CMakeLists.txt build is incomplete

Comment by Hannes Magnusson [ 14/Jan/16 ]

Thanks for the patch!

Comment by Githook User [ 14/Jan/16 ]

Author:

{u'name': u'Jean-Bernard Jansen', u'email': u'jeanbernard@jansen.fr'}

Message: Fix CDRIVER-1052: CMakeLists.txt build is incomplete

Comment by Hannes Magnusson [ 14/Jan/16 ]

Sounds good to me.

For the record though: Like I previously said, we do not actively run any tests using cmake with the exception of MSVC configuration generation.
We may add such compilation step to our matrix in the future, but for now the recommendation is to use the autotools toolchain.

I fully agree that while its there, it should work of course

Comment by Andrew Morrow (Inactive) [ 13/Jan/16 ]

Painful only in the sense of maintaining two parallel build systems.

Comment by Jean-Bernard Jansen [ 13/Jan/16 ]

Autotools projects can still be used with ExternalProject_Add. It is not as smooth of course, but it can be done.

Why painful ? There is no way a migration to CMake could hurt the project. I think the scope of this matter goes beyond the current issue. I am sure I am not the first one to suggest CMake as a replacement.

Comment by Andrew Morrow (Inactive) [ 13/Jan/16 ]

It is painful, but I agree with duckie that if the C driver is going to offer a CMake build, it should be fully functional, and not only on Windows. Using ExternalProject_Add is very common in CMake projects, and being able to ExternalProject_Add the C driver would be very useful for systems that want to vendor it, rather than depend on the system version.

Comment by Jean-Bernard Jansen [ 13/Jan/16 ]

Push request updated following Andrew changes.

Comment by Jean-Bernard Jansen [ 13/Jan/16 ]

The reason I used CMake is quite straightforward : I saw a CMakeLists.txt file and assumed the migration from the autotools were ongoing. Since MSVC support seems a requirement, it does not seem sane to keep maintaining two separate build systems in
the long term.

I tried the autotools and saw that the libbson dependency was automatically dowloaded. This could be made with CMake too, but I found it comfortable to manage the dependencies myself. I build the driver with CMake from another project, and the CMake build does well with the "ExternalProject" command of said project.

By the way, that is a small patch that does not hurt the current state. I'll just fix the "private header" matter since Andrew removed them.

Comment by Hannes Magnusson [ 12/Jan/16 ]

I'm a bit curious why you decided to compile the c driver using cmake?
Did you follow instructions somewhere that indicated it was the norm?

The cmake approach isn't something we actively test or build ourself – in fact, the only reason it is here at all is so it can generate the MSVC configuration.
We don't actually use cmake to compile the driver anywhere, and it isn't exactly recommended or endorsed approach (although – clearly, it should work, as long as its there).

Comment by Jean-Bernard Jansen [ 14/Dec/15 ]

Added a pull request with a fix https://github.com/mongodb/mongo-c-driver/pull/304.

Generated at Wed Feb 07 21:11:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.