Skip to content

Commit 9b507ed

Browse files
authored
CMake: optionally install pkgconfig (#639)
If HIDAPI_INSTALL_TARGETS is set to off, pkgconfig is still installed. This a problem when statically linking against hidapi and then using CMake's install-feature.
1 parent eea8cac commit 9b507ed

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ function(hidapi_configure_pc PC_IN_FILE)
6868
get_filename_component(PC_IN_FILENAME "${PC_IN_FILE}" NAME_WE)
6969
set(PC_FILE "${CMAKE_CURRENT_BINARY_DIR}/pc/${PC_IN_FILENAME}.pc")
7070
configure_file("${PC_IN_FILE}" "${PC_FILE}" @ONLY)
71-
72-
install(FILES "${PC_FILE}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
71+
if(HIDAPI_INSTALL_TARGETS)
72+
install(FILES "${PC_FILE}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/")
73+
endif()
7374
endfunction()
7475

7576
# The library

0 commit comments

Comments
 (0)