Crafter.Build/tests/PragmaSharedExternal/fixture/app/project.cpp
Jorijn van der Graaf 06ee1da796
test: a pragma dependency built on a shared CMake external loads
PragmaSharedExternal loads a project file whose #pragma crafter
dependency is a library built on a CMake external that makes a shared
library, and calls into that library while project.cpp loads.
LoadProject links project.so against what each pragma dependency's build
reports, and project.so loads only when that includes where the shared
library is. It passes as the tree stands, and holds project.so to
recording where a pragma dependency's shared CMake external is: without
that run path, LoadProject fails with "libsharedext.so: cannot open
shared object file".
2026-11-07 19:24:12 +01:00

19 lines
630 B
C++

// SPDX-License-Identifier: LGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
import std;
import Crafter.Build;
#pragma crafter dependency "../tool"
import Tool;
using namespace Crafter;
// ToolValue calls into the shared library the tool's CMake external builds,
// so this file's project.so loads only when it can find that library.
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view>) {
Configuration cfg;
cfg.path = "./";
cfg.name = std::format("value {}", ToolValue());
cfg.outputName = "app";
cfg.type = ConfigurationType::Executable;
return cfg;
}