Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
Add 'tinydir' package
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslo committed Jul 20, 2016
1 parent 46d20c4 commit caddb9a
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/configs/default.cmake
Expand Up @@ -143,6 +143,7 @@ hunter_config(sparsehash VERSION 2.0.2)
hunter_config(spdlog VERSION 1.0.0-p0)
hunter_config(szip VERSION 2.1.0-p1)
hunter_config(thread-pool-cpp VERSION 1.0.0-p1)
hunter_config(tinydir VERSION 1.2-p0)
hunter_config(websocketpp VERSION 0.7.0-p2)
hunter_config(wxWidgets VERSION 3.0.2)
hunter_config(x11 VERSION 1.5.0)
Expand Down
24 changes: 24 additions & 0 deletions cmake/projects/tinydir/hunter.cmake
@@ -0,0 +1,24 @@
# Copyright (c) 2016, Ruslan Baratov
# All rights reserved.

# !!! DO NOT PLACE HEADER GUARDS HERE !!!

include(hunter_add_version)
include(hunter_cacheable)
include(hunter_download)
include(hunter_pick_scheme)

hunter_add_version(
PACKAGE_NAME
tinydir
VERSION
1.2-p0
URL
"https://github.com/hunter-packages/tinydir/archive/v1.2-p0.tar.gz"
SHA1
365d9bed871bdd44194907b247a15b7da227f203
)

hunter_pick_scheme(DEFAULT url_sha1_cmake)
hunter_cacheable(tinydir)
hunter_download(PACKAGE_NAME tinydir)
19 changes: 19 additions & 0 deletions examples/tinydir/CMakeLists.txt
@@ -0,0 +1,19 @@
# Copyright (c) 2016, Ruslan Baratov
# All rights reserved.

cmake_minimum_required(VERSION 3.0)

# Emulate HunterGate:
# * https://github.com/hunter-packages/gate
include("../common.cmake")

project(download-tinydir)

# download tinydir
hunter_add_package(tinydir)

# now tinydir can be used
find_package(tinydir CONFIG REQUIRED)

add_executable(foo foo.cpp)
target_link_libraries(foo tinydir::tinydir)
21 changes: 21 additions & 0 deletions examples/tinydir/foo.cpp
@@ -0,0 +1,21 @@
#include <stdio.h>
#include <tinydir.h>

int main(int argc, char *argv[])
{
tinydir_file file;
if (argc != 2)
{
fprintf(stderr, "Usage: test filename\n");
return 1;
}
if (tinydir_file_open(&file, argv[1]) == -1)
{
perror("Error opening file");
return 1;
}
printf("Path: %s\nName: %s\nExtension: %s\nIs dir? %s\nIs regular file? %s\n",
file.path, file.name, file.extension,
file.is_dir?"yes":"no", file.is_reg?"yes":"no");
return 0;
}

0 comments on commit caddb9a

Please sign in to comment.