I am trying to use ExternalProject_add() to download/install dependencies. It installs fine, but I can\'t figure out how to actually link the libraries after they are downlo
You can use the link_directories command to link libraries within a specific directory. In your case the directory were your external project is build.
ExternalProject_Add(MyExternalLibrary ...)
Add the output directory to the search path:
link_directories(${CMAKE_BINARY_DIR}/lib/MyExternalLibrary-prefix/lib)
Make sure to add the executable after specifying the link directory:
add_executable(MyProgram main.c)
Specify the libraries your project should be linked to:
target_link_libraries(MyProgram ExternalLibraryName)
Don't forget to depend on the external project:
add_dependencies(MyProgram MyExternalLibrary)