Skip to content

Commit

Permalink
readme: Update
Browse files Browse the repository at this point in the history
Do not demonstrate the CMake's deprecated use of FetchContent_Populate().
  • Loading branch information
Tectu committed Oct 22, 2024
1 parent 810a4a4 commit 42f2d69
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ This library can be integrated easily into other cmake projects. There are two m
```cmake
include(FetchContent)
# Set QSchematic CMake options
set(QSCHEMATIC_BUILD_DEMO OFF CACHE INTERNAL "")
set(QSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD OFF CACHE INTERNAL "")
set(QSCHEMATIC_DEPENDENCY_GPDS_TARGET "gpds-shared" CACHE INTERNAL "")
# Fetch QSchematic
FetchContent_Declare(
qschematic
Expand All @@ -99,28 +104,10 @@ FetchContent_MakeAvailable(qschematic)
target_link_libraries(
my_app
PRIVATE
qschematic-static
qschematic::qschematic-static
)
```
Note that any serious consumer might want to specify an actual git tag or a commit hash via `GIT_TAG` rather than a branch name.
To change options & variables, the call to `FetchContent_MakeAvailable()` shown above can be replaced with:
```cmake
FetchContent_Declare(
qschematic
GIT_REPOSITORY https://github.com/simulton/qschematic
GIT_TAG master
)
FetchContent_GetProperties(qschematic)
if(NOT qschematic_POPULATED)
FetchContent_Populate(qschematic)
set(QSCHEMATIC_BUILD_DEMO OFF CACHE INTERNAL "")
set(QSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD OFF CACHE INTERNAL "")
set(QSCHEMATIC_DEPENDENCY_GPDS_TARGET "gpds-shared" CACHE INTERNAL "")
add_subdirectory(${qschematic_SOURCE_DIR} ${qschematic_BINARY_DIR})
endif()
```

#### find_package()
The QSchematic static & shared library cmake targets are exported which allows for easy integration into a client application/library.
Expand Down

0 comments on commit 42f2d69

Please sign in to comment.