[CMake] Portable way to locate built executables.

Leif Walsh leif.walsh at gmail.com
Sun May 18 13:40:26 EDT 2014


You can also use a generator I think: $<TARGET_FILE:rexximage>-- 
Cheers,
Leif

On Sun, May 18, 2014 at 1:39 PM, Nils Gladitz <nilsgladitz at gmail.com>
wrote:

> On 18.05.2014 19:24, Rick McGuire wrote:
>> We have a project that builds some executables, then uses those 
>> executables to build some additional build artifacts.  We have this 
>> working well using makefiles on Windows and various unix variants.  I 
>> decided it would be nice to try doing a build using a Visual Studio 
>> project.  The various compile/link steps worked great, but any step 
>> that needed to use one of the built executables was failing to find 
>> the executables.  An examination of the build tree revealed that 
>> Visual Studio was placing the executables in bin\Debug rather than the 
>> expected bin directory.
>>
>> The command we're using is specified as:
>>
>> add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rexx.img
>>             COMMAND ./rexximage
>>             DEPENDS rexximage rxapi rexxutil ${image_class_files} ${platform_rexx_img_depends}
>>             WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
>> where we're assuming the rexximage.exe file will be in the CMAKE_RUNTIME_OUTPUT_DIRECTORY, which is specified as ${CMAKE_CURRENT_BINARY_DIR}/bin.  Is there a more appropriate method we should be doing to locate this executable that will work using both the NMake build process and a Visual Studio project?
> Try "COMMAND rexximage".
> If "rexximage" is an executable target (as created by add_executable()) 
> add_custom_command() will substitute the actual command.
> Nils
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140518/4521fd80/attachment.html>


More information about the CMake mailing list