Hi there,
I'm having major woes trying to add a file dependency to a library, and
was wondering if anyone can point me in the right direction.
I have a library which depends upon an external object file, produced by
a process outside of cmake. I've created a custom target to fire that
process off, which makes an object file, but I can't get the library to
rebuild its target when that external object changes.
What I'm trying to do is this:
# Create the foo library target.
ADD_LIBRARY(foo test.cpp)
# Add rules to build the external object file
SET(OUTFILE "${CMAKE_BINARY_DIR}/ext.obj")
ADD_CUSTOM_TARGET(foo.external COMMAND doit.bat
${OUTFILE})
# Make the library actually depend upon the external
object file:
ADD_DEPENDENCIES(foo foo.external)
# Make this library depend upon the external target so
that it gets built.
GET_TARGET_PROPERTY(LIBFILE foo ${CMAKE_BUILD_TYPE}_LOCATION)
SET_SOURCE_FILES_PROPERTIES(${LIBFILE} PROPERTIES OBJECT_DEPENDS
${OUTFILE})
However this doesn't force a relink of foo.lib when ${OUTFILE} changes.
How do I go about doing that?
Many thanks,
Joe
p.s. I know that this example also doesn't link ${OUTFILE} into foo.lib
- my actual example is more complicated than this, using a customer
linker_language to run my own linker command using
CMAKE_mylinklanguage_CREATE_STATIC_LIBRARY, but that doesn't change the
essence of the question.
p.s.
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake