Skip to content

Commit

Permalink
CMake: Update linking, no more REQUIRED_LIBRARIES
Browse files Browse the repository at this point in the history
- All linking is done after target creation
- Use BOOL generator expressions for conditional linking
  • Loading branch information
ferdnyc committed Nov 4, 2019
1 parent 750677c commit c7ec690
Showing 1 changed file with 11 additions and 27 deletions.
38 changes: 11 additions & 27 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
$<$<BOOL:${ImageMagick_FOUND}>:${ImageMagick_LIBRARIES}>
$<$<BOOL:${RESVG_FOUND}>:${RESVG_LIBRARIES}>
$<$<BOOL:${BLACKMAGIC_FOUND}>:${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
Expand Down

0 comments on commit c7ec690

Please sign in to comment.