On 3/28/2019 4:12 PM, Kyle Edwards wrote:
One more thing: if you want the custom target to be built by "make" or
"make all", you have to give it the ALL argument:
add_custom_target(mygeneratedtarget ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mygeneratedfile
)
Otherwise you can build the target with "make mygeneratedtarget".
OK! That does make a difference. I had focused on the add_custom_target
documentation that indicated the rule was always considered out of date,
and jumped to the conclusion that that meant it was always run.
Thank you for sorting that out!
What I find surprising is that 'make install' could not identify how to
create mygeneratedfile. Is there some reason why 'mygeneratedfile'
cannot be a target in its own right with needing to refer to this phony
target to achieve the desired result?
Related to that, I noticed in another thread the mention of
'CMAKE_SKIP_INSTALL_ALL_DEPENDENCY'. If that were set in this case, how
could I indicate that install depends on mygeneratedtarget? (Admittedly,
I'm having a hard time coming up with a case where this would apply, but
I'm having trouble with the tenuous connection between the instruction
to install mygeneratedfile and the rule that actually generates it.)
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake