On 13. Sep, 2010, at 14:57 , David Aldrich wrote:

> 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

Can you show above link command with "make VERBOSE=1"? I assume you do 
something like this?

find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})

add_library(Kernel STATIC a.c b.c d.c)
target_link_libraries(Kernel ${PYTHON_LIBRARIES})

add_executable(main main.c)
target_link_libraries(main Kernel)


Michael

--
There is always a well-known solution to every human problem -- neat, 
plausible, and wrong.
H. L. Mencken

Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to