Skip to content

Commit

Permalink
Generate pkg-config files under CMake
Browse files Browse the repository at this point in the history
configure_pkg_config_file helper function copied from the ogg
repository.
  • Loading branch information
daddesio committed Jul 6, 2022
1 parent 5eb65b1 commit 02c4818
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ target_compile_definitions(opusfile
$<$<BOOL:${OP_ENABLE_ASSERTIONS}>:OP_ENABLE_ASSERTIONS>
$<$<BOOL:${OP_HAVE_LRINTF}>:OP_HAVE_LRINTF>
)

# Helper function to configure pkg-config files
function(configure_pkg_config_file pkg_config_file_in)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_FULL_BINDIR})
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
set(VERSION ${PROJECT_VERSION})
string(REPLACE ".in" "" pkg_config_file ${pkg_config_file_in})
configure_file(${pkg_config_file_in} ${pkg_config_file} @ONLY)
endfunction()

configure_pkg_config_file(opusfile.pc.in)
configure_pkg_config_file(opusurl.pc.in)

install(TARGETS opusfile
EXPORT OpusFileTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
Expand All @@ -92,6 +107,10 @@ install(TARGETS opusfile
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/opus"
)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/opusfile.pc ${CMAKE_CURRENT_BINARY_DIR}/opusurl.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)

if(NOT OP_DISABLE_HTTP)
find_package(OpenSSL REQUIRED)

Expand Down

0 comments on commit 02c4818

Please sign in to comment.