Skip to content

An example project that illustrated adding wite to your project using CMake FetchContent

License

Notifications You must be signed in to change notification settings

kevinchannon/wite-cmake-example

Repository files navigation

Ubuntu | GCC12 | x64 | Debug
Ubuntu | GCC12 | x64 | Release
Windows | MSVC++ | x64 | Debug
Windows | MSVC++ | x64 | Release

wite-cmake-example

This is a very small project that demonstrates how to include Wite in your CMake project.

The work is all done in wite-cmake-example/CMakeLists.txt, this has some lines like this in it

include(FetchContent)

FetchContent_Declare(wite
	URL https://github.com/kevinchannon/wite/releases/download/<VERSION>/wite-src.zip
	DOWNLOAD_EXTRACT_TIMESTAMP true
)

FetchContent_MakeAvailable(wite)
  • The include(FetchContent) line tells CMake that you want to use the FetchContent module and makes it available for use in the subsequent commands
  • The FetchContent_Declare command uses FetchContent to pull the zip file from the stated URL and makes it available to use in your project as a project named "wite". This means that you will include the files from Wite in your code with a statement that begins #include <wite/...... The DOWNLOAD_EXTRACT_TIMESTAMP true part means that the timestamps on the downloaded files will be altered to the time that they were extracted and built for the first time on your machine, rather than maintaining the timestamps that they have from their original commits in Git. This helps prevent lots of things being re-built all the time when they haven't actually changed.
  • The FetchContent_MakeAvailable command actually brings the named content into the project for use by CMake, somehow.

The actual C++ code in the project barely uses Wite, since this project is just about demonstrating how to use CMake FetchContent to pull Wite into your project. For more examples of using Wite, see the examples in the main Wite repo.

About

An example project that illustrated adding wite to your project using CMake FetchContent

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published