mlc/CMakeLists.txt

49 lines
1.2 KiB
CMake
Raw Permalink Normal View History

cmake_minimum_required(VERSION 3.5)
2023-07-16 00:15:31 +00:00
project(
mlc
2023-10-11 20:09:54 +00:00
VERSION 1.3.211
2023-07-16 00:15:31 +00:00
DESCRIPTION "Media Library Compiler: rips your media library to a lossy compilation"
LANGUAGES CXX
)
cmake_policy(SET CMP0076 NEW)
cmake_policy(SET CMP0079 NEW)
2023-07-15 19:44:29 +00:00
2023-10-10 16:24:46 +00:00
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif ()
if (CMAKE_BUILD_TYPE STREQUAL "Release")
list(APPEND COMPILE_OPTIONS -O3)
elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND COMPILE_OPTIONS -g)
list(APPEND COMPILE_OPTIONS -Wall)
list(APPEND COMPILE_OPTIONS -Wextra)
endif()
message("Compilation options: " ${COMPILE_OPTIONS})
2023-07-16 00:15:31 +00:00
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
2023-07-15 19:44:29 +00:00
2023-07-25 23:39:56 +00:00
find_package(PkgConfig REQUIRED)
2023-07-16 00:15:31 +00:00
find_package(FLAC REQUIRED)
find_package(JPEG REQUIRED)
2023-07-16 00:15:31 +00:00
2023-07-25 23:39:56 +00:00
pkg_check_modules(LAME REQUIRED IMPORTED_TARGET lame)
pkg_check_modules(TAGLIB REQUIRED IMPORTED_TARGET taglib)
add_executable(mlc)
2023-10-10 16:24:46 +00:00
target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS})
add_subdirectory(src)
2023-07-16 00:15:31 +00:00
target_link_libraries(mlc
2023-07-25 23:39:56 +00:00
FLAC::FLAC
PkgConfig::LAME
JPEG::JPEG
2023-07-25 23:39:56 +00:00
PkgConfig::TAGLIB
2023-07-16 00:15:31 +00:00
)
2023-07-15 19:44:29 +00:00
install(TARGETS mlc RUNTIME DESTINATION bin)