Skip to content

Commit

Permalink
add option BUILD_FAAD_CLI (#196)
Browse files Browse the repository at this point in the history
this allows to only build and install the library

Co-authored-by: Armin Novak <[email protected]>
  • Loading branch information
akallabeth and Armin Novak authored Dec 21, 2023
1 parent 3a57d89 commit 677918d
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,28 +245,34 @@ foreach(LIB faad faad_drm faad_fixed faad_drm_fixed)
endforeach()

# CLI

add_executable(faad_cli ${FAAD_SOURCES})
target_link_libraries(faad_cli faad)
target_compile_definitions(faad_cli PRIVATE ${FAAD_DEFINES})
target_compile_options(faad_cli PRIVATE ${FAAD_FLAGS})

if (MSVC)
target_include_directories(faad_cli PRIVATE
frontend
)
else()
set_target_properties(faad_cli PROPERTIES OUTPUT_NAME faad)
option(BUILD_FAAD_CLI "Build faad_cli executable" ON)
if (BUILD_FAAD_CLI)
add_executable(faad_cli ${FAAD_SOURCES})
target_link_libraries(faad_cli faad)
target_compile_definitions(faad_cli PRIVATE ${FAAD_DEFINES})
target_compile_options(faad_cli PRIVATE ${FAAD_FLAGS})

if (MSVC)
target_include_directories(faad_cli PRIVATE
frontend
)
else()
set_target_properties(faad_cli PROPERTIES OUTPUT_NAME faad)
endif()
endif()

# Installation

if(NOT FAAD_BUNDLED_MODE AND NOT MSVC)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/faad2.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

set(INSTALL_TARGETS faad faad_drm)
if (BUILD_FAAD_CLI)
list(APPEND INSTALL_TARGETS faad_cli)
endif()

install(
TARGETS faad faad_cli faad_drm
TARGETS ${INSTALL_TARGETS}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
Expand Down

0 comments on commit 677918d

Please sign in to comment.