summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Małek <michalm@jabster.pl>2014-08-07 20:12:59 (GMT)
committerMichał Małek <michalm@jabster.pl>2014-08-07 20:12:59 (GMT)
commitf31cfdd44820561a7f73235d0a29912696c34aca (patch)
treec8d7db832bc8e35b2e9493ab9c3b433f01391bca
parentd5986df3f66bdb464ae009f86e8abec98fae6636 (diff)
Use Musicbrainz library as imported target
-rw-r--r--cmake/FindMusicBrainz5.cmake18
-rw-r--r--libkcddb/CMakeLists.txt9
2 files changed, 16 insertions, 11 deletions
diff --git a/cmake/FindMusicBrainz5.cmake b/cmake/FindMusicBrainz5.cmake
index 7970f48..cda5e40 100644
--- a/cmake/FindMusicBrainz5.cmake
+++ b/cmake/FindMusicBrainz5.cmake
@@ -11,16 +11,20 @@
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(MUSICBRAINZ5_INCLUDE_DIR AND MUSICBRAINZ5_LIBRARIES)
- set(MUSICBRAINZ5_FIND_QUIETLY TRUE)
-endif(MUSICBRAINZ5_INCLUDE_DIR AND MUSICBRAINZ5_LIBRARIES)
+ set(MUSICBRAINZ5_FIND_QUIETLY TRUE)
+endif()
-FIND_PATH(MUSICBRAINZ5_INCLUDE_DIR musicbrainz5/Disc.h)
+find_path(MUSICBRAINZ5_INCLUDE_DIR musicbrainz5/Disc.h)
-FIND_LIBRARY( MUSICBRAINZ5_LIBRARIES NAMES musicbrainz5)
+find_library(MUSICBRAINZ5_LIBRARIES NAMES musicbrainz5)
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args( MusicBrainz5 DEFAULT_MSG
- MUSICBRAINZ5_INCLUDE_DIR MUSICBRAINZ5_LIBRARIES)
+find_package_handle_standard_args(MusicBrainz5 DEFAULT_MSG MUSICBRAINZ5_INCLUDE_DIR MUSICBRAINZ5_LIBRARIES)
-MARK_AS_ADVANCED(MUSICBRAINZ5_INCLUDE_DIR MUSICBRAINZ5_LIBRARIES)
+add_library(musicbrainz SHARED IMPORTED)
+set_target_properties(musicbrainz PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${MUSICBRAINZ5_INCLUDE_DIR}"
+ IMPORTED_LOCATION "${MUSICBRAINZ5_LIBRARIES}"
+)
+mark_as_advanced(MUSICBRAINZ5_INCLUDE_DIR MUSICBRAINZ5_LIBRARIES)
diff --git a/libkcddb/CMakeLists.txt b/libkcddb/CMakeLists.txt
index 1ff4029..164cdb1 100644
--- a/libkcddb/CMakeLists.txt
+++ b/libkcddb/CMakeLists.txt
@@ -4,8 +4,6 @@ if(MUSICBRAINZ5_FOUND)
musicbrainz/musicbrainzlookup.cpp
musicbrainz/asyncmusicbrainzlookup.cpp)
- include_directories(${MUSICBRAINZ5_INCLUDE_DIR})
-
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR (WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
set(enable_exceptions -EHsc)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@@ -60,8 +58,11 @@ target_link_libraries(kcddb
KF5::Codecs
KF5::I18n
KF5::KIOCore
- Qt5::Network
- ${MUSICBRAINZ5_LIBRARIES})
+ Qt5::Network)
+
+if(MUSICBRAINZ5_FOUND)
+ target_link_libraries(kcddb PRIVATE musicbrainz)
+endif()
generate_export_header(kcddb)