CMake: Use target_link_directories

This commit is contained in:
Jonas Kvinge
2024-08-27 19:39:53 +02:00
parent 9883dc6925
commit 837e5388ea
9 changed files with 67 additions and 147 deletions

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.7)
cmake_minimum_required(VERSION 3.13)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
@@ -7,16 +7,6 @@ set(HEADERS tagreaderworker.h)
qt_wrap_cpp(MOC ${HEADERS})
link_directories(${GLIB_LIBRARY_DIRS})
if(HAVE_TAGLIB)
link_directories(${TAGLIB_LIBRARY_DIRS})
endif()
if(HAVE_TAGPARSER)
link_directories(${TAGPARSER_LIBRARY_DIRS})
endif()
add_executable(strawberry-tagreader ${SOURCES} ${MOC} ${QRC})
target_include_directories(strawberry-tagreader SYSTEM PRIVATE
@@ -31,6 +21,8 @@ target_include_directories(strawberry-tagreader PRIVATE
${CMAKE_BINARY_DIR}/src
)
target_link_directories(strawberry-tagreader PRIVATE ${GLIB_LIBRARY_DIRS})
target_link_libraries(strawberry-tagreader PRIVATE
${GLIB_LIBRARIES}
Qt${QT_VERSION_MAJOR}::Core
@@ -41,11 +33,13 @@ target_link_libraries(strawberry-tagreader PRIVATE
if(HAVE_TAGLIB)
target_include_directories(strawberry-tagreader SYSTEM PRIVATE ${TAGLIB_INCLUDE_DIRS})
target_link_directories(strawberry-tagreader PRIVATE ${TAGLIB_LIBRARY_DIRS})
target_link_libraries(strawberry-tagreader PRIVATE ${TAGLIB_LIBRARIES})
endif()
if(HAVE_TAGPARSER)
target_include_directories(strawberry-tagreader SYSTEM PRIVATE ${TAGPARSER_INCLUDE_DIRS})
target_link_directories(strawberry-tagreader PRIVATE ${TAGPARSER_LIBRARY_DIRS})
target_link_libraries(strawberry-tagreader PRIVATE ${TAGPARSER_LIBRARIES})
endif()