Yashwant kumar
Yashwant kumar

Reputation: 119

Adding a list of libraries in cmake

I have a list of libraries that I an trying to add to target_link_libraries(). Is it possible?

 set(list1 x.a y.a z.a)
 target_link_libraries(main ${list1})

Is it a right way to do it?

Upvotes: 0

Views: 233

Answers (1)

Matthieu Brucher
Matthieu Brucher

Reputation: 22043

Yes, that's the usual way to do this.

To be more precise, usually the list is set by first using find_library to get the x.a location first, and then putting them in a list.

Upvotes: 2

Related Questions