Skip to content

fix: LD_BUILD_SHARED_LIBS build flag usage #260

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

Merged
merged 2 commits into from
Oct 19, 2023
Merged
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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ message(STATUS "LaunchDarkly: using OpenSSL v${OPENSSL_VERSION}")
# linked into the binary.
set(Boost_USE_STATIC_LIBS ON)

if (NOT LD_BUILD_STATIC_LIBS)
if (LD_BUILD_SHARED_LIBS)
# When building a shared library we hide all symbols
# aside from this we have specifically exported for the C-API.
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
Expand All @@ -129,7 +129,7 @@ add_subdirectory(libs/common)
add_subdirectory(libs/internal)
add_subdirectory(libs/server-sent-events)

# Built as static or shared depending on LD_BUILD_STATIC_LIBS variable.
# Built as static or shared depending on LD_BUILD_SHARED_LIBS variable.
# This target "links" in common, internal, and sse as object libraries.
add_subdirectory(libs/client-sdk)

Expand Down
8 changes: 3 additions & 5 deletions cmake/certify.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ endif ()
FetchContent_Declare(boost_certify
GIT_REPOSITORY https://github.com/djarek/certify.git
GIT_TAG 97f5eebfd99a5d6e99d07e4820240994e4e59787
)
)

set(BUILD_TESTING OFF)

FetchContent_GetProperties(boost_certify)
if(NOT boost_certify_POPULATED)
if (NOT boost_certify_POPULATED)
FetchContent_Populate(boost_certify)
add_subdirectory(${boost_certify_SOURCE_DIR} ${boost_certify_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
endif ()

set(BUILD_TESTING "${ORIGINAL_BUILD_TESTING}")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is a leftover that should have been removed. Certify is an INTERFACE library (header only.)

set(BUILD_SHARED_LIBS "${ORIGINAL_BUILD_SHARED_LIBS}")
4 changes: 2 additions & 2 deletions libs/client-sdk/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ target_sources(${LIBNAME} PRIVATE
)


if (MSVC OR LD_BUILD_STATIC_LIBS)
if (MSVC OR (NOT LD_BUILD_SHARED_LIBS))
target_link_libraries(${LIBNAME}
PUBLIC launchdarkly::common
PRIVATE Boost::headers Boost::json Boost::url launchdarkly::sse launchdarkly::internal foxy)
Expand All @@ -76,7 +76,7 @@ set_property(TARGET ${LIBNAME} PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")

install(TARGETS ${LIBNAME})
if (BUILD_SHARED_LIBS AND MSVC)
if (LD_BUILD_SHARED_LIBS AND MSVC)
install(FILES $<TARGET_PDB_FILE:${LIBNAME}> DESTINATION bin OPTIONAL)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have cmake tests that actually try to use the install files, which is why this didn't break CI.

endif ()
# Using PUBLIC_HEADERS would flatten the include.
Expand Down