Last active
May 5, 2023 19:15
Star
You must be signed in to star a gist
Use fortran-filesystem via CMake FetchContent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.14...3.26) | |
project(EPretryDownload LANGUAGES C CXX) | |
include(FetchContent) | |
set(url https://github.com/scivision/fortran-filesystem) | |
set(tag v4.4.0) | |
# these variables are intended for the FetchContent project, which ignores | |
# CMAKE_ARGS and CMAKE_CACHE_ARGS | |
set(fortran off) | |
set(BUILD_SHARED_LIBS off) | |
FetchContent_Declare(fs | |
GIT_REPOSITORY ${url} | |
GIT_TAG ${tag} | |
GIT_SHALLOW true | |
INACTIVITY_TIMEOUT 60 | |
TLS_VERIFY true | |
FIND_PACKAGE_ARGS | |
) | |
FetchContent_MakeAvailable(fs) | |
add_executable(main main.cpp) | |
target_link_libraries(main PRIVATE ffilesystem::filesystem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdlib> | |
#include "ffilesystem.h" | |
int main() | |
{ | |
char p[MAXP]; | |
fs_get_cwd(p, MAXP); | |
std::cout << "current working dir: " << p << std::endl; | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment