Skip to content

CXX-3290 fix static pkgconfig requirements #1406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions examples/projects/bsoncxx/pkg-config/shared/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ set -o pipefail

# Sanity-check that static library macros are not set when building against the shared library.
# Users don't need to include this section in their projects.
(pkg-config --cflags libbsoncxx | grep -v -- -DBSONCXX_STATIC) ||
(
echo "Expected BSONCXX_STATIC to not be set" >&2
exit 1
)
if ! pkg-config --cflags libbsoncxx | grep -v -q -- -DBSONCXX_STATIC; then
echo "Expected BSONCXX_STATIC to not be set" >&2
exit 1
fi

rm -rf build/*
cd build
Expand Down
15 changes: 10 additions & 5 deletions examples/projects/bsoncxx/pkg-config/static/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ set -o pipefail

# Sanity-check that static library macros are set when building against the static library. Users
# don't need to include this section in their projects.
(pkg-config --cflags libbsoncxx-static | grep -- -DBSONCXX_STATIC) ||
(
echo "Expected BSONCXX_STATIC to be set" >&2
exit 1
)
if ! pkg-config --cflags libbsoncxx-static | grep -q -- -DBSONCXX_STATIC; then
echo "Expected BSONCXX_STATIC to be set" >&2
exit 1
fi

# Sanity-check that static libbson is required. Regression test for CXX-3290.
if ! pkg-config --print-requires libbsoncxx-static | grep -q -- bson2-static; then
echo "Expected bson2-static to be required" >&2
exit 1
fi

rm -rf build/*
cd build
Expand Down
19 changes: 9 additions & 10 deletions examples/projects/mongocxx/pkg-config/shared/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ set -o pipefail

# Sanity-check that static library macros are not set when building against the shared library.
# Users don't need to include this section in their projects.
(pkg-config --cflags libmongocxx | grep -v -- -DBSONCXX_STATIC) ||
(
echo "Expected BSONCXX_STATIC to not be set" >&2
exit 1
)
(pkg-config --cflags libmongocxx | grep -v -- -DMONGOCXX_STATIC) ||
(
echo "Expected MONGOCXX_STATIC to not be set" >&2
exit 1
)
if ! pkg-config --cflags libmongocxx | grep -v -q -- -DBSONCXX_STATIC; then
echo "Expected BSONCXX_STATIC to not be set" >&2
exit 1
fi

if ! pkg-config --cflags libmongocxx | grep -v -q -- -DMONGOCXX_STATIC; then
echo "Expected MONGOCXX_STATIC to not be set" >&2
exit 1
fi

rm -rf build/*
cd build
Expand Down
25 changes: 15 additions & 10 deletions examples/projects/mongocxx/pkg-config/static/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ set -o pipefail

# Sanity-check that static library macros are set when building against the static library. Users
# don't need to include this section in their projects.
(pkg-config --cflags libmongocxx-static | grep -- -DBSONCXX_STATIC) ||
(
echo "Expected BSONCXX_STATIC to be set" >&2
exit 1
)
(pkg-config --cflags libmongocxx-static | grep -- -DMONGOCXX_STATIC) ||
(
echo "Expected MONGOCXX_STATIC to be set" >&2
exit 1
)
if ! pkg-config --cflags libmongocxx-static | grep -q -- -DBSONCXX_STATIC; then
echo "Expected BSONCXX_STATIC to be set" >&2
exit 1
fi

if ! pkg-config --cflags libmongocxx-static | grep -q -- -DMONGOCXX_STATIC; then
echo "Expected MONGOCXX_STATIC to be set" >&2
exit 1
fi

# Sanity-check that static libmongoc is required. Regression test for CXX-3290.
if ! pkg-config --print-requires libmongocxx-static | grep -q -- mongoc2-static; then
echo "Expected mongoc2-static to be required" >&2
exit 1
fi

rm -rf build/*
cd build
Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/cmake/generate-pc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(1)
set(requires "")

if(is_static)
list(APPEND requires "bson2 >= ${bson_req_ver}")
list(APPEND requires "bson2-static >= ${bson_req_ver}")
endif()

list(JOIN requires ", " requires)
Expand Down
2 changes: 1 addition & 1 deletion src/mongocxx/cmake/generate-pc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if(1)

if(is_static)
list(APPEND requires "lib${bsoncxx_name} >= ${version}")
list(APPEND requires "mongoc2 >= ${mongoc_req_ver}")
list(APPEND requires "mongoc2-static >= ${mongoc_req_ver}")
else()
list(APPEND requires "lib${bsoncxx_name} >= ${version}")
endif()
Expand Down