CMakeLists.txt formatting
This commit is contained in:
parent
78de45fee2
commit
6ede400f3a
@ -12,13 +12,13 @@ include(cmake/Summary.cmake)
|
||||
include(cmake/OptionalSource.cmake)
|
||||
include(cmake/ParseArguments.cmake)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set(LINUX ON)
|
||||
endif()
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
set(FREEBSD ON)
|
||||
endif()
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
|
||||
set(OPENBSD ON)
|
||||
endif()
|
||||
|
||||
@ -62,7 +62,7 @@ list(APPEND COMPILE_OPTIONS
|
||||
option(BUILD_WERROR "Build with -Werror" OFF)
|
||||
if(BUILD_WERROR)
|
||||
list(APPEND COMPILE_OPTIONS -Werror)
|
||||
endif(BUILD_WERROR)
|
||||
endif()
|
||||
|
||||
add_compile_options(${COMPILE_OPTIONS})
|
||||
|
||||
@ -77,11 +77,11 @@ if(APPLE)
|
||||
endif()
|
||||
|
||||
find_program(CCACHE_EXECUTABLE NAMES ccache)
|
||||
if (CCACHE_EXECUTABLE)
|
||||
if(CCACHE_EXECUTABLE)
|
||||
message(STATUS "ccache found: will be used for compilation and linkage")
|
||||
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_EXECUTABLE})
|
||||
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_EXECUTABLE})
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Boost REQUIRED)
|
||||
@ -93,17 +93,17 @@ endif()
|
||||
find_package(Iconv)
|
||||
find_package(GnuTLS REQUIRED)
|
||||
find_package(Protobuf REQUIRED)
|
||||
if (NOT Protobuf_PROTOC_EXECUTABLE)
|
||||
if(NOT Protobuf_PROTOC_EXECUTABLE)
|
||||
message(FATAL_ERROR "Missing protobuf compiler.")
|
||||
endif()
|
||||
if(LINUX)
|
||||
find_package(ALSA REQUIRED)
|
||||
pkg_check_modules(DBUS REQUIRED dbus-1)
|
||||
else(LINUX)
|
||||
else()
|
||||
find_package(ALSA)
|
||||
pkg_check_modules(DBUS dbus-1)
|
||||
endif(LINUX)
|
||||
if (UNIX AND NOT APPLE)
|
||||
endif()
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(X11)
|
||||
pkg_check_modules(XCB xcb)
|
||||
endif()
|
||||
@ -284,7 +284,7 @@ if(APPLE)
|
||||
add_subdirectory(3rdparty/SPMediaKeyTap)
|
||||
set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap)
|
||||
set(SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap)
|
||||
endif(APPLE)
|
||||
endif()
|
||||
|
||||
if(NOT SPARKLE AND (APPLE OR WIN32))
|
||||
if(BUILD_WITH_QT6)
|
||||
@ -297,17 +297,16 @@ if(NOT SPARKLE AND (APPLE OR WIN32))
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if(WIN32)
|
||||
# RC compiler
|
||||
string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER})
|
||||
enable_language(RC)
|
||||
SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -o <OBJECT> <SOURCE> -I ${CMAKE_SOURCE_DIR}/dist/windows")
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
# Optional bits
|
||||
if(WIN32)
|
||||
option(ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
optional_component(ALSA ON "ALSA integration"
|
||||
DEPENDS "alsa" ALSA_FOUND
|
||||
@ -344,7 +343,7 @@ optional_component(MUSICBRAINZ ON "MusicBrainz integration"
|
||||
DEPENDS "gstreamer" GSTREAMER_FOUND
|
||||
)
|
||||
|
||||
if (X11_FOUND OR HAVE_DBUS OR APPLE OR WIN32)
|
||||
if(X11_FOUND OR HAVE_DBUS OR APPLE OR WIN32)
|
||||
set(HAVE_GLOBALSHORTCUTS_SUPPORT ON)
|
||||
endif()
|
||||
|
||||
@ -417,11 +416,11 @@ endif()
|
||||
if(USE_BUNDLE AND NOT USE_BUNDLE_DIR)
|
||||
if(LINUX)
|
||||
set(USE_BUNDLE_DIR "../plugins")
|
||||
endif(LINUX)
|
||||
endif()
|
||||
if(APPLE)
|
||||
set(USE_BUNDLE_DIR "../PlugIns")
|
||||
endif(APPLE)
|
||||
endif(USE_BUNDLE AND NOT USE_BUNDLE_DIR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
# Check that we have Qt with sqlite driver
|
||||
|
@ -29,7 +29,7 @@ target_include_directories(libstrawberry-common PRIVATE
|
||||
|
||||
if(Backtrace_FOUND)
|
||||
target_include_directories(libstrawberry-common SYSTEM PRIVATE ${Backtrace_INCLUDE_DIRS})
|
||||
endif(Backtrace_FOUND)
|
||||
endif()
|
||||
|
||||
target_link_libraries(libstrawberry-common PRIVATE
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
@ -40,4 +40,4 @@ target_link_libraries(libstrawberry-common PRIVATE
|
||||
|
||||
if(Backtrace_FOUND)
|
||||
target_link_libraries(libstrawberry-common PRIVATE ${Backtrace_LIBRARIES})
|
||||
endif(Backtrace_FOUND)
|
||||
endif()
|
||||
|
@ -51,11 +51,11 @@ endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
target_link_libraries(strawberry-tagreader PRIVATE execinfo)
|
||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(strawberry-tagreader PRIVATE /System/Library/Frameworks/Foundation.framework)
|
||||
endif(APPLE)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
install(TARGETS strawberry-tagreader DESTINATION ${CMAKE_BINARY_DIR}/strawberry.app/Contents/PlugIns)
|
||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
if(HAVE_TRANSLATIONS)
|
||||
include(../cmake/Translations.cmake)
|
||||
endif(HAVE_TRANSLATIONS)
|
||||
endif()
|
||||
|
||||
set(SOURCES
|
||||
core/mainwindow.cpp
|
||||
@ -935,20 +935,20 @@ qt_add_resources(QRC ${RESOURCES})
|
||||
if(HAVE_TRANSLATIONS)
|
||||
|
||||
set(LINGUAS "All" CACHE STRING "A space-seperated list of translations to compile in to Strawberry, or \"None\".")
|
||||
if (LINGUAS STREQUAL "All")
|
||||
if(LINGUAS STREQUAL "All")
|
||||
# build LANGUAGES from all existing .po files
|
||||
file(GLOB pofiles translations/*.po)
|
||||
foreach(pofile ${pofiles})
|
||||
get_filename_component(lang ${pofile} NAME_WE)
|
||||
list(APPEND LANGUAGES ${lang})
|
||||
endforeach(pofile)
|
||||
else (LINGUAS STREQUAL "All")
|
||||
if (NOT LINGUAS OR LINGUAS STREQUAL "None")
|
||||
set (LANGUAGES "")
|
||||
else (NOT LINGUAS OR LINGUAS STREQUAL "None")
|
||||
else(LINGUAS STREQUAL "All")
|
||||
if(NOT LINGUAS OR LINGUAS STREQUAL "None")
|
||||
set(LANGUAGES "")
|
||||
else(NOT LINGUAS OR LINGUAS STREQUAL "None")
|
||||
string(REGEX MATCHALL [a-zA-Z_@]+ LANGUAGES ${LINGUAS})
|
||||
endif (NOT LINGUAS OR LINGUAS STREQUAL "None")
|
||||
endif (LINGUAS STREQUAL "All")
|
||||
endif(NOT LINGUAS OR LINGUAS STREQUAL "None")
|
||||
endif(LINGUAS STREQUAL "All")
|
||||
|
||||
add_pot(POT
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/translations/header
|
||||
@ -977,7 +977,7 @@ link_directories(
|
||||
|
||||
if(HAVE_ALSA)
|
||||
link_directories(${ALSA_LIBRARY_DIRS})
|
||||
endif(HAVE_ALSA)
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBPULSE)
|
||||
link_directories(${LIBPULSE_LIBRARY_DIRS})
|
||||
@ -992,7 +992,7 @@ if(HAVE_GSTREAMER)
|
||||
${GSTREAMER_TAG_LIBRARY_DIRS}
|
||||
${GSTREAMER_PBUTILS_LIBRARY_DIRS}
|
||||
)
|
||||
endif(HAVE_GSTREAMER)
|
||||
endif()
|
||||
|
||||
if(HAVE_VLC)
|
||||
link_directories(${LIBVLC_LIBRARY_DIRS})
|
||||
@ -1004,28 +1004,28 @@ endif()
|
||||
|
||||
if(X11_FOUND)
|
||||
link_directories(${X11_LIBRARY_DIRS})
|
||||
endif(X11_FOUND)
|
||||
endif()
|
||||
|
||||
if(XCB_FOUND)
|
||||
link_directories(${XCB_LIBRARY_DIRS})
|
||||
endif(XCB_FOUND)
|
||||
endif()
|
||||
|
||||
if(HAVE_GIO)
|
||||
link_directories(${GIO_LIBRARY_DIRS})
|
||||
endif(HAVE_GIO)
|
||||
endif()
|
||||
|
||||
if(HAVE_AUDIOCD)
|
||||
link_directories(${LIBCDIO_LIBRARY_DIRS})
|
||||
endif(HAVE_AUDIOCD)
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBGPOD)
|
||||
link_directories(${LIBGPOD_LIBRARY_DIRS})
|
||||
link_directories(${GDK_PIXBUF_LIBRARY_DIRS})
|
||||
endif(HAVE_LIBGPOD)
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBMTP)
|
||||
link_directories(${LIBMTP_LIBRARY_DIRS})
|
||||
endif(HAVE_LIBMTP)
|
||||
endif()
|
||||
|
||||
add_library(strawberry_lib STATIC
|
||||
${SOURCES}
|
||||
@ -1079,7 +1079,7 @@ target_link_libraries(strawberry_lib PUBLIC
|
||||
if(HAVE_ALSA)
|
||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${ALSA_INCLUDE_DIRS})
|
||||
target_link_libraries(strawberry_lib PRIVATE ${ALSA_LIBRARIES})
|
||||
endif(HAVE_ALSA)
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBPULSE)
|
||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBPULSE_INCLUDE_DIRS})
|
||||
@ -1103,7 +1103,7 @@ if(HAVE_GSTREAMER)
|
||||
${GSTREAMER_TAG_LIBRARIES}
|
||||
${GSTREAMER_PBUTILS_LIBRARIES}
|
||||
)
|
||||
endif(HAVE_GSTREAMER)
|
||||
endif()
|
||||
|
||||
if(HAVE_MOODBAR)
|
||||
target_link_libraries(strawberry_lib PRIVATE gstmoodbar)
|
||||
@ -1122,36 +1122,36 @@ endif()
|
||||
if(X11_FOUND)
|
||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${X11_INCLUDE_DIR})
|
||||
target_link_libraries(strawberry_lib PRIVATE ${X11_LIBRARIES})
|
||||
endif(X11_FOUND)
|
||||
endif()
|
||||
|
||||
if(XCB_FOUND)
|
||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${XCB_INCLUDE_DIR})
|
||||
target_link_libraries(strawberry_lib PRIVATE ${XCB_LIBRARIES})
|
||||
endif(XCB_FOUND)
|
||||
endif()
|
||||
|
||||
if(HAVE_GIO)
|
||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${GIO_INCLUDE_DIRS})
|
||||
target_link_libraries(strawberry_lib PRIVATE ${GIO_LIBRARIES})
|
||||
endif(HAVE_GIO)
|
||||
endif()
|
||||
|
||||
if(HAVE_AUDIOCD)
|
||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBCDIO_INCLUDE_DIRS})
|
||||
target_link_libraries(strawberry_lib PRIVATE ${LIBCDIO_LIBRARIES})
|
||||
endif(HAVE_AUDIOCD)
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBGPOD)
|
||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBGPOD_INCLUDE_DIRS} ${GDK_PIXBUF_INCLUDE_DIRS})
|
||||
target_link_libraries(strawberry_lib PRIVATE ${LIBGPOD_LIBRARIES} ${GDK_PIXBUF_LIBRARIES})
|
||||
endif(HAVE_LIBGPOD)
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBMTP)
|
||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBMTP_INCLUDE_DIRS})
|
||||
target_link_libraries(strawberry_lib PRIVATE ${LIBMTP_LIBRARIES})
|
||||
endif(HAVE_LIBMTP)
|
||||
endif()
|
||||
|
||||
if(FREEBSD)
|
||||
target_link_libraries(strawberry_lib PRIVATE iconv)
|
||||
endif(FREEBSD)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(strawberry_lib PRIVATE
|
||||
@ -1167,12 +1167,12 @@ if(APPLE)
|
||||
if(HAVE_SPARKLE)
|
||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${SPARKLE}/Headers)
|
||||
target_link_libraries(strawberry_lib PRIVATE ${SPARKLE})
|
||||
endif(HAVE_SPARKLE)
|
||||
endif(APPLE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(strawberry_lib PRIVATE dsound dwmapi)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
|
||||
###############################################################################
|
||||
@ -1182,13 +1182,13 @@ set(EXECUTABLE_OUTPUT_PATH ..)
|
||||
# Show the console window in debug mode on Windows
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT ENABLE_WIN32_CONSOLE)
|
||||
set(STRAWBERRY-WIN32-FLAG WIN32)
|
||||
endif(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT ENABLE_WIN32_CONSOLE)
|
||||
endif()
|
||||
|
||||
# Resource file for windows
|
||||
if(WIN32)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../dist/windows/windres.rc.in ${CMAKE_CURRENT_BINARY_DIR}/windres.rc)
|
||||
set(STRAWBERRY-WIN32-RESOURCES windres.rc)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
add_executable(strawberry
|
||||
MACOSX_BUNDLE
|
||||
@ -1216,4 +1216,4 @@ endif()
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(strawberry PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/Info.plist")
|
||||
endif(APPLE)
|
||||
endif()
|
||||
|
@ -27,19 +27,19 @@ if(HAVE_GSTREAMER)
|
||||
${GSTREAMER_TAG_LIBRARY_DIRS}
|
||||
${GSTREAMER_PBUTILS_LIBRARY_DIRS}
|
||||
)
|
||||
endif(HAVE_GSTREAMER)
|
||||
endif()
|
||||
|
||||
if(HAVE_CHROMAPRINT)
|
||||
link_directories(${CHROMAPRINT_LIBRARY_DIRS})
|
||||
endif(HAVE_CHROMAPRINT)
|
||||
endif()
|
||||
|
||||
if(HAVE_AUDIOCD)
|
||||
link_directories(${LIBCDIO_LIBRARY_DIRS})
|
||||
endif(HAVE_AUDIOCD)
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBMTP)
|
||||
link_directories(${LIBMTP_LIBRARY_DIRS})
|
||||
endif(HAVE_LIBMTP)
|
||||
endif()
|
||||
|
||||
add_library(test_utils STATIC EXCLUDE_FROM_ALL ${TESTUTILS-SOURCES} ${TESTUTILS-SOURCES-MOC})
|
||||
target_include_directories(test_utils SYSTEM PRIVATE
|
||||
@ -77,7 +77,7 @@ target_include_directories(test_gui_main PRIVATE
|
||||
)
|
||||
if(HAVE_GSTREAMER)
|
||||
target_include_directories(test_gui_main SYSTEM PRIVATE ${GSTREAMER_INCLUDE_DIRS})
|
||||
endif(HAVE_GSTREAMER)
|
||||
endif()
|
||||
target_link_libraries(test_gui_main PRIVATE strawberry_lib)
|
||||
set_target_properties(test_gui_main PROPERTIES COMPILE_DEFINITIONS GUI)
|
||||
|
||||
@ -91,7 +91,7 @@ target_include_directories(test_main PRIVATE
|
||||
)
|
||||
if(HAVE_GSTREAMER)
|
||||
target_include_directories(test_main SYSTEM PRIVATE ${GSTREAMER_INCLUDE_DIRS})
|
||||
endif(HAVE_GSTREAMER)
|
||||
endif()
|
||||
target_link_libraries(test_main PRIVATE strawberry_lib)
|
||||
|
||||
# Given a file foo_test.cpp, creates a target foo_test and adds it to the test target.
|
||||
@ -122,9 +122,9 @@ macro(add_test_file test_source gui_required)
|
||||
set(GUI_REQUIRED ${gui_required})
|
||||
if(GUI_REQUIRED)
|
||||
target_link_libraries(${TEST_NAME} PRIVATE test_gui_main)
|
||||
else(GUI_REQUIRED)
|
||||
else()
|
||||
target_link_libraries(${TEST_NAME} PRIVATE test_main)
|
||||
endif(GUI_REQUIRED)
|
||||
endif()
|
||||
|
||||
add_test(strawberry_tests ${TEST_NAME})
|
||||
add_custom_command(TARGET strawberry_tests POST_BUILD COMMAND ./${TEST_NAME}${CMAKE_EXECUTABLE_SUFFIX})
|
||||
|
Loading…
x
Reference in New Issue
Block a user