Skip to content
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
21 changes: 17 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ set(PACKAGE_VERSION "${PROJECT_VERSION}")
set(VERSION "${PROJECT_VERSION}")
configure_file(${CMAKE_CURRENT_LIST_DIR}/mbus/config.h.in ${CMAKE_CURRENT_LIST_DIR}/config.h @ONLY)

add_library(
${PROJECT_NAME}
# list of source files
add_library(objlib OBJECT
"${CMAKE_CURRENT_LIST_DIR}/mbus/mbus-protocol.c"
"${CMAKE_CURRENT_LIST_DIR}/mbus/mbus-protocol.h"
"${CMAKE_CURRENT_LIST_DIR}/mbus/mbus-tcp.c"
Expand All @@ -107,6 +107,14 @@ add_library(
"${CMAKE_CURRENT_LIST_DIR}/mbus/mbus-protocol-aux.h"
"${CMAKE_CURRENT_LIST_DIR}/mbus/mbus-serial.c"
"${CMAKE_CURRENT_LIST_DIR}/mbus/mbus-serial.h")

# shared and static libraries built from the same object files
add_library(${PROJECT_NAME} SHARED $<TARGET_OBJECTS:objlib>)
add_library(libmbus_static STATIC $<TARGET_OBJECTS:objlib>)

set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1)
set_target_properties(libmbus_static PROPERTIES OUTPUT_NAME mbus)

target_include_directories(
${PROJECT_NAME}
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>" "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
Expand All @@ -118,7 +126,9 @@ if(NOT MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wno-pedantic)
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
set_target_properties(${PROJECT_NAME}
PROPERTIES PREFIX ""
SOVERSION ${VERSION})

if(CLANG_TIDY_EXE)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE}")
Expand Down Expand Up @@ -173,7 +183,6 @@ install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT lib
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" COMPONENT dev
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT lib)
install(
EXPORT ${PROJECT_NAME}Targets
Expand All @@ -197,6 +206,10 @@ install(
FILES_MATCHING
PATTERN "*.h")

install(
TARGETS libmbus_static
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" COMPONENT dev)

# ##############################################################################
# package
# mkdir build ; cd build ; cmake .. -DLIBMBUS_PACKAGE_DEB=ON ; cpack ..
Expand Down
12 changes: 12 additions & 0 deletions build-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ------------------------------------------------------------------------------
# Copyright (C) 2012, Robert Johansson <rob@raditex.nu>, Raditex Control AB
# All rights reserved.
#
# rSCADA
# http://www.rSCADA.se
# info@raditex.nu
#
# ------------------------------------------------------------------------------

debuild -i -us -uc -b
#sudo pbuilder build $(NAME)_$(VERSION)-1.dsc
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#export DH_VERBOSE=1

%:
dh --with autoreconf $@
dh $@

.PHONY: override_dh_strip
override_dh_strip:
Expand Down