Skip to content

Instantly share code, notes, and snippets.

@scivision
Last active May 5, 2023 19:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save scivision/245a1f32498d15a87a507051857327d9 to your computer and use it in GitHub Desktop.
Use fortran-filesystem via CMake FetchContent
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)
#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