diff options
author | Matt Porter <mporter@konsulko.com> | 2018-06-25 11:01:11 -0400 |
---|---|---|
committer | Matt Porter <mporter@konsulko.com> | 2018-06-25 11:01:11 -0400 |
commit | 389b5994553fdae59d484068d542910efee79e9c (patch) | |
tree | d987b1aec2fed4da44e0b4776be4cea8dfde22be /CMakeLists.txt | |
parent | e8b328e0516d8ead9af13c8379a6cd1dbbb8a9e9 (diff) |
Reorg binding-specific modules into subdirectories
Move binding-specific code into per-binding subdirectories.
This separates the core message engine code and simplifies adding
new binding-specific modules.
Bug-AGL: SPEC-1525
Change-Id: I8fc545e3af375e2ed9e79a41363b7ade97e9b20a
Signed-off-by: Matt Porter <mporter@konsulko.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 57 |
1 files changed, 48 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9165f49..7b08ed8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,25 +8,64 @@ find_package(Qt5WebSockets REQUIRED) include(GNUInstallDirs) +macro (add_headers) + file (RELATIVE_PATH _relPath "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach (_hdr ${ARGN}) + if (_relPath) + list (APPEND HDRS "${_relPath}/${_hdr}") + else() + list (APPEND HDRS "${_hdr}") + endif() + endforeach() + if (_relPath) + set (HDRS ${HDRS} PARENT_SCOPE) + endif() +endmacro() + +macro (add_sources) + file (RELATIVE_PATH _relPath "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach (_src ${ARGN}) + if (_relPath) + list (APPEND SRCS "${_relPath}/${_src}") + else() + list (APPEND SRCS "${_src}") + endif() + endforeach() + if (_relPath) + set (SRCS ${SRCS} PARENT_SCOPE) + endif() +endmacro() + set(DEST_DIR "${CMAKE_INSTALL_PREFIX}") set(PRIVATE_LIBS "${PRIVATE_LIBS} -lqtappfw") CONFIGURE_FILE("qtappfw.pc.in" "qtappfw.pc" @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qtappfw.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig) -add_library(qtappfw SHARED message.cpp messageengine.cpp - responsemessage.cpp - bluetooth.cpp bluetoothmessage.cpp - mediaplayer.cpp mediaplayermessage.cpp - pbap.cpp pbapmessage.cpp - telephony.cpp telephonymessage.cpp - weather.cpp weathermessage.cpp) +set (SUBDIRS + bluetooth + mediaplayer + pbap + telephony + weather) + +add_headers(message.h messageengine.h) +add_sources(message.cpp messageengine.cpp responsemessage.cpp) + +foreach(subdir ${SUBDIRS}) + add_subdirectory(${subdir}) +endforeach() + +add_library(qtappfw SHARED ${SRCS}) + target_link_libraries(qtappfw Qt5::WebSockets vcard) set_target_properties(qtappfw PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1 - PUBLIC_HEADER "message.h;messageengine.h;bluetooth.h;bluetoothmessage.h;mediaplayer.h;mediaplayermessage.h;pbap.h;pbapmessage.h;responsemessage.h;telephony.h;telephonymessage.h;weather.h;weathermessage.h") -target_include_directories(qtappfw PRIVATE .) + PUBLIC_HEADER "${HDRS}") + +target_include_directories(qtappfw PRIVATE . ${SUBDIRS}) + install(TARGETS qtappfw LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qtappfw) |