diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 04aacdd9b..a22747396 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -26,6 +26,7 @@ target_include_directories(spotify-qt-lib PUBLIC # Third-party libraries add_subdirectory(thirdparty) +target_link_libraries(spotify-qt-lib PRIVATE spotify-qt-lib-third-party) # Version macros target_compile_definitions(spotify-qt-lib PUBLIC LIB_VERSION="v${PROJECT_VERSION}") @@ -43,10 +44,6 @@ if (MSVC) target_compile_definitions(spotify-qt PRIVATE _CRT_SECURE_NO_WARNINGS) endif () -# External projects -add_subdirectory(thirdparty) -target_link_libraries(spotify-qt-lib PRIVATE spotify-qt-lib-third-party) - # Link optional libraries if (LIB_QT_LIBRARIES) target_link_libraries(spotify-qt-lib PRIVATE ${LIB_QT_LIBRARIES}) diff --git a/lib/thirdparty/CMakeLists.txt b/lib/thirdparty/CMakeLists.txt index 004b88b4a..2444a8c95 100644 --- a/lib/thirdparty/CMakeLists.txt +++ b/lib/thirdparty/CMakeLists.txt @@ -1,6 +1,11 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +# CMake doesn't allow linking of libraries outside of main CMake file +# Create a new project to link against later +project(spotify-qt-lib-third-party) +add_library(${PROJECT_NAME} STATIC) + # SQLite cache support if (NOT DEFINED USE_DB_CACHE) set(USE_DB_CACHE ON)