[CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake

David Cole dlrdave at aol.com
Fri Aug 1 08:11:18 EDT 2014


Sorry about the premature "send" on that last email...

First try this:

add_custom_command(
        TARGET ${TARGETNAME}
        POST_BUILD
          COMMAND ${TBIN}/VerCheck.exe \"$(TargetPath)\"
           COMMAND copy \"$(TargetPath)\"
\"$(TargetPath).vercheck_dummy_target\"
        COMMENT "Checking if $(TargetPath) has version info...")

i.e. -- just say "POST_BUILD" once, then a sequence of COMMAND lines.
(I think it's passing your second POST_BUILD as an argument to
VerCheck...)


If that still doesn't work, try:

add_custom_command(
        TARGET ${TARGETNAME}
        POST_BUILD
          COMMAND VerCheckAndCopy.bat "${TBIN}" "$(TargetPath)"
        COMMENT "Checking if $(TargetPath) has version info...")

and delegate it to a batch script that takes arguments which internally
does the sequence of commands you want. If you go this route, you may
still need nested quotes around "$(TargetPath)" -- CMake doesn't know
about expanding those VS values, and whether or not they'll need quotes
around them.

HTH,
David C.






More information about the CMake mailing list