On 13. Sep, 2010, at 13:03 , David Aldrich wrote: > Hi Michael > >> set(SRCS a.c b.c d.c e.c) >> >> add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/f.c >> COMMAND ... >> DEPENDS ${SRCS} >> COMMENT "Generating f.c" >> VERBATIM) >> list(APPEND SRCS ${CMAKE_BINARY_DIR}/f.c) >> >> add_executable(main ${SRCS}) > > Thanks - that worked nicely. > > Now I have another problem. I need to link to the Python libraries. So I > specify: > > FIND_PACKAGE(PythonLibs REQUIRED) > INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) > > <snip> > > message (${PYTHON_LIBRARY}) > add_library( Kernel STATIC ${SRCS} ) > TARGET_LINK_LIBRARIES(Kernel ${PYTHON_LIBRARY}) > > The message shows: > > /usr/lib64/libpython2.4.so > > but this path does not appear in the link command so the build fails. > > I am trying to build a static library so am worried why ${PYTHON_LIBRARY} is > a shared library. > > By the way, is it normal CMake style to write CMAKE commands in upper or > lower case? > > Can you help with these questions please? > > BR > > David
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. HTH Michael -- There is always a well-known solution to every human problem -- neat, plausible, and wrong. H. L. Mencken
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