From
http://www.cmake.org/cmake/help/v3.0/command/add_custom_command.html :
"If COMMAND specifies an executable target (created by ADD_EXECUTABLE)
it will automatically be replaced by the location of the executable
created at build time. Additionally a target-level dependency will be
added so that the executable target will be built before any target
using this custom command. However this does NOT add a file-level
dependency that would cause the custom command to re-run whenever the
executable is recompiled."
So... if TestVersion.exe is created as a result of an
"add_executable(TestVersion ..." call, then you should be able to use
add_custom_command(
TARGET ${TARGETNAME}
POST_BUILD
COMMAND TestVersion \"$(VersionPath)\"
COMMENT "Check if $(VersionPath) has version information...")
If you must pass the full path to TestVersion as an argument to a batch
file, you should be able to use
$<TARGET_FILE:TestVersion>
(again, assuming TestVersion is the name of your add_executable target)
By the way, the error message "'TestVer\TestVersion.exe' is not
recognized ..." is probably happening because the working directory is
not set correctly relative to the name "TestVer\TestVersion.exe" - a
simple pushd/popd combination to the correct directory in the batch
file may solve this.
HTH,
David
--
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:
http://public.kitware.com/mailman/listinfo/cmake