Skip to content

Commit f06878f

Browse files
authored
CXX-2971 Fix bsoncxx package name in pkg-config requires field (#1103)
* Depend on CMake to handle quoting of command-line arguments correctly * CXX-2971 Fix bsoncxx package name in pkg-config requires list * Address "argument isn't numeric in numeric comparison" pkg-config warnings
1 parent 2c8eb42 commit f06878f

File tree

3 files changed

+45
-35
lines changed

3 files changed

+45
-35
lines changed

CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -438,16 +438,16 @@ install(FILES LICENSE README.md THIRD-PARTY-NOTICES
438438
# This is the command that produces the distribution tarball
439439
add_custom_command(OUTPUT ${DIST_FILE}
440440
COMMAND ${CMAKE_COMMAND}
441-
-D CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/cmake/make_dist
442-
-D PACKAGE_PREFIX=${PACKAGE_PREFIX}
443-
-D MONGOCXX_SOURCE_DIR=${CMAKE_SOURCE_DIR}
444-
-D BUILD_SOURCE_DIR=${BUILD_SOURCE_DIR}
445-
-D SHELL=${SHELL}
446-
"-Ddist_generated=\"${dist_generated}\""
447-
-P ${PROJECT_SOURCE_DIR}/cmake/make_dist/MakeDist.cmake
441+
-D "CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/cmake/make_dist"
442+
-D "PACKAGE_PREFIX=${PACKAGE_PREFIX}"
443+
-D "MONGOCXX_SOURCE_DIR=${CMAKE_SOURCE_DIR}"
444+
-D "BUILD_SOURCE_DIR=${BUILD_SOURCE_DIR}"
445+
-D "SHELL=${SHELL}"
446+
-D "dist_generated=${dist_generated}"
447+
-P ${PROJECT_SOURCE_DIR}/cmake/make_dist/MakeDist.cmake
448448

449449
DEPENDS
450-
${ALL_DIST} ${dist_generated_depends}
450+
${ALL_DIST} ${dist_generated_depends}
451451
)
452452

453453
if(NOT(TARGET dist OR TARGET distcheck))

src/bsoncxx/cmake/CMakeLists.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,17 @@ if(1)
8484
add_custom_command(
8585
OUTPUT ${pcfilename}
8686
COMMAND ${CMAKE_COMMAND}
87-
-D src_dir="${CMAKE_CURRENT_SOURCE_DIR}"
88-
-D bin_dir="${CMAKE_CURRENT_BINARY_DIR}"
89-
-D prefix="${CMAKE_INSTALL_PREFIX}"
90-
-D includedir="${CMAKE_INSTALL_INCLUDEDIR}"
91-
-D libdir="${CMAKE_INSTALL_LIBDIR}"
92-
-D output_name="${output_name}"
93-
-D version="${BSONCXX_VERSION}"
94-
-D is_static="${is_static}"
95-
-D libbson_req_abi_ver="${LIBBSON_REQUIRED_ABI_VERSION}"
96-
-D libbson_req_ver="${LIBBSON_REQUIRED_VERSION}"
97-
-D mnmlstc_enabled="${BSONCXX_POLY_MNMLSTC_ENABLED}"
87+
-D "src_dir=${CMAKE_CURRENT_SOURCE_DIR}"
88+
-D "bin_dir=${CMAKE_CURRENT_BINARY_DIR}"
89+
-D "prefix=${CMAKE_INSTALL_PREFIX}"
90+
-D "includedir=${CMAKE_INSTALL_INCLUDEDIR}"
91+
-D "libdir=${CMAKE_INSTALL_LIBDIR}"
92+
-D "output_name=${output_name}"
93+
-D "version=${BSONCXX_VERSION_NO_EXTRA}"
94+
-D "is_static=${is_static}"
95+
-D "libbson_req_abi_ver=${LIBBSON_REQUIRED_ABI_VERSION}"
96+
-D "libbson_req_ver=${LIBBSON_REQUIRED_VERSION}"
97+
-D "mnmlstc_enabled=${BSONCXX_POLY_MNMLSTC_ENABLED}"
9898
-P ${CMAKE_CURRENT_SOURCE_DIR}/generate-pc.cmake
9999
MAIN_DEPENDENCY
100100
${CMAKE_CURRENT_SOURCE_DIR}/libbsoncxx.pc.in

src/mongocxx/cmake/CMakeLists.txt

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,38 @@ if(1)
6161

6262
set(pcfilename "${CMAKE_CURRENT_BINARY_DIR}/lib${output_name}.pc")
6363

64-
if(LINK_TYPE STREQUAL "STATIC")
65-
get_target_property(bsoncxx_name bsoncxx_static OUTPUT_NAME)
66-
set(is_static 1)
64+
if (ENABLE_ABI_TAG_IN_PKGCONFIG_FILENAMES)
65+
if(LINK_TYPE STREQUAL "STATIC")
66+
get_target_property(bsoncxx_name bsoncxx_static OUTPUT_NAME)
67+
set(is_static 1)
68+
else()
69+
get_target_property(bsoncxx_name bsoncxx_shared OUTPUT_NAME)
70+
set(is_static 0)
71+
endif()
6772
else()
68-
get_target_property(bsoncxx_name bsoncxx_shared OUTPUT_NAME)
69-
set(is_static 0)
73+
if(LINK_TYPE STREQUAL "STATIC")
74+
set(bsoncxx_name "$CACHE{BSONCXX_OUTPUT_BASENAME}-static")
75+
set(is_static 1)
76+
else()
77+
set(bsoncxx_name "$CACHE{BSONCXX_OUTPUT_BASENAME}")
78+
set(is_static 0)
79+
endif()
7080
endif()
7181

7282
add_custom_command(
7383
OUTPUT ${pcfilename}
7484
COMMAND ${CMAKE_COMMAND}
75-
-D src_dir="${CMAKE_CURRENT_SOURCE_DIR}"
76-
-D bin_dir="${CMAKE_CURRENT_BINARY_DIR}"
77-
-D prefix="${CMAKE_INSTALL_PREFIX}"
78-
-D includedir="${CMAKE_INSTALL_INCLUDEDIR}"
79-
-D libdir="${CMAKE_INSTALL_LIBDIR}"
80-
-D output_name="${output_name}"
81-
-D version="${MONGOCXX_VERSION}"
82-
-D is_static="${is_static}"
83-
-D bsoncxx_name="${bsoncxx_name}"
84-
-D libmongoc_req_abi_ver="${LIBMONGOC_REQUIRED_ABI_VERSION}"
85-
-D libmongoc_req_ver="${LIBMONGOC_REQUIRED_VERSION}"
85+
-D "src_dir=${CMAKE_CURRENT_SOURCE_DIR}"
86+
-D "bin_dir=${CMAKE_CURRENT_BINARY_DIR}"
87+
-D "prefix=${CMAKE_INSTALL_PREFIX}"
88+
-D "includedir=${CMAKE_INSTALL_INCLUDEDIR}"
89+
-D "libdir=${CMAKE_INSTALL_LIBDIR}"
90+
-D "output_name=${output_name}"
91+
-D "version=${MONGOCXX_VERSION_NO_EXTRA}"
92+
-D "is_static=${is_static}"
93+
-D "bsoncxx_name=${bsoncxx_name}"
94+
-D "libmongoc_req_abi_ver=${LIBMONGOC_REQUIRED_ABI_VERSION}"
95+
-D "libmongoc_req_ver=${LIBMONGOC_REQUIRED_VERSION}"
8696
-P ${CMAKE_CURRENT_SOURCE_DIR}/generate-pc.cmake
8797
MAIN_DEPENDENCY
8898
${CMAKE_CURRENT_SOURCE_DIR}/libmongocxx.pc.in

0 commit comments

Comments
 (0)