[CMake] Question about add_custom_command
David Aldrich
David.Aldrich at EU.NEC.COM
Mon Sep 13 08:57:36 EDT 2010
Hi Michael
> You never link static libraries. They are more like zip files than actual
> libraries and just contain the compiled object files and for if you ran
> ranlib on it, also a "table-of-contents" to speed link up.
>
> If you do "target_link_libraries" in CMake, where the target is a static
> library, CMake just creates the static library archive and remembers
> internally the transitive link dependency. If you linked that static
> archive into an executable, the python libraries would then show up on the
> command line.
Now I am confused (more than before!) because linking my Kernel library does give errors related to Python:
Linking CXX executable main
CMakeFiles/main.dir/Kernel.cpp.o: In function `__static_initialization_and_destruction_0(int, int)':
Kernel.cpp:(.text+0x101): undefined reference to `_Py_NoneStruct'
Kernel.cpp:(.text+0x10d): undefined reference to `_Py_NoneStruct'
The make file is evidently building an executable even though I have only specified:
add_library( Kernel STATIC ${SRCS} )
I can see from make VERBOSE=1, that it is trying to link main.exe instead of calling 'ar' to build libKernel.a.
Can you give me some more help on this please?
David
More information about the CMake
mailing list