Allow using library as a local dependency
Hey, thanks for this great library!
I've had some trouble integrating it into a larger project, as the install package was disabled and the -WError flag set in the original CMakeLists prevented me from building it due to an unused function.
This PR cleans up the CMakeLists and isolates the tests and warnings from the main project. Additionally, it uses PackageProject.cmake to create a proper installable target without much boilerplate. Tests now run in GitHub workflows (Unix, Mac and Windows) and the install itself is tested as well. To build and run the tests, you can now use the tests subdirectory directly.
cmake -Stest -Bbuild
cmake --build build
cmake --build build --target test
The changes now allow easy integration into external projects. E.g. you can now easily use my fork of CrossGuid through the CPM.cmake package manager:
CPMaddPackage(
NAME CrossGuid
GITHUB_REPOSITORY TheLartians/crossguid
VERSION 0.3.0-pre-release
GIT_TAG 0b3850edc49ecb7641ba4daace09399dd60813b5
)
target_link_libraries(myLibrary PRIVATE CrossGuid::CrossGuid)
Let me know if these changes are interesting for you, then I could also update the Readme and add additional tests for iOS and Android.
Fixes #48
This is a great PR @graeme-hill, are you planning to merge it?