distributable:
  url: https://github.com/google/glog/archive/refs/tags/v{{version}}.tar.gz
  strip-components: 1

versions:
  github: google/glog/tags
  strip: /^v/

dependencies:
  gflags.github.io: '*'

build:
  dependencies:
    cmake.org: '*'
  script: |
    cmake -S . -B build -G "Unix Makefiles" $ARGS
    cmake --build build
    cmake --build build --target install
  env:
    ARGS:
      - -DCMAKE_INSTALL_PREFIX={{prefix}}
      - -DBUILD_SHARED_LIBS=ON
      - -DCMAKE_CXX_FLAGS=-std=c++14

test:
  dependencies:
    cmake.org: '*'
    linux:
      gnu.org/make: '*'
      llvm.org: '*'
  script:
    - run: cat $FIXTURE >main.cpp
      fixture: |
        #include <glog/logging.h>
        #include <iostream>
        #include <memory>
        int main(int argc, char* argv[])
        {
          google::InitGoogleLogging(argv[0]);
          LOG(INFO) << "test";
        }
    - run: cat $FIXTURE >CMakeLists.txt
      fixture: |
        cmake_minimum_required (VERSION 3.16)
        project (myproj VERSION 1.0)
        find_package (glog 0.6.0 REQUIRED)
        add_executable (myapp main.cpp)
        target_link_libraries (myapp glog::glog)
    - cmake -S . -B build
    - cmake --build build
    - ./build/myapp
