I want to build both a static and shared version of the same library as described Is it possible to get CMake to build both a static and shared version of the same library?
However, the sources are compiled twice, one for each version which is not necessary. Is there any way to avoid this?
Currently I have:
add_library(${LIB} SHARED ${${LIB}_srcs})
add_library(${LIB}_static STATIC ${${LIB}_srcs})
What do I need to change in order to only need to compile once? FYI. I have the same compiler flags and defines.