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

Ravi Raman ravi.raman at Xoriant.Com
Fri Aug 1 07:50:57 EDT 2014


Hi David,

We are executing the following POST_BUILD commands using add_custom_command() call in cmake.

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

The issue we are facing is with the execution of the post-build command ${TBIN}/VerCheck.exe \"$(TargetPath)\". It gives the following error:

  C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(134,5): error MSB3073: The command "setlocal\r [E:\RaviRaman\Project\Auto
Desk\Source\AutoDesk_Project\autodesk_project\XoriantRepo\components\global\src\objectdbx\build\x64\versioninfo\GenVerInfo.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(134,5): error MSB3073: ..\..\..\..\..\..\..\develop\tools\bin\VerCheck.exe
"E:\RaviRaman\Project\AutoDesk\Source\AutoDesk_Project\autodesk_project\XoriantRepo\components\global\src\objectdbx\build\x64\versioninfo\Debug\GenVerInfo_d.exe"\r [E:\RaviRaman\Project\AutoDesk\Source\AutoDesk_Project\autodesk_project\XoriantRepo\components\global\src\objectdbx\build\x64\versioninfo\GenVerInfo.vcxproj]

Also, note the following:
1. The execution is successful and there is no error when I keep only the copy command and comment out the command ${TBIN}/VerCheck.exe \"$(TargetPath)\"
2. VerCheck.exe is a project specific executable which checks the version of the specified target
3. All the variables above in ${...} are getting correctly replaced. So, that is not an issue.
4. We are able to execute both the commands ${TBIN}/VerCheck.exe and copy successfully from the DOS command line.


Thanks & Regards

Ravi Raman
Xoriant Solutions Pvt. Ltd
4th Floor, Winchester, Hiranandani Business Park, Powai, Mumbai 400076, INDIA.
Tel: +91 22 30511000,9930100026 Extn: 2144 Voip No. 4088344495/96/97/98 Voip Extn:1178| Fax: +91 22 30511111
ravi.raman at xoriant.com| http://www.xoriant.com


-----Original Message-----
From: Ravi Raman
Sent: Thursday, July 31, 2014 5:07 PM
To: 'David Cole'
Cc: cmake at cmake.org
Subject: RE: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake

Hi David,

Thanks for the reply. Understood.
Will use the cmake function add_custom_command() with POST_BUILD option in case of after build and PRE_BUILD option in case of before build.

Thanks & Regards

Ravi Raman
Xoriant Solutions Pvt. Ltd
4th Floor, Winchester, Hiranandani Business Park, Powai, Mumbai 400076, INDIA.
Tel: +91 22 30511000,9930100026 Extn: 2144 Voip No. 4088344495/96/97/98 Voip Extn:1178| Fax: +91 22 30511111
ravi.raman at xoriant.com| http://www.xoriant.com


-----Original Message-----
From: David Cole [mailto:dlrdave at aol.com]
Sent: Thursday, July 31, 2014 4:55 PM
To: Ravi Raman
Cc: cmake at cmake.org
Subject: Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake

So from the example you've sent, it seems like the stuff in your
targets file is just a bunch of custom commands that you'd need to run.
There are plenty of examples of projects using add_custom_command and
add_custom_target out there, and if you have specific questions about
how those commands work, do send more emails and ask those questions.

I don't think there's anything out there that will help you automate
this task.... but if there is, hopefully somebody who can point you to
them will show up here.

Otherwise, it's just "roll up your sleeves" time, and do the work
manually to convert targets files into CMakeLists that use
add_custom_command.


Cheers,
David C.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140801/499bce2c/attachment-0001.html>


More information about the CMake mailing list