[CMake] Custom Command OUTPUTs to understand geenrator expressions?
Chris Green
greenc at fnal.gov
Wed Nov 1 18:35:40 EDT 2017
Hi,
I have a case where a custom command produces multiple outputs, at least
some of which depend on a property of a library target, viz:
if (BD_WANT_PCM)
set(PCM_OUTPUT
$<TARGET_PROPERTY:${dictname}_dict,LIBRARY_OUTPUT_DIRECTORY>/${CMAKE_SHARED_LIBRARY_PREFIX}${dictname}_dict_rdict.pcm)
if (GD_PCM_OUTPUT_VAR)
set(${GD_PCM_OUTPUT_VAR} ${PCM_OUTPUT} PARENT_SCOPE)
endif()
endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${dictname}_dict.cpp
# Extra outputs commented out until custom_command OUTPUT supports
# generator flags.
${SOURCE_OUTPUT} # ${GD_ROOTMAP_OUTPUT} ${PCM_OUTPUT}
...
Here, ${PCM_OUTPUT} needs to be specified to be put in the same
directory as the library produced for the target ${dictname}_dict, which
may be something particular to that target rather than its defaulted
value of ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} or ${LIBRARY_OUTPUT_PATH}.
Unfortunately, this fails to work as of CMake 3.9.2. Is this something
which is reasonable to want and/or easy to do. Is there some other way
to have the desired flexibility?
Thanks for any help,
Chris.
More information about the CMake
mailing list