gamecreature / QtAwesome

QtAwesome - Font Awesome for Qt Applications
Other
773 stars 147 forks source link

Fix CMake install() for proper find_package()/add_subdirectory() support #58

Closed leha-bot closed 11 months ago

leha-bot commented 11 months ago

This PR fixes the CMake's install() logic for allowing usage of find_package() and add_subdirectory() for importing library.

Now library can be installed with CMake export config via cmake --install <build-dir-with-QtAwesome> --prefix <install-prefix> (or old good cmake --build install, but it requires CMAKE_INSTALL_PREFIX to exist in CMakeCache). After installation the library user now is able to use library in their project with this CMake code snippet:

...
find_package(QtAwesome REQUIRED)
add_executable(MyApp app.cpp)
...
target_link_libraries(MyApp Qt::Widgets Qt::Gui QtAwesome::QtAwesome)

or, for git-modules:

add_subdirectory("<relative-path-for-QtAwesome-git-submodule">)

which may be more convenient for some use-cases (it also works with another helpers like CMake's fetch_content()/ExternalProject_***).

gamecreature commented 11 months ago

Thanks you very much for your contribution!!