Skip to content
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

Add option for static library #1

Open
wants to merge 2 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
25 changes: 17 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,22 @@ set( BLUEZ_SOURCES
"${BLUEZ_SOURCE_DIR}/GattDescriptor1.cpp"
"${BLUEZ_SOURCE_DIR}/Util.cpp" )

option(BUILD_SHARED_LIBS "Build shared libraries (.so) instead of static ones (.a)" ON)

add_library( bluez-dbus-cpp SHARED
${BLUEZ_SOURCES}
${BLUEZ_HEADERS} )
if(BUILD_SHARED_LIBS)
add_library( bluez-dbus-cpp SHARED
${BLUEZ_SOURCES}
${BLUEZ_HEADERS} )
else()
add_library( bluez-dbus-cpp STATIC
${BLUEZ_SOURCES}
${BLUEZ_HEADERS} )
endif()

target_include_directories( bluez-dbus-cpp PUBLIC
$<BUILD_INTERFACE:${BLUEZ_HEADER_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> )

option(BUILD_SHARED_LIBS "Build shared libraries (.so) instead of static ones (.a)" ON)

if(DEFINED BUILD_SHARED_LIBS)
set_target_properties(bluez-dbus-cpp PROPERTIES POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS})
endif()
Expand All @@ -94,8 +99,12 @@ set_target_properties(bluez-dbus-cpp
OUTPUT_NAME "bluez-dbus-cpp")

# Link up
find_package(sdbus-c++ REQUIRED)
target_link_libraries( bluez-dbus-cpp PUBLIC SDBusCpp::sdbus-c++)
find_package(sdbus-c++)
if(sdbus-c++_FOUND)
target_link_libraries( bluez-dbus-cpp PUBLIC SDBusCpp::sdbus-c++)
else()
target_link_libraries( bluez-dbus-cpp PUBLIC sdbus-c++)
endif()

#-------------------------------
# INSTALL
Expand Down Expand Up @@ -152,4 +161,4 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/bluez-dbus-cpp-config.cmake

configure_file(pkgconfig/bluez-dbus-cpp.pc.in pkgconfig/bluez-dbus-cpp.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/bluez-dbus-cpp.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT dev)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT dev)
1 change: 1 addition & 0 deletions src/GattCharacteristic1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ GattCharacteristic1::~GattCharacteristic1()
void GattCharacteristic1::addValue( std::string value )
{
value_.assign( value.begin(), value.end() );
emitPropertyChangedSignal("Value");
}

void GattCharacteristic1::addValue( std::vector<uint8_t> value )
Expand Down