Hi,
first off all, sorry, if I miss something, or my problem is due to the lack of my CMake knowledge.
As I googled the problem, I found a similar issue, however my problem remains unsolved. The related link:
Issue description:
I need to compile mongo-c-driver (1.17.2) and mongo-cxx-driver (3.6.2) for my project and link statically. It is done in a superbuild CMake configuration in our product. The related cmake file:
ExternalProject_Add(
mongo_c_driver
GIT_REPOSITORY https://github.com/mongodb/mongo-c-driver.git
GIT_TAG 1.17.2
SOURCE_DIR "${PROJECT_SOURCE_DIR}/mongo-c-driver"
BINARY_DIR "${PROJECT_SOURCE_DIR}/mongo-c-driver/build"
BUILD_ALWAYS 1
UPDATE_COMMAND ""
CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=Release
-DENABLE_AUTOMATIC_INIT_AND_CLEANUP:BOOL=OFF
-DCMAKE_INSTALL_PREFIX:STRING=${PROJECT_SOURCE_DIR}/bin
)
ExternalProject_Add(
mongo_cxx_driver
GIT_REPOSITORY https://github.com/mongodb/mongo-cxx-driver.git
GIT_TAG c315129c7b70c304d894ea60b7df71d1f3a71acf
SOURCE_DIR "${PROJECT_SOURCE_DIR}/mongo-cxx-driver"
BINARY_DIR "${PROJECT_SOURCE_DIR}/mongo-cxx-driver/build"
BUILD_ALWAYS 1
UPDATE_COMMAND ""
CMAKE_CACHE_ARGS
-DBUILD_SHARED_AND_STATIC_LIBS:BOOL=ON
-DMONGOCXX_ENABLE_SSL:BOOL=ON
-DBSONCXX_POLY_USE_MNMLSTC:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_INSTALL_PREFIX:STRING=${PROJECT_SOURCE_DIR}/bin
DEPENDS mongo_c_driver
)
At this point, everything seems to be perfect, the target installation folder structure:
The problem is when I want to use the result, libbsoxx-static wants to load libbison-static 1.13.0, however I have build the 1.17.2 of it. The related section of libbsoncxx-static-config.cmake
set(LIBBSONCXX_STATIC_VERSION_MAJOR 3)
set(LIBBSONCXX_STATIC_VERSION_MINOR 6)
set(LIBBSONCXX_STATIC_VERSION_PATCH 1)
set(LIBBSONCXX_STATIC_PACKAGE_VERSION 3.6.1-pre)
# We need to pull in the libbson-static-* library to read the BSON_STATIC_LIBRARIES variable. We
# can ignore the other variables exported by that package (e.g. BSON_STATIC_INCLUDE_DIRS,
# BSON_STATIC_DEFINITIONS), since bsoncxx hides the existence of libbson from the user through
# abstraction. bsoncxx users generally should not need to include libbson headers directly.
find_package(libbson-static-1.0 1.13.0 REQUIRED)
Can anybody help me, what did I wrong please?