#[[
Copyright (c) 2025-2026 The Johns Hopkins University Applied Physics
Laboratory LLC.

This file is part of the Bundle Protocol Security Library (BSL).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

This work was performed for the Jet Propulsion Laboratory, California
Institute of Technology, sponsored by the United States Government under
the prime contract 80NM0018D0004 between the Caltech and NASA under
subcontract 1700763.
]]
cmake_minimum_required(VERSION 3.23)

project(lib-user-test VERSION 0.0.0 LANGUAGES C)

set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)

set(PKG_CONFIG_ARGN "--define-prefix")
find_package(PkgConfig REQUIRED)
include(CMakePrintHelpers)


find_package(bsl CONFIG REQUIRED)
message(STATUS "Found BSL ${bsl_VERSION}")

pkg_search_module(MLIB m-lib REQUIRED IMPORTED_TARGET)
add_library(MLIB::mlib ALIAS PkgConfig::MLIB)
message(STATUS "Found M*LIB ${MLIB_VERSION}")

find_package(qcbor REQUIRED)
message(STATUS "Found QCBOR ${qcbor_VERSION}")

cmake_print_properties(
  TARGETS bsl::bsl_front MLIB::mlib qcbor::qcbor
  PROPERTIES LOCATION INTERFACE_INCLUDE_DIRECTORIES
)

add_executable(example)
target_sources(example PRIVATE main.c)
target_compile_definitions(example PRIVATE _POSIX_C_SOURCE=200809L)
target_link_libraries(example PRIVATE bsl::bsl_sample_pp bsl::bsl_dynamic)
