Skip to content

Commit

Permalink
add libfido2Targets.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
akallabeth committed Jul 13, 2023
1 parent 91b2869 commit 461e986
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ if(BUILD_STATIC_LIBS)
set_target_properties(fido2 PROPERTIES OUTPUT_NAME fido2_static)
endif()
target_link_libraries(fido2 ${TARGET_LIBRARIES})
install(TARGETS fido2 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS fido2
EXPORT libfido2Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()

# dynamic library
Expand All @@ -143,9 +146,11 @@ if(BUILD_SHARED_LIBS)
VERSION ${FIDO_VERSION} SOVERSION ${FIDO_MAJOR})
target_link_libraries(fido2_shared ${TARGET_LIBRARIES})
install(TARGETS fido2_shared
EXPORT libfido2Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

install(FILES fido.h DESTINATION include)
Expand All @@ -158,6 +163,7 @@ if(NOT MSVC)
endif()

include(CMakePackageConfigHelpers)
export(PACKAGE libfido2)
configure_package_config_file(
libfido2Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libfido2Config.cmake
Expand All @@ -169,6 +175,7 @@ write_basic_package_version_file(
VERSION ${FIDO_VERSION}
COMPATIBILITY SameMajorVersion
)
install(EXPORT libfido2Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libfido2)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/libfido2Config.cmake
Expand Down
2 changes: 2 additions & 0 deletions src/libfido2Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ set_and_check(FIDO_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(FIDO_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")

check_required_components(libfido2)

include("${CMAKE_CURRENT_LIST_DIR}/libfido2Targets.cmake")

0 comments on commit 461e986

Please sign in to comment.