hello-cpp: init

Proposal: a trivial hello-cpp to complement gnu hello, testing C++ and
cmake infrastructure.

This is intended to assist with testing exotic stdenvs such as the one
used in pkgsLLVM, requiring no additional dependencies to get a quick
test that the compiler and cmake are working as intended as a basic
level.

There does already exist tests.cc-wrapper, but this does not produce any
outputs, and sometimes it is useful to have a quick test that something
builds. It's also useful to be able to inspect the outputs to look at
references and so forth.

Signed-off-by: Peter Waller <p@pwaller.net>

+30
+18
pkgs/by-name/he/hello-cpp/package.nix
··· 1 + { 2 + cmake, 3 + lib, 4 + ninja, 5 + stdenv, 6 + }: 7 + 8 + stdenv.mkDerivation { 9 + name = "hello-cpp"; 10 + src = ./src; 11 + nativeBuildInputs = [ cmake ninja ]; 12 + meta = { 13 + description = "Basic sanity check that C++ and cmake infrastructure are working"; 14 + platforms = lib.platforms.all; 15 + maintainers = stdenv.meta.maintainers or []; 16 + mainProgram = "hello-cpp"; 17 + }; 18 + }
+6
pkgs/by-name/he/hello-cpp/src/CMakeLists.txt
··· 1 + cmake_minimum_required(VERSION 3.10) 2 + project(hello-cpp) 3 + 4 + add_executable(hello-cpp main.cpp) 5 + 6 + install(TARGETS hello-cpp)
+6
pkgs/by-name/he/hello-cpp/src/main.cpp
··· 1 + #include <iostream> 2 + 3 + int main(int argc, char *argv[]) { 4 + std::cout << "Hello, C++\n"; 5 + return 0; 6 + }