Improve CMakeLists.txt
This commit is contained in:
parent
5c2c336a21
commit
e43a142686
1 changed files with 30 additions and 21 deletions
|
@ -14,11 +14,12 @@ set(CXX_EXTENSIONS NO)
|
|||
set(BOOST_INCLUDE_LIBRARIES "pfr;asio;serialization")
|
||||
option(CPM_USE_LOCAL_PACKAGES "Use local packages" ON)
|
||||
option(UTEMPL_USE_LOCAL_PACKAGE "Use utempl local package" OFF)
|
||||
option(BUILD_EXECUTABLE ON)
|
||||
set(UTEMPL_URL
|
||||
"https://helicopter.myftp.org/git/sha512sum/utempl"
|
||||
CACHE STRING "utempl repository URL")
|
||||
|
||||
file(GLOB_RECURSE LIB_SOURCES "library/src/*.cpp")
|
||||
file(GLOB_RECURSE LIB_SOURCES "library/*.*pp")
|
||||
file(GLOB_RECURSE SOURCES "src/*.cpp")
|
||||
|
||||
|
||||
|
@ -76,26 +77,18 @@ include(GNUInstallDirs)
|
|||
|
||||
|
||||
|
||||
add_library(larra_xmpp)
|
||||
add_library(larra_xmpp ${LIB_SOURCES})
|
||||
|
||||
add_library(larra::larra_xmpp ALIAS larra_xmpp)
|
||||
|
||||
target_compile_features(larra_xmpp PUBLIC cxx_std_23)
|
||||
|
||||
target_sources(larra_xmpp PRIVATE ${LIB_SOURCES})
|
||||
|
||||
target_include_directories(larra_xmpp PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/library/include>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
|
||||
|
||||
|
||||
install(TARGETS larra_xmpp
|
||||
EXPORT larraXMPPTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
FILE_SET larraXMPPSet DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
@ -111,6 +104,9 @@ else()
|
|||
endif()
|
||||
|
||||
|
||||
|
||||
if(BUILD_EXECUTABLE)
|
||||
|
||||
add_executable(larra)
|
||||
|
||||
target_compile_features(larra INTERFACE cxx_std_23)
|
||||
|
@ -118,16 +114,29 @@ target_compile_features(larra INTERFACE cxx_std_23)
|
|||
target_link_libraries(larra larra_xmpp ${GTKMM_LIBRARIES} ${GTKMM_LIBRARIES})
|
||||
|
||||
target_include_directories(larra PRIVATE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
|
||||
|
||||
target_sources(larra PRIVATE ${SOURCES})
|
||||
|
||||
|
||||
|
||||
install(TARGETS larra
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
install(TARGETS larra_xmpp
|
||||
EXPORT larraXMPPTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
FILE_SET larraXMPPSet DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/library/include/larra"
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING PATTERN "*.hpp")
|
||||
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
@ -139,18 +148,18 @@ configure_package_config_file(
|
|||
"${PROJECT_SOURCE_DIR}/cmake/larraXMPPConfig.cmake.in"
|
||||
"${PROJECT_BINARY_DIR}/larraXMPPConfig.cmake"
|
||||
INSTALL_DESTINATION
|
||||
${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake)
|
||||
${CMAKE_INSTALL_DATAROOTDIR}/larra/cmake)
|
||||
|
||||
|
||||
|
||||
install(EXPORT larraXMPPTargets
|
||||
FILE xmppClientLibTargets.cmake
|
||||
NAMESPACE larra::
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake)
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/larra/cmake)
|
||||
|
||||
install(FILES "${PROJECT_BINARY_DIR}/larraXMPPConfig.cmake"
|
||||
install(FILES "${PROJECT_BINARY_DIR}/larraXMPPConfig.cmake"
|
||||
"${PROJECT_BINARY_DIR}/larraXMPPVersionConfig.cmake"
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake)
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/larra/cmake)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue