0

I have the following CMake projects:

testexe: which depends on shared library testlib

testlib: shared library which uses a third party DLL, say test3rd.lib

After generating the solution, I found that everything was fine except testexe requires test3rd.lib as well as testlib, but my test should only depend on testlib.

What is the reason for this extra dependency?

Fraser
  • 74,704
  • 20
  • 238
  • 215
Adam Lee
  • 24,710
  • 51
  • 156
  • 236

1 Answers1

0

You could link test3rd.lib as a PRIVATE dependency of testlib, PUBLIC is default.

target_link_libraries(testlib PRIVATE test3rd.lib)

Reference

maxint
  • 1,005
  • 8
  • 12