Hello,
I have a small script that helps to generate parts of a Qt class. I then call
it from a CMake file, using a couple custom commands in a function:
add_custom_command(OUTPUT "${gen_f}"
COMMAND ${MKPROP_EXECUTABLE}
ARGS gen "${header_in}" "${gen_f}"
DEPENDS "${heaer_in}"
)
add_custom_command(OUTPUT "${header_out}"
COMMAND ${MKPROP_EXECUTABLE}
ARGS replace "${header_in}" "${header_out}"
DEPENDS "${gen_f}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
add_custom_command(OUTPUT "${source_out}"
COMMAND cp
ARGS "${source_in}" "${source_out}"
DEPENDS "${source_in}" "${header_out}"
)
I then add ${source_out} to the list of source files for the program
(${weather-desktop_SRCS})
The reason I copy the source file to the build dir is because moc apparently
doesn't search the include path, and so I have to have the source file in the
same dir as the generated header.
I then build the application using
kde4_add_executable(weather-desktop ${weather-desktop_SRCS})
Here is the part that doesn't work. Although the the custom commands are called
and work great, moc doesn't get called on the resulting files. However, if I
generate the files by hand, and than manually add the copied source file to the
list of sources, moc does get called. The list of source files is identical
regardless of whether I add the file by hand or it gets added as a result of
the custom commands. It's just the moc doesn't get called if the file is
produced as a result of a custom command.
I am doing the custom commands wrong? How do I fix this so moc is called on the
output of my custom commands?
Thank you,
Michael Spencer
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<