Skip to content

Commit

Permalink
Prepare Library for CMake FetchContent (#217)
Browse files Browse the repository at this point in the history
* Test for Cmake FetchContent
* Added generalized name for Interface

---------

Co-authored-by: FlorianXXIV <mail@florianxxiv.dev>
Co-authored-by: BoB <bobluppes@gmail.com>
  • Loading branch information
3 people authored Jun 18, 2024
1 parent c096baf commit d1a7873
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
build/
cmake-modules/
venv
cmake-build-debug

# IDE
.vscode/
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ project(Graaf
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# The target name of the Library, what name you give to the Interface
set(GRAAF_LIB_TARGET_NAME ${PROJECT_NAME})

# Example usages of the library
option(SKIP_EXAMPLES "Skip building the examples" OFF)
if(NOT SKIP_EXAMPLES)
Expand All @@ -29,3 +32,8 @@ if(NOT SKIP_BENCHMARKS)
add_subdirectory(perf)
endif()

#Adding Interface to enable use of FetchContent
add_library(${GRAAF_LIB_TARGET_NAME} INTERFACE)
add_library(${PROJECT_NAME}::${GRAAF_LIB_TARGET_NAME} ALIAS ${PROJECT_NAME})

target_include_directories(${GRAAF_LIB_TARGET_NAME} INTERFACE "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/include/")

0 comments on commit d1a7873

Please sign in to comment.