Improve Windows link library dependency

Fixes an error when building with CMAKE_LINK_LIBRARIES_ONLY_TARGETS enabled.
This commit is contained in:
Frederik Seiffert 2023-09-11 16:39:04 +02:00
parent 14e9d14675
commit aed93910db

View File

@ -38,7 +38,9 @@ endif()
target_link_libraries(${PROJECT_NAME} PUBLIC ${QT_LIBRARIES})
if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE advapi32)
find_library(advapi32_LIBRARY advapi32 REQUIRED)
mark_as_advanced(advapi32_LIBRARY)
target_link_libraries(${PROJECT_NAME} PRIVATE ${advapi32_LIBRARY})
endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC QAPPLICATION_CLASS=${QAPPLICATION_CLASS})