build: clean up CMakeLists.txt a little bit
This commit is contained in:
parent
5e9d796833
commit
585b24eaba
|
@ -17,7 +17,7 @@ find_package(Qt6 6.5.1 COMPONENTS Widgets Multimedia Network LinguistTools REQUI
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
|
|
||||||
if (PKG_CONFIG_FOUND)
|
if (PKG_CONFIG_FOUND)
|
||||||
pkg_check_modules(TagLib REQUIRED taglib)
|
pkg_check_modules(TagLib taglib IMPORTED_TARGET)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set (PMUSIC_CPP_FILES
|
set (PMUSIC_CPP_FILES
|
||||||
|
@ -72,10 +72,11 @@ if (NOT TagLib_FOUND)
|
||||||
target_compile_definitions(${EXE_NAME} PRIVATE
|
target_compile_definitions(${EXE_NAME} PRIVATE
|
||||||
NO_TAGLIB=1
|
NO_TAGLIB=1
|
||||||
)
|
)
|
||||||
|
else ()
|
||||||
|
target_link_libraries(${EXE_NAME} PRIVATE PkgConfig::TagLib)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_include_directories(${EXE_NAME} PRIVATE ${TagLib_INCLUDE_DIRS})
|
target_link_libraries(${EXE_NAME} PRIVATE Qt::Widgets Qt::Multimedia Qt::Network)
|
||||||
target_link_libraries(${EXE_NAME} PRIVATE Qt::Widgets Qt::Multimedia Qt::Network ${TagLib_LINK_LIBRARIES})
|
|
||||||
|
|
||||||
# Extra build settings
|
# Extra build settings
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
@ -85,29 +86,15 @@ if (WIN32)
|
||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Helper macros for install settings
|
|
||||||
macro (pmusic_convert_to_relative_path _var)
|
|
||||||
# Make sure _var is a relative path
|
|
||||||
if (IS_ABSOLUTE "${${_var}}")
|
|
||||||
file (RELATIVE_PATH ${_var} "${CMAKE_INSTALL_PREFIX}" "${${_var}}")
|
|
||||||
endif ()
|
|
||||||
endmacro ()
|
|
||||||
|
|
||||||
# Install settings
|
# Install settings
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
# FIXME: try to avoid install to a "bin" subfolder under windows...
|
# FIXME: try to avoid install to a "bin" subfolder under windows...
|
||||||
# when fixed, don't forget to update the CI config file...
|
# when fixed, don't forget to update the CI config file...
|
||||||
set (BIN_INSTALL_DIR "") # seems useless, don't know why...
|
|
||||||
elseif (UNIX)
|
elseif (UNIX)
|
||||||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
set(CMAKE_INSTALL_PREFIX /usr)
|
set(CMAKE_INSTALL_PREFIX /usr)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set (BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") # relative, usually "bin"
|
|
||||||
pmusic_convert_to_relative_path(BIN_INSTALL_DIR)
|
|
||||||
set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") # "lib" or "lib64"
|
|
||||||
pmusic_convert_to_relative_path(LIB_INSTALL_DIR)
|
|
||||||
|
|
||||||
# install icon
|
# install icon
|
||||||
install (
|
install (
|
||||||
FILES icons/app-icon.svg
|
FILES icons/app-icon.svg
|
||||||
|
@ -123,9 +110,9 @@ elseif (UNIX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set (INSTALL_TARGETS_DEFAULT_ARGS
|
set (INSTALL_TARGETS_DEFAULT_ARGS
|
||||||
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT Devel
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Devel
|
||||||
)
|
)
|
||||||
|
|
||||||
install (
|
install (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user