Skip to content

Instantly share code, notes, and snippets.

@jiverson002
Last active November 27, 2020 17:40
Show Gist options
  • Save jiverson002/811ab74579a43076e4058a90957339cb to your computer and use it in GitHub Desktop.
Save jiverson002/811ab74579a43076e4058a90957339cb to your computer and use it in GitHub Desktop.
An example project using GKlib via the CMake FetchContent module.
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Build files
build
cmake_minimum_required(VERSION 3.14)
project(GKlib-FetchContent C)
include(FetchContent)
FetchContent_Declare(
GKlib
GIT_REPOSITORY https://github.com/jiverson002/GKlib.git
GIT_TAG feature/modern-cmake-pr
)
FetchContent_MakeAvailable(GKlib)
# FetchContent_MakeAvailable() was introduced in CMake 3.14, if prior versions
# should be supported, then the following should be used instead:
#
# FetchContent_GetProperties(GKlib)
# if(NOT GKlib_POPULATED)
# FetchContent_Populate(GKlib)
# add_subdirectory(${GKlib_SOURCE_DIR} ${GKlib_BINARY_DIR})
# endif()
add_executable(example example.c)
target_link_libraries(example GKlib::GKlib)
#include "GKlib.h"
int main() { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment