Skip to content

Commit

Permalink
Fix CMake install() for proper find_package()/add_subdirectory() support
Browse files Browse the repository at this point in the history
  • Loading branch information
leha-bot authored and gamecreature committed Oct 11, 2023
1 parent 9111156 commit 45e3e70
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,35 @@ add_library(QtAwesome
QtAwesome/QtAwesomeFree.qrc
)

include(GNUInstallDirs)

target_include_directories(QtAwesome
INTERFACE ${PROJECT_SOURCE_DIR}/QtAwesome
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/QtAwesome>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

target_link_libraries(QtAwesome PUBLIC
Qt${QT_VERSION_MAJOR}::Widgets
)

install(TARGETS QtAwesome
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
install(TARGETS QtAwesome EXPORT QtAwesomeConfig
RUNTIME DESTINATION ${CMAKE_INSTALL_BINARYDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

install(EXPORT QtAwesomeConfig
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/QtAwesome/
NAMESPACE QtAwesome::
)
export(EXPORT QtAwesomeConfig NAMESPACE QtAwesome::)

install(FILES
QtAwesome/QtAwesome.h
QtAwesome/QtAwesomeAnim.h
QtAwesome/QtAwesomeEnumGenerated.h
QtAwesome/QtAwesomeStringGenerated.h
DESTINATION include
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/QtAwesome
)

0 comments on commit 45e3e70

Please sign in to comment.