From c7ec690c55c32fa9f7e1480c12dcee3dea17af44 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Mon, 4 Nov 2019 04:13:44 -0500 Subject: [PATCH] CMake: Update linking, no more REQUIRED_LIBRARIES - All linking is done after target creation - Use BOOL generator expressions for conditional linking --- src/CMakeLists.txt | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3c16d223c..efa9f16bd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -367,34 +367,18 @@ endif() ############### LINK LIBRARY ################# -SET ( REQUIRED_LIBRARIES - ${LIBOPENSHOT_AUDIO_LIBRARIES} - ${PROFILER} - ) - -IF (RESVG_FOUND) - list(APPEND REQUIRED_LIBRARIES ${RESVG_LIBRARIES}) -ENDIF(RESVG_FOUND) - - -IF (ImageMagick_FOUND) - list(APPEND REQUIRED_LIBRARIES ${ImageMagick_LIBRARIES}) -ENDIF (ImageMagick_FOUND) - -IF (BLACKMAGIC_FOUND) - list(APPEND REQUIRED_LIBRARIES ${BLACKMAGIC_LIBRARY_DIR}) -ENDIF (BLACKMAGIC_FOUND) - -IF (WIN32) +# Link remaining dependency libraries +target_link_libraries(openshot PUBLIC + ${LIBOPENSHOT_AUDIO_LIBRARIES} + ${PROFILER} + $<$:${ImageMagick_LIBRARIES}> + $<$:${RESVG_LIBRARIES}> + $<$:${BLACKMAGIC_LIBRARY_DIR}>) + +if(WIN32) # Required for exception handling on Windows - list(APPEND REQUIRED_LIBRARIES "imagehlp" "dbghelp" ) -ENDIF(WIN32) - -# Link all referenced libraries -target_link_libraries(openshot PUBLIC ${REQUIRED_LIBRARIES}) - -# Pick up parameters from OpenMP target and propagate -target_link_libraries(openshot PUBLIC OpenMP::OpenMP_CXX) + target_link_libraries(openshot PUBLIC "imagehlp" "dbghelp" ) +endif() ############### CLI EXECUTABLES ################ # Create test executable