cmake_minimum_required(VERSION 3.28)

# define CXX interface library

    # define target & alias (for other projects consuming the "source-tree")
    add_library(iue-num_num INTERFACE)

    # define sources of target
    target_sources(iue-num_num
                    INTERFACE FILE_SET public_headers TYPE HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR} FILES numerics.hpp)

    # define installation step
    install(TARGETS iue-num_num EXPORT iue-num-export 
                                            FILE_SET public_headers DESTINATION "./")

    # define test

if(BUILD_TESTING AND PROJECT_IS_TOP_LEVEL)
    add_executable(iue-num_num.test numerics.test.cpp)
    target_link_libraries(iue-num_num.test iue-num_num)
    add_test(NAME iue-num_num.test COMMAND iue-num_num.test)
endif()

# export targets for consuming cmake projects

    # generate and install a .cmake file to allow dependend projects consuming the "install-tree" to import all targets
    install(EXPORT iue-num-export DESTINATION "iue-num" )

    # allow dependend projects consuming the "build-tree" to use all targets
    export(EXPORT iue-num-export)
