One last linker error

main
Simon Quigley 1 week ago
parent 8d90dededa
commit 2cf9637dc0

@ -1,16 +1,13 @@
cmake_minimum_required(VERSION 3.21) cmake_minimum_required(VERSION 3.21)
project(lubuntuci CXX) project(lubuntuci CXX)
# Set C++ standard
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
# Specify output directories
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Find required packages
find_package(yaml-cpp REQUIRED) find_package(yaml-cpp REQUIRED)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBGIT2 REQUIRED IMPORTED_TARGET libgit2) pkg_check_modules(LIBGIT2 REQUIRED IMPORTED_TARGET libgit2)
@ -19,48 +16,38 @@ find_package(ZLIB REQUIRED)
include_directories(/srv/lubuntu-ci/repos/ci-tools/include/launchpadlib-cpp) include_directories(/srv/lubuntu-ci/repos/ci-tools/include/launchpadlib-cpp)
# Create the shared library liblubuntuci.so
add_library(lubuntuci SHARED common.cpp utilities.cpp) add_library(lubuntuci SHARED common.cpp utilities.cpp)
target_include_directories(lubuntuci PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(lubuntuci PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(lubuntuci PUBLIC yaml-cpp::yaml-cpp PRIVATE CURL::libcurl /srv/lubuntu-ci/repos/ci-tools/lib/liblaunchpad.so) target_link_libraries(lubuntuci PUBLIC yaml-cpp::yaml-cpp PRIVATE CURL::libcurl /srv/lubuntu-ci/repos/ci-tools/lib/liblaunchpad.so)
# Ensure liblubuntuci has proper RPATH add_library(update_maintainer_lib STATIC update-maintainer.cpp)
set_target_properties(lubuntuci PROPERTIES target_include_directories(update_maintainer_lib PRIVATE /srv/lubuntu-ci/repos/ci-tools/include/launchpadlib-cpp)
BUILD_WITH_INSTALL_RPATH TRUE target_link_libraries(update_maintainer_lib PRIVATE lubuntuci yaml-cpp::yaml-cpp CURL::libcurl)
INSTALL_RPATH "$ORIGIN/lib"
)
# build-packages executable
add_executable(build-packages build-packages.cpp) add_executable(build-packages build-packages.cpp)
target_include_directories(build-packages PRIVATE /srv/lubuntu-ci/repos/ci-tools/include/launchpadlib-cpp) target_link_libraries(build-packages PRIVATE lubuntuci PkgConfig::LIBGIT2 update_maintainer_lib)
target_link_libraries(build-packages PRIVATE lubuntuci PkgConfig::LIBGIT2 yaml-cpp::yaml-cpp)
# fetch-indexes executable
add_executable(fetch-indexes fetch-indexes.cpp utilities.cpp) add_executable(fetch-indexes fetch-indexes.cpp utilities.cpp)
target_include_directories(fetch-indexes PRIVATE /srv/lubuntu-ci/repos/ci-tools/include/launchpadlib-cpp) target_include_directories(fetch-indexes PRIVATE /srv/lubuntu-ci/repos/ci-tools/include/launchpadlib-cpp)
target_link_libraries(fetch-indexes PRIVATE lubuntuci CURL::libcurl yaml-cpp::yaml-cpp ZLIB::ZLIB) target_link_libraries(fetch-indexes PRIVATE lubuntuci CURL::libcurl yaml-cpp::yaml-cpp ZLIB::ZLIB)
# update-maintainer executable
add_executable(update-maintainer update-maintainer.cpp) add_executable(update-maintainer update-maintainer.cpp)
target_include_directories(update-maintainer PRIVATE /srv/lubuntu-ci/repos/ci-tools/include/launchpadlib-cpp) target_link_libraries(update-maintainer PRIVATE update_maintainer_lib)
target_link_libraries(update-maintainer PRIVATE lubuntuci yaml-cpp::yaml-cpp CURL::libcurl)
# Ensure executables have proper RPATH set_target_properties(lubuntuci build-packages fetch-indexes update-maintainer PROPERTIES
set_target_properties(build-packages fetch-indexes update-maintainer PROPERTIES
BUILD_WITH_INSTALL_RPATH TRUE BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH "$ORIGIN/lib" INSTALL_RPATH "$ORIGIN/lib"
) )
# Install targets install(TARGETS lubuntuci update_maintainer_lib
install(TARGETS lubuntuci
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
) )
install(TARGETS build-packages fetch-indexes update-maintainer install(TARGETS build-packages fetch-indexes update-maintainer
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
) )
# Install headers
install(FILES common.h update-maintainer.h utilities.h install(FILES common.h update-maintainer.h utilities.h
DESTINATION include/lubuntuci DESTINATION include/lubuntuci
) )

Loading…
Cancel
Save