DEV Community

Raviola
Raviola

Posted on

Cascade static library link mechanism

Hey C++ people, can anyone help answering this SO question?

cascade static library link mechanism

1

sdl2-image was built and installed as a static library libSDL2_image.a, it dependons on another static librarys, like webp, libpng, etc. When I link it like:

add_executable(main main.cpp)
target_link_libraries(main
  SDL2::SDL2-static
  ${SDL2_IMAGE_LIBRARY}
)

It fails, showing error:

[ 50%] Linking CXX executable main
/usr/local/Cellar/cmake/3.11.1/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/c++   -Wl,-search_paths_first -Wl,-headerpad_max_install_names

Discussion (0)