Barth
Barth

Reputation: 15715

How to build a shared and a static library without recompiling the sources with CMake

I want to build both a static and shared version of the same library as described here. However, the sources are compiled twice, one for each version which is not necessary. Any ways of avoiding this ?

Upvotes: 1

Views: 592

Answers (1)

Fred Foo
Fred Foo

Reputation: 363587

Depends on the platform. On Linux at least, you need to use different compiler flags to produce position-independent (shared library) than ordinary (program or static library) code.

Upvotes: 2

Related Questions