# CMakeLists.txt cmake_minimum_required(VERSION 3.10) project(launchpadlib-cpp VERSION 0.0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(nlohmann_json REQUIRED) find_package(OpenSSL REQUIRED) find_package(CURL REQUIRED) find_package(PkgConfig REQUIRED) pkg_check_modules(LIBSECRET REQUIRED libsecret-1) add_library(launchpad SHARED src/launchpad.cpp src/archive.cpp src/archive_permission.cpp src/utils.cpp src/person.cpp src/distribution.cpp src/authentication.cpp src/source_package_publishing_history.cpp src/build.cpp ) target_include_directories(launchpad PUBLIC ${LIBSECRET_INCLUDE_DIRS} ) target_compile_definitions(launchpad PRIVATE BUILDING_LAUNCHPAD) set_target_properties(launchpad PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 0 PUBLIC_HEADER "src/launchpad.h;src/callablewrapper.h;src/archive.h;src/archive_permission.h;src/utils.h;src/person.h;src/distribution.h;src/authentication.h;src/source_package_publishing_history.h;src/build.h" CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN YES ) # Install the library and its headers install(TARGETS launchpad EXPORT launchpadTargets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin PUBLIC_HEADER DESTINATION include/launchpadlib-cpp ) # Export the targets to a script install(EXPORT launchpadTargets FILE launchpadTargets.cmake NAMESPACE launchpad:: DESTINATION lib/cmake/launchpadlib-cpp ) # Configure the CMake package configuration file include(CMakePackageConfigHelpers) configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/launchpadConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/launchpadConfig.cmake" INSTALL_DESTINATION lib/cmake/launchpadlib-cpp NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO ) # Generate a version file for the package write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/launchpadConfigVersion.cmake" VERSION ${PROJECT_VERSION} COMPATIBILITY AnyNewerVersion ) # Install the CMake package configuration files install(FILES "${CMAKE_CURRENT_BINARY_DIR}/launchpadConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/launchpadConfigVersion.cmake" DESTINATION lib/cmake/launchpadlib-cpp ) # Link necessary libraries target_link_libraries(launchpad PRIVATE nlohmann_json::nlohmann_json OpenSSL::Crypto CURL::libcurl ${LIBSECRET_LIBRARIES} )