mamba/libmamba/ext/solv-cpp/CMakeLists.txt

48 lines
1.4 KiB
CMake

# Copyright (c) 2024, QuantStack and Mamba Contributors
#
# Distributed under the terms of the BSD 3-Clause License.
#
# The full license is in the file LICENSE, distributed with this software.
cmake_minimum_required(VERSION 3.16)
add_library(
solv-cpp OBJECT
src/pool.cpp src/queue.cpp src/repo.cpp src/solvable.cpp src/solver.cpp src/transaction.cpp
)
target_include_directories(
solv-cpp
PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
find_package(tl-expected REQUIRED)
find_package(Libsolv REQUIRED)
if(BUILD_SHARED)
set(LIBSOLV_DEPS solv::libsolv solv::libsolvext)
else()
set(LIBSOLV_DEPS solv::libsolv_static solv::libsolvext_static)
endif()
target_link_libraries(solv-cpp PUBLIC tl::expected ${LIBSOLV_DEPS})
target_compile_features(solv-cpp PUBLIC cxx_std_17)
mamba_target_add_compile_warnings(solv-cpp WARNING_AS_ERROR ${MAMBA_WARNING_AS_ERROR})
mamba_target_set_lto(solv-cpp MODE ${MAMBA_LTO})
add_library(solv::cpp ALIAS solv-cpp)
if(BUILD_LIBMAMBA_TESTS)
add_subdirectory(tests)
endif()
# Object libraries are installed as an interface library (in libmambaTargets) but do not install any
# objects (.o files) or headers without the ``OBJECTS DESTINATION`` property.
install(
TARGETS solv-cpp
EXPORT ${PROJECT_NAME}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)