[CMake] Compiling static and shared library only once (wiki seems to have an error)
Shaun Cummins
cumminss at gmail.com
Thu Apr 16 20:19:47 EDT 2009
I'm trying to compile both static and shared libraries and would like
to do it only once. I tried following the instructions at the
vtk.org/Wiki but it seems to have an error:
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
ADD_LIBRARY(zzSTATIC STATIC -fPIC)
ADD_LIBRARY(zzDYNAMIC SHARED)
TARGET_LINK_LIBRARIES(zzDYNAMIC -Wl,-whole-archive zzSTATIC
-Wl,-no-whole-archive)
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
The 'ADD_LIBRARY(zzSTATIC STATIC -fPIC)' doesn't seem correct to me
(since according to the documentation you can't add compile flags
there and it's also missing a list of source files). In addition I
haven't figured out how to set the compile flags specifically for that
library.
Is it possible to see the actual gcc/g++ commands that cmake uses? I
can't find a log of them anywhere.
Thanks,
Shaun
More information about the CMake
mailing list