Skip to content

Commit

Permalink
Add config target generation and installation
Browse files Browse the repository at this point in the history
This enables simpler linking and header file inclusion in
application that uses this package.
  • Loading branch information
nyue committed Nov 22, 2020
1 parent d129a14 commit 3130108
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,29 @@ if(UNIX)
)
endif(UNIX)

install(TARGETS ${PROJECT_NAME} DESTINATION lib)
install(FILES ${root_hdrs} DESTINATION include)
install(FILES ${dspatch_hdrs} DESTINATION include/dspatch)
install(FILES ${dspatch_dbg} DESTINATION lib)
install(TARGETS
${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Config
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
export(TARGETS ${PROJECT_NAME}
NAMESPACE ${PROJECT_NAME}::
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
)
install(EXPORT
${PROJECT_NAME}Config
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/${PROJECT_NAME}"
NAMESPACE ${PROJECT_NAME}::
)
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

add_subdirectory(docs)
add_subdirectory(tests)
Expand Down

0 comments on commit 3130108

Please sign in to comment.