Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
Hi David, Executing the batch file from cmake function add_custom_command() in the COMMAND option is successful. But is there any mechanism in cmake in which we can specify the user-built executables OR project-specific executables directly from cmake function add_custom_command() in the COMMAND option ? Like, for example, if we want to execute something like this in cmake: add_custom_command( TARGET ${TARGETNAME} POST_BUILD COMMAND ${VERBIN}/TestVersion.exe \$(VersionPath)\ COMMENT Check if $(VersionPath) has version information...) Note that here ${VERBIN}/TestVersion.exe is a project specific executable. When we execute this in cmake, we get the following error: 'TestVer\TestVersion.exe' is not recognized as an internal or external command,operable program or batch file. So, please let us know if there is any way other than batch file for this ? 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: Ravi Raman Sent: Friday, August 01, 2014 8:01 PM To: 'David Cole' Cc: cmake@cmake.org Subject: RE: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake Hi David, Thanks. The 2nd approach of using batch file worked successfully. 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: David Cole [mailto:dlrd...@aol.com] Sent: Friday, August 01, 2014 5:41 PM To: Ravi Raman Cc: cmake@cmake.org Subject: Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake 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. -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
Hi David, We have a query regarding how to use MIDL related commands in cmake. In our project, many Visual Studio project files involve MIDL command execution. So, there are few Visual Studio targets which use MIDL related macros. For example, here is one such target: Target Name =GenTestMidlFile Condition ='$(LinkTimeMidl)'=='true' Inputs=@(Link) Outputs=$(IntDir)testmidl.rsp BeforeTargets=Link WriteLinesToFile File=$(IntDir)\testmidl.rsp Lines=%(Link.MidlCommandLine)/ ItemGroup FileWrites Include=$(IntDir)testmidl.rsp/ /ItemGroup /Target The above target creates an output file testmidl.rsp containing the MIDL command line as set in Link.MidlCommandLine which is a Visual Studio macro. So, in cmake we have taken the following approach: 1. We have added a PRE-LINK custom command using add_custom_command as follows: add_custom_command( TARGET ${TARGETNAME} PRE_LINK COMMAND ${CMAKE_SOURCE_DIR}/GenTestMidlFile.bat $(IntDir) \${MIDLCOMMAND}\ COMMENT Generate MIDL command file $(IntDir)/testmidl.rsp) 2. The batch file GenTestMidlFile.bat takes MIDLCOMMAND as one of the arguments. The MIDLCOMMAND argument will contain the MIDL command line value which will be set accordingly for each module that uses MIDL command, otherwise it will be empty. The batch file logic is to create the file testmidl.rsp to contain the contents present in MIDLCOMMAND argument. We have tested this and it works fine. Just wanted to know, if there is a better approach or anything specific for MIDL in cmake? 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: Ravi Raman Sent: Friday, August 01, 2014 8:01 PM To: 'David Cole' Cc: cmake@cmake.org Subject: RE: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake Hi David, Thanks. The 2nd approach of using batch file worked successfully. 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: David Cole [mailto:dlrd...@aol.com] Sent: Friday, August 01, 2014 5:41 PM To: Ravi Raman Cc: cmake@cmake.org Subject: Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake 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. -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
If it works, do it. Custom commands are the easiest way to do MIDL stuff driven by CMake if you need things to work with any generator. Alternatively, if you are guaranteed to be using Visual Studio generators, you can try just adding the idl file as a source file of the library or executable that contains it, as the VSMidl test does: [1] -- but it may only work with source/build tree names that contain no spaces depending on your VS version. The parent CMakeLists that builds it arranges for this to be the case: [2] HTH, David C. [1] http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/VSMidl/src/CMakeLists.txt;h=86c04ed9;hb=029edcdf [2] http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/VSMidl/CMakeLists.txt;h=432506c3;hb=029edcdf -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: Ravi Raman Sent: Thursday, July 31, 2014 5:07 PM To: 'David Cole' Cc: cmake@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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: David Cole [mailto:dlrd...@aol.com] Sent: Thursday, July 31, 2014 4:55 PM To: Ravi Raman Cc: cmake@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. -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
First try this: -Original Message- From: Ravi Raman ravi.ra...@xoriant.com To: David Cole dlrd...@aol.com Cc: cmake cmake@cmake.org Sent: Fri, Aug 1, 2014 7:49 am Subject: RE: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake 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\glob al\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\X oriantRepo\components\global\src\objectdbx\build\x64\versioninfo\Debug\Ge nVerInfo_d.exe\r [E:\RaviRaman\Project\AutoDesk\Source\AutoDesk_Project\autodesk_project\X oriantRepo\components\global\src\objectdbx\build\x64\versioninfo\GenVerIn fo.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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: Ravi Raman Sent: Thursday, July 31, 2014 5:07 PM To: 'David Cole' Cc: cmake@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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: David Cole [mailto:dlrd...@aol.com] Sent: Thursday, July 31, 2014 4:55 PM To: Ravi Raman Cc: cmake@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. -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
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. -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
Hi David, Thanks. The 2nd approach of using batch file worked successfully. 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: David Cole [mailto:dlrd...@aol.com] Sent: Friday, August 01, 2014 5:41 PM To: Ravi Raman Cc: cmake@cmake.org Subject: Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake 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. -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
Hi David, Thanks. Background of our project: In our project there are many modules. The existing build system is using Microsoft Visual Studio. Each module has a Microsoft Visual Studio project (.vcxproj) file and in some of the project files, Microsoft Visual Studio targets (.targets) file is included using the import statement. As an example, let us take a module with the name module1. It will have a Visual Studio project with the name module1.vcxproj. The file module1.vcxproj file will include the Microsoft Visual Studio targets file target1.targets as follows: Import Project=target1.targets / Attaching a sample target1.targets file for your reference. In that, there are many entries as follows (for each target) and there are certain steps that get executed within the Target block. Target Name=Target_1 /Target Requirement: The requirement is to convert the existing Microsoft Visual Studio built system to cmake built system. As per cmake requirement, we have created CMakeLists.txt file for module module1. Cmake does not understand or include .targets file directly. So, there is a need to put the equivalent logic of whatever steps are executed within the Target blocks in .targets file into the corresponding cmake statements in CMakeLists.txt file of module module1. So, is there any mechanism that cmake provides for doing that ? Are there any examples of such work being done in the past, which we can refer to ? 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: David Cole [mailto:dlrd...@aol.com] Sent: Wednesday, July 30, 2014 9:22 PM To: Ravi Raman Cc: cmake@cmake.org Subject: Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake To the best of my knowledge, CMake does not do anything with .targets files. It doesn't know what they are, and it doesn't generate any of them... What is the function of the .targets files in your non-CMake build system? Perhaps somebody else who is more familiar with .targets files is listening and can chime in. I'm not sure what to recommend for you. add_custom_target and add_custom_command are commands you can use to organize and execute custom build steps (as opposed to compiling source files as part of an add_library or add_executable) Maybe with the build system you can generate using CMake, you won't even need the .targets files anymore. If you do need them, I'd be curious to learn what it is your .targets file do and why you still need them. HTH, David C. target1.targets Description: target1.targets -- 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
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. -- 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
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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: David Cole [mailto:dlrd...@aol.com] Sent: Thursday, July 31, 2014 4:55 PM To: Ravi Raman Cc: cmake@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. -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
The problem as reported, is that you're trying to use add_custom_target with a target named test -- but you can't do that with CMake because test is a built-in well-known predefined target name. Other so-called well-known target names include all install package and package_source. And there may be others. If I can find a definitive documented list, I'll forward it... You can use any other name you like, but you should avoid the pre-defined target names that CMake already uses. HTH, David C. -Original Message- From: Ravi Raman ravi.ra...@xoriant.com To: cmake cmake@cmake.org Sent: Wed, Jul 30, 2014 12:35 am Subject: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake Hi all, We have reported an issue. It is regarding conversion of existing Visual Studio .targets files to cmake. The link for the reported issues is as follows. http://www.cmake.org/Bug/view.php?id=15044 Kindly let us know if this can be done in cmake. 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -- 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 -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
Hi David, Thanks for the response. Sorry to use the cmake pre-defined word test. My actual query was not this. I just used test as an example without realizing that it is actually a cmake pre-defined word. So, my actual query is as follows (2 points below): 1. In Microsoft Visual Studio project file module1.vcxproj, the targets file (target1.targets) gets included as follows: Import Project=module1.targets / In target1.targets, there are multiple entries of various targets as follows: Target Name=Target_1 .. /Target Target Name=Target_2 .. /Target To achieve the same thing in cmake, in the CMakeLists.txt file of module “module1” we are using the following command: add_custom_target() with the appropriate target names for the above i.e. we make 2 calls to add_custom_target() with target names Target_1 and Target_2 Is this the correct way to convert Visual Studio .targets file to cmake OR is there any other way ? 2. Also, if we take the above approach then for each call to add_custom_target(), a Visual Studio project file gets created under the module module1. So, in this case there will be 2 vcxproject files created i.e. Target_1.vcxproj and Target_2.vcxproj created for module module1. Please confirm if this is the expected behavior in cmake. 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: David Cole [mailto:dlrd...@aol.com] Sent: Wednesday, July 30, 2014 3:37 PM To: Ravi Raman; cmake@cmake.org Subject: Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake The problem as reported, is that you're trying to use add_custom_target with a target named test -- but you can't do that with CMake because test is a built-in well-known predefined target name. Other so-called well-known target names include all install package and package_source. And there may be others. If I can find a definitive documented list, I'll forward it... You can use any other name you like, but you should avoid the pre-defined target names that CMake already uses. HTH, David C. -Original Message- From: Ravi Raman ravi.ra...@xoriant.com To: cmake cmake@cmake.org Sent: Wed, Jul 30, 2014 12:35 am Subject: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake Hi all, We have reported an issue. It is regarding conversion of existing Visual Studio .targets files to cmake. The link for the reported issues is as follows. http://www.cmake.org/Bug/view.php?id=15044 Kindly let us know if this can be done in cmake. 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -- 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 -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
Hi David, Note that the targets file name is target1.targets. So, please read it as Import Project=target1.targets / 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 3051 ravi.ra...@xoriant.commailto:ram.si...@xoriant.com| http://www.xoriant.comhttp://www.xoriant.com/ From: Ravi Raman Sent: Wednesday, July 30, 2014 4:06 PM To: 'David Cole' Cc: cmake@cmake.org Subject: RE: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake Hi David, Thanks for the response. Sorry to use the cmake pre-defined word test. My actual query was not this. I just used test as an example without realizing that it is actually a cmake pre-defined word. So, my actual query is as follows (2 points below): 1. In Microsoft Visual Studio project file module1.vcxproj, the targets file (target1.targets) gets included as follows: Import Project=module1.targets / In target1.targets, there are multiple entries of various targets as follows: Target Name=Target_1 .. /Target Target Name=Target_2 .. /Target To achieve the same thing in cmake, in the CMakeLists.txt file of module “module1” we are using the following command: add_custom_target() with the appropriate target names for the above i.e. we make 2 calls to add_custom_target() with target names Target_1 and Target_2 Is this the correct way to convert Visual Studio .targets file to cmake OR is there any other way ? 2. Also, if we take the above approach then for each call to add_custom_target(), a Visual Studio project file gets created under the module module1. So, in this case there will be 2 vcxproject files created i.e. Target_1.vcxproj and Target_2.vcxproj created for module module1. Please confirm if this is the expected behavior in cmake. 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: David Cole [mailto:dlrd...@aol.com] Sent: Wednesday, July 30, 2014 3:37 PM To: Ravi Raman; cmake@cmake.org Subject: Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake The problem as reported, is that you're trying to use add_custom_target with a target named test -- but you can't do that with CMake because test is a built-in well-known predefined target name. Other so-called well-known target names include all install package and package_source. And there may be others. If I can find a definitive documented list, I'll forward it... You can use any other name you like, but you should avoid the pre-defined target names that CMake already uses. HTH, David C. -Original Message- From: Ravi Raman ravi.ra...@xoriant.com To: cmake cmake@cmake.org Sent: Wed, Jul 30, 2014 12:35 am Subject: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake Hi all, We have reported an issue. It is regarding conversion of existing Visual Studio .targets files to cmake. The link for the reported issues is as follows. http://www.cmake.org/Bug/view.php?id=15044 Kindly let us know if this can be done in cmake. 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -- 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 -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
Hi David, Can you refer to the query in the mails below (2 points are mentioned). Please let us know your comments when you get time. 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 3051 ravi.ra...@xoriant.commailto:ram.si...@xoriant.com| http://www.xoriant.comhttp://www.xoriant.com/ From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Ravi Raman Sent: Wednesday, July 30, 2014 4:13 PM To: David Cole Cc: cmake@cmake.org Subject: Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake Hi David, Note that the targets file name is target1.targets. So, please read it as Import Project=target1.targets / 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 3051 ravi.ra...@xoriant.commailto:ram.si...@xoriant.com| http://www.xoriant.comhttp://www.xoriant.com/ From: Ravi Raman Sent: Wednesday, July 30, 2014 4:06 PM To: 'David Cole' Cc: cmake@cmake.org Subject: RE: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake Hi David, Thanks for the response. Sorry to use the cmake pre-defined word test. My actual query was not this. I just used test as an example without realizing that it is actually a cmake pre-defined word. So, my actual query is as follows (2 points below): 1. In Microsoft Visual Studio project file module1.vcxproj, the targets file (target1.targets) gets included as follows: Import Project=module1.targets / In target1.targets, there are multiple entries of various targets as follows: Target Name=Target_1 .. /Target Target Name=Target_2 .. /Target To achieve the same thing in cmake, in the CMakeLists.txt file of module “module1” we are using the following command: add_custom_target() with the appropriate target names for the above i.e. we make 2 calls to add_custom_target() with target names Target_1 and Target_2 Is this the correct way to convert Visual Studio .targets file to cmake OR is there any other way ? 2. Also, if we take the above approach then for each call to add_custom_target(), a Visual Studio project file gets created under the module module1. So, in this case there will be 2 vcxproject files created i.e. Target_1.vcxproj and Target_2.vcxproj created for module module1. Please confirm if this is the expected behavior in cmake. 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -Original Message- From: David Cole [mailto:dlrd...@aol.com] Sent: Wednesday, July 30, 2014 3:37 PM To: Ravi Raman; cmake@cmake.org Subject: Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake The problem as reported, is that you're trying to use add_custom_target with a target named test -- but you can't do that with CMake because test is a built-in well-known predefined target name. Other so-called well-known target names include all install package and package_source. And there may be others. If I can find a definitive documented list, I'll forward it... You can use any other name you like, but you should avoid the pre-defined target names that CMake already uses. HTH, David C. -Original Message- From: Ravi Raman ravi.ra...@xoriant.com To: cmake cmake@cmake.org Sent: Wed, Jul 30, 2014 12:35 am Subject: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake Hi all, We have reported an issue. It is regarding conversion of existing Visual Studio .targets files to cmake. The link for the reported issues is as follows. http://www.cmake.org/Bug/view.php?id=15044 Kindly let us know if this can be done in cmake. 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 3051 ravi.ra...@xoriant.com| http://www.xoriant.com -- 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
Re: [CMake] Cmake issue regarding conversion of existing Visual Studio .targets files to cmake
To the best of my knowledge, CMake does not do anything with .targets files. It doesn't know what they are, and it doesn't generate any of them... What is the function of the .targets files in your non-CMake build system? Perhaps somebody else who is more familiar with .targets files is listening and can chime in. I'm not sure what to recommend for you. add_custom_target and add_custom_command are commands you can use to organize and execute custom build steps (as opposed to compiling source files as part of an add_library or add_executable) Maybe with the build system you can generate using CMake, you won't even need the .targets files anymore. If you do need them, I'd be curious to learn what it is your .targets file do and why you still need them. HTH, David C. -- 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