[CMake] find_program(), how to handle executable suffix in a cross compilation environment?

Thomas Törnblom thomas.tornblom at iar.com
Mon Apr 15 07:51:54 EDT 2019


What is the proper way to handle the case where find_program() needs 
match "program-name" or "program-name.exe" depending on wether the host 
system is running a unix like OS or Windows?

A project I'm looking at uses CMAKE_EXECUTABLE_SUFFIX for the target, so 
I assume that can't be used.

A simple solution is to list both variants, but it adds clutter if the 
path contains variables and I'd like to know how others solve this.

/Thomas

-- 

*Thomas Törnblom*, /Product Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
Mobile: +46 76 180 17 80 Fax: +46 18 16 78 01
E-mail: thomas.tornblom at iar.com <mailto:thomas.tornblom at iar.com> 
Website: www.iar.com <http://www.iar.com>
Twitter: www.twitter.com/iarsystems <http://www.twitter.com/iarsystems>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190415/4f59c1eb/attachment-0001.html>


More information about the CMake mailing list