Skip to content

Commit

Permalink
cmake: Add config files
Browse files Browse the repository at this point in the history
  • Loading branch information
syyyr committed Nov 25, 2023
1 parent 23b4f5d commit b487db6
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 14 deletions.
11 changes: 9 additions & 2 deletions libshvbroker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ qt_add_library(libshvbroker
include/shv/broker/clientconnectionnode.h
include/shv/broker/groupmapping.h
)
add_library(libshv::libshvbroker ALIAS libshvbroker)

if(WITH_SHV_WEBSOCKETS)
target_sources(libshvbroker PRIVATE
Expand All @@ -46,7 +47,10 @@ if(OpenLDAP_FOUND)
endif()

target_link_libraries(libshvbroker PUBLIC Qt::Sql libshviotqt)
target_include_directories(libshvbroker PUBLIC include)
target_include_directories(libshvbroker PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_compile_definitions(libshvbroker PRIVATE SHVBROKER_BUILD_DLL)

if(BUILD_TESTING)
Expand All @@ -60,5 +64,8 @@ if(BUILD_TESTING)
add_shvbroker_test(aclmanager)
endif()

install(TARGETS libshvbroker)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE)

install(TARGETS libshvbroker EXPORT libshvConfig)
export(TARGETS libshvbroker NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake")
install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::)
12 changes: 10 additions & 2 deletions libshvchainpack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ add_library(libshvchainpack-cpp
src/chainpack/utils.cpp
include/shv/chainpack/crc32.h
)
add_library(libshv::libshvchainpack-cpp ALIAS libshvchainpack-cpp)

if (NOT WIN32)
target_sources(libshvchainpack-cpp PRIVATE src/chainpack/socketrpcdriver.cpp)
endif()

target_link_libraries(libshvchainpack-cpp libnecrolog::libnecrolog libshvchainpack-c)
target_include_directories(libshvchainpack-cpp PUBLIC include)
target_include_directories(libshvchainpack-cpp PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

target_compile_definitions(libshvchainpack-cpp PRIVATE SHVCHAINPACK_BUILD_DLL)

function(add_shv_test test_name)
Expand Down Expand Up @@ -71,5 +76,8 @@ if(BUILD_TESTING)
endif()
endif()

install(TARGETS libshvchainpack-cpp)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE)

install(TARGETS libshvchainpack-cpp EXPORT libshvConfig)
export(TARGETS libshvchainpack-cpp NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake")
install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::)
9 changes: 7 additions & 2 deletions libshvchainpack/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ add_library(libshvchainpack-c STATIC
ccpcp_convert.c
ccpon.c
)
target_include_directories(libshvchainpack-c PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(libshvchainpack-c PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

function(add_shv_test test_name)
add_executable(test_${test_name}
Expand All @@ -18,5 +20,8 @@ if(BUILD_TESTING)
add_shv_test(ccpcp)
endif()

install(TARGETS libshvchainpack-c)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE)

install(TARGETS libshvchainpack-c EXPORT libshvConfig)
export(TARGETS libshvchainpack-c NAMESPACE libshvchainpack-c:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake")
install(EXPORT libshvConfig DESTINATION "share/libshv/cmake" NAMESPACE libshv::)
11 changes: 9 additions & 2 deletions libshvcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ add_library(libshvcore
src/utils/shvurl.cpp
src/utils/versioninfo.cpp
)
add_library(libshv::libshvcore ALIAS libshvcore)

target_link_libraries(libshvcore libshvchainpack-cpp)
target_include_directories(libshvcore PUBLIC include)
target_include_directories(libshvcore PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_compile_definitions(libshvcore PRIVATE SHVCORE_BUILD_DLL)

function(add_shvcore_test test_name)
Expand All @@ -52,5 +56,8 @@ if(BUILD_TESTING)
endif()
endif()

install(TARGETS libshvcore)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE)

install(TARGETS libshvcore EXPORT libshvConfig)
export(TARGETS libshvcore NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake")
install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::)
12 changes: 10 additions & 2 deletions libshvcoreqt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ qt_add_library(libshvcoreqt
include/shv/coreqt/utils.h
include/shv/coreqt/exception.h
)
add_library(libshv::libshvcoreqt ALIAS libshvcoreqt)

target_link_libraries(libshvcoreqt PUBLIC Qt::Core libshvcore)
target_include_directories(libshvcoreqt PUBLIC include)
target_include_directories(libshvcoreqt PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_compile_definitions(libshvcoreqt PRIVATE SHVCOREQT_BUILD_DLL)

function(add_shvcoreqt_test test_name)
Expand All @@ -34,5 +39,8 @@ if(BUILD_TESTING)
add_shvcoreqt_test(utils)
endif()

install(TARGETS libshvcoreqt)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE)

install(TARGETS libshvcoreqt EXPORT libshvConfig)
export(TARGETS libshvcoreqt NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake")
install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::)
12 changes: 10 additions & 2 deletions libshviotqt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ qt_add_library(libshviotqt
include/shv/iotqt/rpc/socketrpcconnection.h
include/shv/iotqt/utils.h
)
add_library(libshv::libshviotqt ALIAS libshviotqt)

target_link_libraries(libshviotqt PUBLIC Qt::Network libshvcoreqt)

if(NOT EMSCRIPTEN)
Expand All @@ -52,7 +54,10 @@ if(NOT EMSCRIPTEN)
)
endif()

target_include_directories(libshviotqt PUBLIC include)
target_include_directories(libshviotqt PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_compile_definitions(libshviotqt PRIVATE SHVIOTQT_BUILD_DLL)

if(WITH_SHV_WEBSOCKETS)
Expand Down Expand Up @@ -81,5 +86,8 @@ if(BUILD_TESTING)
set_property(TEST test_iotqt_serialportsocket APPEND PROPERTY ENVIRONMENT "TESTS_DIR=${CMAKE_CURRENT_BINARY_DIR}/test_serialportsocket")
endif()

install(TARGETS libshviotqt)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE)

install(TARGETS libshviotqt EXPORT libshvConfig)
export(TARGETS libshviotqt NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake")
install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::)
11 changes: 9 additions & 2 deletions libshvvisu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,18 @@ add_library(libshvvisu
include/shv/visu/svgscene/groupitem.h
include/shv/visu/errorlogmodel.h
)
add_library(libshv::libshvvisu ALIAS libshvvisu)

target_link_libraries(libshvvisu PUBLIC Qt::Widgets libshviotqt)
target_include_directories(libshvvisu PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(libshvvisu PUBLIC include)
target_include_directories(libshvvisu PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_compile_definitions(libshvvisu PRIVATE SHVVISU_BUILD_DLL)

install(TARGETS libshvvisu)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE)

install(TARGETS libshvvisu EXPORT libshvConfig)
export(TARGETS libshvvisu NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake")
install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::)

0 comments on commit b487db6

Please sign in to comment.