CMakeLists.txt formatting

This commit is contained in:
Jonas Kvinge
2021-08-07 03:02:27 +02:00
parent 78de45fee2
commit 6ede400f3a
5 changed files with 61 additions and 62 deletions

View File

@@ -62,7 +62,7 @@ list(APPEND COMPILE_OPTIONS
option(BUILD_WERROR "Build with -Werror" OFF) option(BUILD_WERROR "Build with -Werror" OFF)
if(BUILD_WERROR) if(BUILD_WERROR)
list(APPEND COMPILE_OPTIONS -Werror) list(APPEND COMPILE_OPTIONS -Werror)
endif(BUILD_WERROR) endif()
add_compile_options(${COMPILE_OPTIONS}) add_compile_options(${COMPILE_OPTIONS})
@@ -99,10 +99,10 @@ endif()
if(LINUX) if(LINUX)
find_package(ALSA REQUIRED) find_package(ALSA REQUIRED)
pkg_check_modules(DBUS REQUIRED dbus-1) pkg_check_modules(DBUS REQUIRED dbus-1)
else(LINUX) else()
find_package(ALSA) find_package(ALSA)
pkg_check_modules(DBUS dbus-1) pkg_check_modules(DBUS dbus-1)
endif(LINUX) endif()
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
find_package(X11) find_package(X11)
pkg_check_modules(XCB xcb) pkg_check_modules(XCB xcb)
@@ -284,7 +284,7 @@ if(APPLE)
add_subdirectory(3rdparty/SPMediaKeyTap) add_subdirectory(3rdparty/SPMediaKeyTap)
set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap) set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap)
set(SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap) set(SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap)
endif(APPLE) endif()
if(NOT SPARKLE AND (APPLE OR WIN32)) if(NOT SPARKLE AND (APPLE OR WIN32))
if(BUILD_WITH_QT6) if(BUILD_WITH_QT6)
@@ -302,12 +302,11 @@ if (WIN32)
string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER}) string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER})
enable_language(RC) enable_language(RC)
SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -o <OBJECT> <SOURCE> -I ${CMAKE_SOURCE_DIR}/dist/windows") 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) if(WIN32)
option(ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF) option(ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF)
endif(WIN32) endif()
optional_component(ALSA ON "ALSA integration" optional_component(ALSA ON "ALSA integration"
DEPENDS "alsa" ALSA_FOUND DEPENDS "alsa" ALSA_FOUND
@@ -417,11 +416,11 @@ endif()
if(USE_BUNDLE AND NOT USE_BUNDLE_DIR) if(USE_BUNDLE AND NOT USE_BUNDLE_DIR)
if(LINUX) if(LINUX)
set(USE_BUNDLE_DIR "../plugins") set(USE_BUNDLE_DIR "../plugins")
endif(LINUX) endif()
if(APPLE) if(APPLE)
set(USE_BUNDLE_DIR "../PlugIns") set(USE_BUNDLE_DIR "../PlugIns")
endif(APPLE) endif()
endif(USE_BUNDLE AND NOT USE_BUNDLE_DIR) endif()
if(NOT CMAKE_CROSSCOMPILING) if(NOT CMAKE_CROSSCOMPILING)
# Check that we have Qt with sqlite driver # Check that we have Qt with sqlite driver

View File

@@ -29,7 +29,7 @@ target_include_directories(libstrawberry-common PRIVATE
if(Backtrace_FOUND) if(Backtrace_FOUND)
target_include_directories(libstrawberry-common SYSTEM PRIVATE ${Backtrace_INCLUDE_DIRS}) target_include_directories(libstrawberry-common SYSTEM PRIVATE ${Backtrace_INCLUDE_DIRS})
endif(Backtrace_FOUND) endif()
target_link_libraries(libstrawberry-common PRIVATE target_link_libraries(libstrawberry-common PRIVATE
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
@@ -40,4 +40,4 @@ target_link_libraries(libstrawberry-common PRIVATE
if(Backtrace_FOUND) if(Backtrace_FOUND)
target_link_libraries(libstrawberry-common PRIVATE ${Backtrace_LIBRARIES}) target_link_libraries(libstrawberry-common PRIVATE ${Backtrace_LIBRARIES})
endif(Backtrace_FOUND) endif()

View File

@@ -51,11 +51,11 @@ endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
target_link_libraries(strawberry-tagreader PRIVATE execinfo) target_link_libraries(strawberry-tagreader PRIVATE execinfo)
endif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") endif()
if(APPLE) if(APPLE)
target_link_libraries(strawberry-tagreader PRIVATE /System/Library/Frameworks/Foundation.framework) target_link_libraries(strawberry-tagreader PRIVATE /System/Library/Frameworks/Foundation.framework)
endif(APPLE) endif()
if(APPLE) if(APPLE)
install(TARGETS strawberry-tagreader DESTINATION ${CMAKE_BINARY_DIR}/strawberry.app/Contents/PlugIns) install(TARGETS strawberry-tagreader DESTINATION ${CMAKE_BINARY_DIR}/strawberry.app/Contents/PlugIns)

View File

@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
if(HAVE_TRANSLATIONS) if(HAVE_TRANSLATIONS)
include(../cmake/Translations.cmake) include(../cmake/Translations.cmake)
endif(HAVE_TRANSLATIONS) endif()
set(SOURCES set(SOURCES
core/mainwindow.cpp core/mainwindow.cpp
@@ -977,7 +977,7 @@ link_directories(
if(HAVE_ALSA) if(HAVE_ALSA)
link_directories(${ALSA_LIBRARY_DIRS}) link_directories(${ALSA_LIBRARY_DIRS})
endif(HAVE_ALSA) endif()
if(HAVE_LIBPULSE) if(HAVE_LIBPULSE)
link_directories(${LIBPULSE_LIBRARY_DIRS}) link_directories(${LIBPULSE_LIBRARY_DIRS})
@@ -992,7 +992,7 @@ if(HAVE_GSTREAMER)
${GSTREAMER_TAG_LIBRARY_DIRS} ${GSTREAMER_TAG_LIBRARY_DIRS}
${GSTREAMER_PBUTILS_LIBRARY_DIRS} ${GSTREAMER_PBUTILS_LIBRARY_DIRS}
) )
endif(HAVE_GSTREAMER) endif()
if(HAVE_VLC) if(HAVE_VLC)
link_directories(${LIBVLC_LIBRARY_DIRS}) link_directories(${LIBVLC_LIBRARY_DIRS})
@@ -1004,28 +1004,28 @@ endif()
if(X11_FOUND) if(X11_FOUND)
link_directories(${X11_LIBRARY_DIRS}) link_directories(${X11_LIBRARY_DIRS})
endif(X11_FOUND) endif()
if(XCB_FOUND) if(XCB_FOUND)
link_directories(${XCB_LIBRARY_DIRS}) link_directories(${XCB_LIBRARY_DIRS})
endif(XCB_FOUND) endif()
if(HAVE_GIO) if(HAVE_GIO)
link_directories(${GIO_LIBRARY_DIRS}) link_directories(${GIO_LIBRARY_DIRS})
endif(HAVE_GIO) endif()
if(HAVE_AUDIOCD) if(HAVE_AUDIOCD)
link_directories(${LIBCDIO_LIBRARY_DIRS}) link_directories(${LIBCDIO_LIBRARY_DIRS})
endif(HAVE_AUDIOCD) endif()
if(HAVE_LIBGPOD) if(HAVE_LIBGPOD)
link_directories(${LIBGPOD_LIBRARY_DIRS}) link_directories(${LIBGPOD_LIBRARY_DIRS})
link_directories(${GDK_PIXBUF_LIBRARY_DIRS}) link_directories(${GDK_PIXBUF_LIBRARY_DIRS})
endif(HAVE_LIBGPOD) endif()
if(HAVE_LIBMTP) if(HAVE_LIBMTP)
link_directories(${LIBMTP_LIBRARY_DIRS}) link_directories(${LIBMTP_LIBRARY_DIRS})
endif(HAVE_LIBMTP) endif()
add_library(strawberry_lib STATIC add_library(strawberry_lib STATIC
${SOURCES} ${SOURCES}
@@ -1079,7 +1079,7 @@ target_link_libraries(strawberry_lib PUBLIC
if(HAVE_ALSA) if(HAVE_ALSA)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${ALSA_INCLUDE_DIRS}) target_include_directories(strawberry_lib SYSTEM PRIVATE ${ALSA_INCLUDE_DIRS})
target_link_libraries(strawberry_lib PRIVATE ${ALSA_LIBRARIES}) target_link_libraries(strawberry_lib PRIVATE ${ALSA_LIBRARIES})
endif(HAVE_ALSA) endif()
if(HAVE_LIBPULSE) if(HAVE_LIBPULSE)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBPULSE_INCLUDE_DIRS}) target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBPULSE_INCLUDE_DIRS})
@@ -1103,7 +1103,7 @@ if(HAVE_GSTREAMER)
${GSTREAMER_TAG_LIBRARIES} ${GSTREAMER_TAG_LIBRARIES}
${GSTREAMER_PBUTILS_LIBRARIES} ${GSTREAMER_PBUTILS_LIBRARIES}
) )
endif(HAVE_GSTREAMER) endif()
if(HAVE_MOODBAR) if(HAVE_MOODBAR)
target_link_libraries(strawberry_lib PRIVATE gstmoodbar) target_link_libraries(strawberry_lib PRIVATE gstmoodbar)
@@ -1122,36 +1122,36 @@ endif()
if(X11_FOUND) if(X11_FOUND)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${X11_INCLUDE_DIR}) target_include_directories(strawberry_lib SYSTEM PRIVATE ${X11_INCLUDE_DIR})
target_link_libraries(strawberry_lib PRIVATE ${X11_LIBRARIES}) target_link_libraries(strawberry_lib PRIVATE ${X11_LIBRARIES})
endif(X11_FOUND) endif()
if(XCB_FOUND) if(XCB_FOUND)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${XCB_INCLUDE_DIR}) target_include_directories(strawberry_lib SYSTEM PRIVATE ${XCB_INCLUDE_DIR})
target_link_libraries(strawberry_lib PRIVATE ${XCB_LIBRARIES}) target_link_libraries(strawberry_lib PRIVATE ${XCB_LIBRARIES})
endif(XCB_FOUND) endif()
if(HAVE_GIO) if(HAVE_GIO)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${GIO_INCLUDE_DIRS}) target_include_directories(strawberry_lib SYSTEM PRIVATE ${GIO_INCLUDE_DIRS})
target_link_libraries(strawberry_lib PRIVATE ${GIO_LIBRARIES}) target_link_libraries(strawberry_lib PRIVATE ${GIO_LIBRARIES})
endif(HAVE_GIO) endif()
if(HAVE_AUDIOCD) if(HAVE_AUDIOCD)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBCDIO_INCLUDE_DIRS}) target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBCDIO_INCLUDE_DIRS})
target_link_libraries(strawberry_lib PRIVATE ${LIBCDIO_LIBRARIES}) target_link_libraries(strawberry_lib PRIVATE ${LIBCDIO_LIBRARIES})
endif(HAVE_AUDIOCD) endif()
if(HAVE_LIBGPOD) if(HAVE_LIBGPOD)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBGPOD_INCLUDE_DIRS} ${GDK_PIXBUF_INCLUDE_DIRS}) 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}) target_link_libraries(strawberry_lib PRIVATE ${LIBGPOD_LIBRARIES} ${GDK_PIXBUF_LIBRARIES})
endif(HAVE_LIBGPOD) endif()
if(HAVE_LIBMTP) if(HAVE_LIBMTP)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBMTP_INCLUDE_DIRS}) target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBMTP_INCLUDE_DIRS})
target_link_libraries(strawberry_lib PRIVATE ${LIBMTP_LIBRARIES}) target_link_libraries(strawberry_lib PRIVATE ${LIBMTP_LIBRARIES})
endif(HAVE_LIBMTP) endif()
if(FREEBSD) if(FREEBSD)
target_link_libraries(strawberry_lib PRIVATE iconv) target_link_libraries(strawberry_lib PRIVATE iconv)
endif(FREEBSD) endif()
if(APPLE) if(APPLE)
target_link_libraries(strawberry_lib PRIVATE target_link_libraries(strawberry_lib PRIVATE
@@ -1167,12 +1167,12 @@ if(APPLE)
if(HAVE_SPARKLE) if(HAVE_SPARKLE)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${SPARKLE}/Headers) target_include_directories(strawberry_lib SYSTEM PRIVATE ${SPARKLE}/Headers)
target_link_libraries(strawberry_lib PRIVATE ${SPARKLE}) target_link_libraries(strawberry_lib PRIVATE ${SPARKLE})
endif(HAVE_SPARKLE) endif()
endif(APPLE) endif()
if(WIN32) if(WIN32)
target_link_libraries(strawberry_lib PRIVATE dsound dwmapi) 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 # Show the console window in debug mode on Windows
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT ENABLE_WIN32_CONSOLE) if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT ENABLE_WIN32_CONSOLE)
set(STRAWBERRY-WIN32-FLAG WIN32) set(STRAWBERRY-WIN32-FLAG WIN32)
endif(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT ENABLE_WIN32_CONSOLE) endif()
# Resource file for windows # Resource file for windows
if(WIN32) if(WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../dist/windows/windres.rc.in ${CMAKE_CURRENT_BINARY_DIR}/windres.rc) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../dist/windows/windres.rc.in ${CMAKE_CURRENT_BINARY_DIR}/windres.rc)
set(STRAWBERRY-WIN32-RESOURCES windres.rc) set(STRAWBERRY-WIN32-RESOURCES windres.rc)
endif(WIN32) endif()
add_executable(strawberry add_executable(strawberry
MACOSX_BUNDLE MACOSX_BUNDLE
@@ -1216,4 +1216,4 @@ endif()
if(APPLE) if(APPLE)
set_target_properties(strawberry PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/Info.plist") set_target_properties(strawberry PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/../dist/macos/Info.plist")
endif(APPLE) endif()

View File

@@ -27,19 +27,19 @@ if(HAVE_GSTREAMER)
${GSTREAMER_TAG_LIBRARY_DIRS} ${GSTREAMER_TAG_LIBRARY_DIRS}
${GSTREAMER_PBUTILS_LIBRARY_DIRS} ${GSTREAMER_PBUTILS_LIBRARY_DIRS}
) )
endif(HAVE_GSTREAMER) endif()
if(HAVE_CHROMAPRINT) if(HAVE_CHROMAPRINT)
link_directories(${CHROMAPRINT_LIBRARY_DIRS}) link_directories(${CHROMAPRINT_LIBRARY_DIRS})
endif(HAVE_CHROMAPRINT) endif()
if(HAVE_AUDIOCD) if(HAVE_AUDIOCD)
link_directories(${LIBCDIO_LIBRARY_DIRS}) link_directories(${LIBCDIO_LIBRARY_DIRS})
endif(HAVE_AUDIOCD) endif()
if(HAVE_LIBMTP) if(HAVE_LIBMTP)
link_directories(${LIBMTP_LIBRARY_DIRS}) link_directories(${LIBMTP_LIBRARY_DIRS})
endif(HAVE_LIBMTP) endif()
add_library(test_utils STATIC EXCLUDE_FROM_ALL ${TESTUTILS-SOURCES} ${TESTUTILS-SOURCES-MOC}) add_library(test_utils STATIC EXCLUDE_FROM_ALL ${TESTUTILS-SOURCES} ${TESTUTILS-SOURCES-MOC})
target_include_directories(test_utils SYSTEM PRIVATE target_include_directories(test_utils SYSTEM PRIVATE
@@ -77,7 +77,7 @@ target_include_directories(test_gui_main PRIVATE
) )
if(HAVE_GSTREAMER) if(HAVE_GSTREAMER)
target_include_directories(test_gui_main SYSTEM PRIVATE ${GSTREAMER_INCLUDE_DIRS}) target_include_directories(test_gui_main SYSTEM PRIVATE ${GSTREAMER_INCLUDE_DIRS})
endif(HAVE_GSTREAMER) endif()
target_link_libraries(test_gui_main PRIVATE strawberry_lib) target_link_libraries(test_gui_main PRIVATE strawberry_lib)
set_target_properties(test_gui_main PROPERTIES COMPILE_DEFINITIONS GUI) set_target_properties(test_gui_main PROPERTIES COMPILE_DEFINITIONS GUI)
@@ -91,7 +91,7 @@ target_include_directories(test_main PRIVATE
) )
if(HAVE_GSTREAMER) if(HAVE_GSTREAMER)
target_include_directories(test_main SYSTEM PRIVATE ${GSTREAMER_INCLUDE_DIRS}) target_include_directories(test_main SYSTEM PRIVATE ${GSTREAMER_INCLUDE_DIRS})
endif(HAVE_GSTREAMER) endif()
target_link_libraries(test_main PRIVATE strawberry_lib) 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. # 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}) set(GUI_REQUIRED ${gui_required})
if(GUI_REQUIRED) if(GUI_REQUIRED)
target_link_libraries(${TEST_NAME} PRIVATE test_gui_main) target_link_libraries(${TEST_NAME} PRIVATE test_gui_main)
else(GUI_REQUIRED) else()
target_link_libraries(${TEST_NAME} PRIVATE test_main) target_link_libraries(${TEST_NAME} PRIVATE test_main)
endif(GUI_REQUIRED) endif()
add_test(strawberry_tests ${TEST_NAME}) add_test(strawberry_tests ${TEST_NAME})
add_custom_command(TARGET strawberry_tests POST_BUILD COMMAND ./${TEST_NAME}${CMAKE_EXECUTABLE_SUFFIX}) add_custom_command(TARGET strawberry_tests POST_BUILD COMMAND ./${TEST_NAME}${CMAKE_EXECUTABLE_SUFFIX})