Commit adf966bc authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use more target-centric cmake code

GIT_SILENT
parent 95d4cfa1
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.16)
project(audiocd VERSION "5.0.0")
set(QT_MIN_VERSION "5.12.0")
set(KF_MIN_VERSION "5.68.0")
set(QT_MIN_VERSION "5.15.0")
set(KF_MIN_VERSION "5.80.0")
find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
......@@ -11,6 +11,7 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMSetupVersion)
include(ECMQtDeclareLoggingCategory)
include(CMakePushCheckState)
......@@ -76,9 +77,9 @@ configure_file(config-audiocd.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-audiocd.h)
#############################
add_definitions(
-DQT_DISABLE_DEPRECATED_BEFORE=0x050C00
-DQT_DISABLE_DEPRECATED_BEFORE=0x050F00
-DQT_DEPRECATED_WARNINGS_SINCE=0x060000
-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054400
-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055000
-DKF_DEPRECATED_WARNINGS_SINCE=0x060000
-DQT_NO_FOREACH
-DQT_NO_KEYWORDS
......@@ -90,20 +91,18 @@ add_definitions(
-DQT_USE_QSTRINGBUILDER
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
)
include_directories(
${CDPARANOIA_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
add_subdirectory(plugins)
add_subdirectory(kcmaudiocd)
add_subdirectory(data)
add_subdirectory(doc)
set(kio_audiocd_PART_SRCS audiocd.cpp )
add_library(kio_audiocd MODULE)
target_sources(kio_audiocd PRIVATE
audiocd.cpp
)
ecm_qt_declare_logging_category(kio_audiocd_PART_SRCS
ecm_qt_declare_logging_category(kio_audiocd
HEADER audiocd_kio_debug.h
IDENTIFIER AUDIOCD_KIO_LOG
CATEGORY_NAME kf.kio.slaves.audiocd
......@@ -113,15 +112,14 @@ ecm_qt_declare_logging_category(kio_audiocd_PART_SRCS
EXPORT AUDIOCD
)
add_library(kio_audiocd MODULE ${kio_audiocd_PART_SRCS})
set_target_properties(kio_audiocd PROPERTIES OUTPUT_NAME "audiocd")
target_link_libraries(kio_audiocd
${CDPARANOIA_LIBRARIES}
Qt5::Widgets
target_link_libraries(kio_audiocd
audiocdplugins
KF5::CompactDisc
KF5::I18n
audiocdplugins
Qt5::Widgets
Cdparanoia::Cdparanoia
)
install(TARGETS kio_audiocd DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio)
......
......@@ -12,25 +12,32 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (CDPARANOIA_INCLUDE_DIR AND CDPARANOIA_LIBRARIES)
# in cache already
SET(CDPARANOIA_FOUND TRUE)
find_path(CDPARANOIA_INCLUDE_DIR cdda_interface.h PATH_SUFFIXES cdda cdparanoia)
else (CDPARANOIA_INCLUDE_DIR AND CDPARANOIA_LIBRARIES)
find_library(CDPARANOIA_LIBRARY NAMES cdda_paranoia)
find_library(CDPARANOIA_IF_LIBRARY NAMES cdda_interface)
FIND_PATH(CDPARANOIA_INCLUDE_DIR cdda_interface.h PATH_SUFFIXES cdda cdparanoia)
FIND_LIBRARY(CDPARANOIA_LIBRARY NAMES cdda_paranoia)
FIND_LIBRARY(CDPARANOIA_IF_LIBRARY NAMES cdda_interface)
IF (CDPARANOIA_LIBRARY AND CDPARANOIA_IF_LIBRARY)
if (CDPARANOIA_LIBRARY AND CDPARANOIA_IF_LIBRARY)
SET(CDPARANOIA_LIBRARIES ${CDPARANOIA_LIBRARY} ${CDPARANOIA_IF_LIBRARY} "-lm")
ENDIF (CDPARANOIA_LIBRARY AND CDPARANOIA_IF_LIBRARY)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cdparanoia DEFAULT_MSG
CDPARANOIA_LIBRARIES CDPARANOIA_INCLUDE_DIR)
MARK_AS_ADVANCED(CDPARANOIA_INCLUDE_DIR CDPARANOIA_LIBRARY CDPARANOIA_IF_LIBRARY)
endif (CDPARANOIA_INCLUDE_DIR AND CDPARANOIA_LIBRARIES)
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Cdparanoia
DEFAULT_MSG
CDPARANOIA_LIBRARIES CDPARANOIA_INCLUDE_DIR
)
mark_as_advanced(
CDPARANOIA_INCLUDE_DIR
CDPARANOIA_LIBRARY
CDPARANOIA_IF_LIBRARY
)
if(CDPARANOIA_FOUND AND NOT TARGET Cdparanoia::Cdparanoia)
add_library(Cdparanoia::Cdparanoia UNKNOWN IMPORTED)
set_target_properties(Cdparanoia::Cdparanoia PROPERTIES
IMPORTED_LOCATION "${CDPARANOIA_LIBRARY}"
INTERFACE_LINK_LIBRARIES "${CDPARANOIA_IF_LIBRARY};-lm"
INTERFACE_INCLUDE_DIRECTORIES "${CDPARANOIA_INCLUDE_DIR}"
)
endif()
......@@ -8,7 +8,7 @@
if(FLAC_INCLUDE_DIR)
# Already in cache, be silent
set(FLAC_FIND_QUIETLY TRUE)
endif(FLAC_INCLUDE_DIR)
endif()
find_path(FLAC_INCLUDE_DIR FLAC/stream_decoder.h)
......@@ -20,16 +20,38 @@ find_library(OGG_LIBRARY NAMES ogg ogg_static libogg libogg_static)
# Handle the QUIETLY and REQUIRED arguments and set FLAC_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FLAC DEFAULT_MSG
FLAC_INCLUDE_DIR OGG_LIBRARY FLAC_LIBRARY)
find_package_handle_standard_args(FLAC
DEFAULT_MSG
FLAC_INCLUDE_DIR OGG_LIBRARY FLAC_LIBRARY
)
if(FLAC_FOUND)
set(FLAC_LIBRARIES ${FLAC_LIBRARY} ${OGG_LIBRARY})
if(WIN32)
set(FLAC_LIBRARIES ${FLAC_LIBRARIES} wsock32)
endif(WIN32)
else(FLAC_FOUND)
set(FLAC_LIBRARIES)
endif(FLAC_FOUND)
set(FLAC_LIBRARIES ${FLAC_LIBRARY} ${OGG_LIBRARY})
if(WIN32)
set(FLAC_LIBRARIES ${FLAC_LIBRARIES} wsock32)
endif()
else()
set(FLAC_LIBRARIES)
endif()
mark_as_advanced(FLAC_INCLUDE_DIR FLAC_LIBRARY)
mark_as_advanced(
FLAC_INCLUDE_DIR
FLAC_LIBRARY
)
if(FLAC_FOUND AND NOT TARGET FLAC::FLAC)
add_library(FLAC::FLAC UNKNOWN IMPORTED)
set_target_properties(FLAC::FLAC PROPERTIES
IMPORTED_LOCATION "${FLAC_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}"
)
if(WIN32)
set_target_properties(FLAC::FLAC PROPERTIES
INTERFACE_LINK_LIBRARIES "${OGG_LIBRARY};wsock32"
)
else()
set_target_properties(FLAC::FLAC PROPERTIES
INTERFACE_LINK_LIBRARIES "${OGG_LIBRARY}"
)
endif()
endif()
......@@ -26,9 +26,14 @@ find_library(VORBIS_LIBRARY NAMES vorbis)
find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
find_library(VORBISENC_LIBRARY NAMES vorbisenc)
mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR
OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY)
mark_as_advanced(
VORBIS_INCLUDE_DIR
OGG_INCLUDE_DIR
OGG_LIBRARY
VORBIS_LIBRARY
VORBISFILE_LIBRARY
VORBISENC_LIBRARY
)
if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
set(OGGVORBIS_FOUND TRUE)
......@@ -42,28 +47,28 @@ if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_L
if (HAVE_LIBVORBISENC2)
set (OGGVORBIS_VERSION 2)
else (HAVE_LIBVORBISENC2)
else ()
set (OGGVORBIS_VERSION 1)
endif (HAVE_LIBVORBISENC2)
endif ()
else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
else ()
set (OGGVORBIS_VERSION)
set(OGGVORBIS_FOUND FALSE)
endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
endif ()
if (OGGVORBIS_FOUND)
if (NOT OggVorbis_FIND_QUIETLY)
message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}")
endif (NOT OggVorbis_FIND_QUIETLY)
else (OGGVORBIS_FOUND)
endif ()
else ()
if (OggVorbis_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find OggVorbis libraries")
endif (OggVorbis_FIND_REQUIRED)
if (NOT OggVorbis_FIND_QUITELY)
message(STATUS "Could NOT find OggVorbis libraries")
endif (NOT OggVorbis_FIND_QUITELY)
endif (OGGVORBIS_FOUND)
endif ()
endif ()
#check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H)
#check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG)
......@@ -87,3 +92,16 @@ endif (OGGVORBIS_FOUND)
# message(STATUS "Ogg/Vorbis not found")
#endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
if(OGGVORBIS_FOUND AND NOT TARGET OGGVORBIS::vorbis)
add_library(OGGVORBIS::ogg UNKNOWN IMPORTED)
set_target_properties(OGGVORBIS::ogg PROPERTIES
IMPORTED_LOCATION "${OGG_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIR}"
)
add_library(OGGVORBIS::vorbis UNKNOWN IMPORTED)
set_target_properties(OGGVORBIS::vorbis PROPERTIES
IMPORTED_LOCATION "${VORBIS_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${VORBIS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "OGGVORBIS::ogg;${VORBISFILE_LIBRARY};${VORBISENC_LIBRARY}"
)
endif()
add_definitions(-DTRANSLATION_DOMAIN=\"kcmaudiocd\")
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../plugins
)
########### next target ###############
add_library(kcm_audiocd MODULE)
set(kcm_audiocd_PART_SRCS kcmaudiocd.cpp)
target_sources(kcm_audiocd PRIVATE
kcmaudiocd.cpp
)
ki18n_wrap_ui(kcm_audiocd_PART_SRCS audiocdconfig.ui)
ki18n_wrap_ui(kcm_audiocd audiocdconfig.ui)
add_library(kcm_audiocd MODULE ${kcm_audiocd_PART_SRCS})
target_include_directories(kcm_audiocd
PRIVATE
${CMAKE_BINARY_DIR}
)
target_link_libraries(kcm_audiocd
KF5::I18n
KF5::KCMUtils
audiocdplugins
KF5::KCMUtils
KF5::I18n
)
install(TARGETS kcm_audiocd DESTINATION ${KDE_INSTALL_PLUGINDIR})
########### install files ###############
install(FILES audiocd.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
########### add handbook ################
......
......@@ -14,13 +14,19 @@ add_subdirectory(opus)
########### next target ###############
set(audiocdplugins_LIB_SRCS audiocdencoder.cpp)
add_library(audiocdplugins SHARED ${audiocdplugins_LIB_SRCS})
add_library(audiocdplugins SHARED)
target_sources(audiocdplugins PRIVATE
audiocdencoder.cpp
)
target_include_directories(audiocdplugins
PRIVATE
${CMAKE_BINARY_DIR}
)
target_link_libraries(audiocdplugins
KF5::Cddb
KF5::KIOCore
PUBLIC
KF5::KIOCore
KF5::Cddb
)
generate_export_header(audiocdplugins
......@@ -29,15 +35,17 @@ generate_export_header(audiocdplugins
EXPORT_FILE_NAME audiocdplugins_export.h
)
set_target_properties(audiocdplugins
PROPERTIES
set_target_properties(audiocdplugins PROPERTIES
VERSION ${AUDIOCDPLUGINS_VERSION}
SOVERSION ${AUDIOCDPLUGINS_SOVERSION}
)
install(TARGETS audiocdplugins ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
########### install files ###############
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/audiocdplugins_export.h audiocdencoder.h DESTINATION ${KDE_INSTALL_INCLUDEDIR} COMPONENT Devel)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/audiocdplugins_export.h
audiocdencoder.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR}
COMPONENT Devel
)
add_definitions(-DTRANSLATION_DOMAIN=\"audiocd_encoder_flac\")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. ${FLAC_INCLUDE_DIR} )
add_library(audiocd_encoder_flac SHARED)
########### next target ###############
set(audiocd_encoder_flac_PART_SRCS encoderflac.cpp )
target_sources(audiocd_encoder_flac PRIVATE
encoderflac.cpp
)
ki18n_wrap_ui(audiocd_encoder_flac_PART_SRCS encoderflacconfig.ui)
ki18n_wrap_ui(audiocd_encoder_flac encoderflacconfig.ui)
kconfig_add_kcfg_files(audiocd_encoder_flac_PART_SRCS audiocd_flac_encoder.kcfgc)
kconfig_add_kcfg_files(audiocd_encoder_flac audiocd_flac_encoder.kcfgc)
add_library(audiocd_encoder_flac ${audiocd_encoder_flac_PART_SRCS})
set_target_properties(audiocd_encoder_flac PROPERTIES PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
target_include_directories(audiocd_encoder_flac
PRIVATE
${CMAKE_BINARY_DIR}
)
target_link_libraries(audiocd_encoder_flac
${FLAC_LIBRARIES}
Qt5::Widgets
KF5::I18n
KF5::Cddb
audiocdplugins
KF5::I18n
Qt5::Widgets
FLAC::FLAC
)
install(TARGETS audiocd_encoder_flac DESTINATION ${KDE_INSTALL_PLUGINDIR})
......
add_definitions(-DTRANSLATION_DOMAIN=\"audiocd_encoder_lame\")
find_program(LAME_EXECUTABLE NAMES lame)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
if(NOT LAME_EXECUTABLE)
message(STATUS "\"lame\" binary not found. Plugins will be compile but install it under your system to using this plugins")
endif()
FIND_PROGRAM(LAME_EXECUTABLE NAMES lame)
if(NOT LAME_EXECUTABLE)
MESSAGE(STATUS "\"lame\" binary not found. Plugins will be compile but install it under your system to using this plugins")
endif(NOT LAME_EXECUTABLE)
add_definitions(-DTRANSLATION_DOMAIN=\"audiocd_encoder_lame\")
########### next target ###############
add_library(audiocd_encoder_lame SHARED)
set(audiocd_encoder_lame_PART_SRCS encoderlame.cpp )
target_sources(audiocd_encoder_lame PRIVATE
encoderlame.cpp
)
ki18n_wrap_ui(audiocd_encoder_lame_PART_SRCS encoderlameconfig.ui)
ki18n_wrap_ui(audiocd_encoder_lame encoderlameconfig.ui)
kconfig_add_kcfg_files(audiocd_encoder_lame_PART_SRCS audiocd_lame_encoder.kcfgc)
kconfig_add_kcfg_files(audiocd_encoder_lame audiocd_lame_encoder.kcfgc)
add_library(audiocd_encoder_lame ${audiocd_encoder_lame_PART_SRCS})
set_target_properties(audiocd_encoder_lame PROPERTIES PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
target_include_directories(audiocd_encoder_lame
PRIVATE
${CMAKE_BINARY_DIR}
)
target_link_libraries(audiocd_encoder_lame
Qt5::Widgets
KF5::I18n
KF5::Cddb
audiocdplugins
KF5::Cddb
KF5::I18n
Qt5::Widgets
)
install(TARGETS audiocd_encoder_lame DESTINATION ${KDE_INSTALL_PLUGINDIR})
########### install files ###############
install(FILES audiocd_lame_encoder.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
add_definitions(-DTRANSLATION_DOMAIN=\"audiocd_encoder_opus\")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
add_library(audiocd_encoder_opus SHARED)
########### next target ###############
set(audiocd_encoder_opus_PART_SRCS encoderopus.cpp)
target_sources(audiocd_encoder_opus PRIVATE
encoderopus.cpp
)
ki18n_wrap_ui(audiocd_encoder_opus_PART_SRCS encoderopusconfig.ui)
ki18n_wrap_ui(audiocd_encoder_opus encoderopusconfig.ui)
kconfig_add_kcfg_files(audiocd_encoder_opus_PART_SRCS audiocd_opus_encoder.kcfgc)
kconfig_add_kcfg_files(audiocd_encoder_opus audiocd_opus_encoder.kcfgc)
add_library(audiocd_encoder_opus ${audiocd_encoder_opus_PART_SRCS})
set_target_properties(audiocd_encoder_opus PROPERTIES PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
target_include_directories(audiocd_encoder_opus
PRIVATE
${CMAKE_BINARY_DIR}
)
target_link_libraries(audiocd_encoder_opus
Qt5::Widgets
KF5::I18n
KF5::Cddb
audiocdplugins
KF5::Cddb
KF5::I18n
Qt5::Widgets
)
install(TARGETS audiocd_encoder_opus DESTINATION ${KDE_INSTALL_PLUGINDIR})
########### install files ###############
install(FILES audiocd_opus_encoder.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
add_definitions(-DTRANSLATION_DOMAIN=\"audiocd_encoder_vorbis\")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. ${OGGVORBIS_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR})
add_library(audiocd_encoder_vorbis SHARED)
########### next target ###############
set(audiocd_encoder_vorbis_PART_SRCS encodervorbis.cpp)
ki18n_wrap_ui(audiocd_encoder_vorbis_PART_SRCS encodervorbisconfig.ui)
target_sources(audiocd_encoder_vorbis PRIVATE
encodervorbis.cpp
)
kconfig_add_kcfg_files(audiocd_encoder_vorbis_PART_SRCS audiocd_vorbis_encoder.kcfgc)
ki18n_wrap_ui(audiocd_encoder_vorbis encodervorbisconfig.ui)
add_library(audiocd_encoder_vorbis ${audiocd_encoder_vorbis_PART_SRCS})
set_target_properties(audiocd_encoder_vorbis PROPERTIES PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
kconfig_add_kcfg_files(audiocd_encoder_vorbis audiocd_vorbis_encoder.kcfgc)
target_link_libraries(audiocd_encoder_vorbis
${OGGVORBIS_LIBRARIES}
Qt5::Widgets
KF5::I18n
KF5::Cddb
OGGVORBIS::vorbis
audiocdplugins
KF5::Cddb
KF5::I18n
Qt5::Widgets
)
install(TARGETS audiocd_encoder_vorbis DESTINATION ${KDE_INSTALL_PLUGINDIR})
########### install files ###############
install(FILES audiocd_vorbis_encoder.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CDPARANOIA_INCLUDE_DIR})
add_library(audiocd_encoder_wav SHARED)
########### next target ###############
set(audiocd_encoder_wav_PART_SRCS encoderwav.cpp encodercda.cpp)
target_sources(audiocd_encoder_wav PRIVATE
encoderwav.cpp
encodercda.cpp
)
add_library(audiocd_encoder_wav ${audiocd_encoder_wav_PART_SRCS})
set_target_properties(audiocd_encoder_wav PROPERTIES PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
target_include_directories(audiocd_encoder_wav
PRIVATE
${CMAKE_BINARY_DIR}
)
target_link_libraries(audiocd_encoder_wav
audiocdplugins
)
install(TARGETS audiocd_encoder_wav DESTINATION ${KDE_INSTALL_PLUGINDIR})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment