about summary refs log tree commit diff
path: root/pkgs/development/libraries/aws-sdk-cpp
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2023-11-13 18:42:59 +0200
committerArtturin <Artturin@artturin.com>2023-12-02 01:15:16 +0200
commitde9a34d3f1d00d5b6416a09f8aefb73dcb3b5f9c (patch)
tree3fece59e9f32224b60c0d7606c90687cb7c41036 /pkgs/development/libraries/aws-sdk-cpp
parent2cb609096de83e07c5eb6f5075105b11119afe6d (diff)
aws-sdk-cpp: add 'tests.cmake-find-package'
tests for 'aws-sdk-cpp does not work with cmake's find_package() issue 70075'
Diffstat (limited to 'pkgs/development/libraries/aws-sdk-cpp')
-rw-r--r--pkgs/development/libraries/aws-sdk-cpp/default.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/pkgs/development/libraries/aws-sdk-cpp/default.nix b/pkgs/development/libraries/aws-sdk-cpp/default.nix
index 45e1597143a76..a22cd04b5efd5 100644
--- a/pkgs/development/libraries/aws-sdk-cpp/default.nix
+++ b/pkgs/development/libraries/aws-sdk-cpp/default.nix
@@ -10,6 +10,7 @@
 , AudioToolbox
 , nix
 , arrow-cpp
+, aws-sdk-cpp
 , # Allow building a limited set of APIs, e.g. ["s3" "ec2"].
   apis ? ["*"]
 , # Whether to enable AWS' custom memory management.
@@ -110,6 +111,36 @@ stdenv.mkDerivation rec {
   passthru = {
     tests = {
       inherit nix arrow-cpp;
+      cmake-find-package = stdenv.mkDerivation {
+        pname = "aws-sdk-cpp-cmake-find-package-test";
+        version = "0";
+        dontUnpack = true;
+        nativeBuildInputs = [ cmake ];
+        buildInputs = [ aws-sdk-cpp ];
+        buildCommand = ''
+          cat > CMakeLists.txt <<'EOF'
+          find_package(AWSSDK)
+          EOF
+
+          # Intentionally not using 'cmakeConfigurePhase' to test that find_package works without it.
+          mkdir build && cd build
+          if output=$(cmake -Wno-dev .. 2>&1); then
+            if grep -Fw -- "Found AWS" - <<< "$output"; then
+              touch "$out"
+            else
+              echo "'Found AWS' not found in the cmake output!" >&2
+              echo "The output was:" >&2
+              echo "$output" >&2
+              exit 1
+            fi
+          else
+            echo -n "'cmake -Wno-dev ..'" >&2
+            echo " returned a non-zero exit code." >&2
+            echo "$output" >&2
+            exit 1
+          fi
+        '';
+      };
     };
   };