[CMake] external tools in visual studio

Eric Noulard eric.noulard at gmail.com
Thu Sep 17 12:51:04 EDT 2009


2009/9/17  <th.tom at gmx.de>:
> Hi,
>
> I may haven't used the right keywords on google, as I believe this is asked many times befor:
>
> I have a multiplatform project that uses external tools (yacc/bison/lex/flex).
>
> I don`t have any problems under linux/solaris etc. but I really had a bad time trying to make this work under windows visual studio 2003.
>
> I am searching for bison and flex and these tools are found and are used. However, bison uses an additional tool "m4" this one is not found (as it is internally called, and there is no path set to this):
>
> YACC started with command  C:/Programme/GnuWin32/bin/bison.exe
> C:\Programme\GnuWin32\bin\bison.exe: m4: No such file or directory
>
> m4 is installed in the same directory (C:/Programme/GnuWin32/bin) as bison and flex.

We use CMake + Flex/Bison for our project
https://savannah.nongnu.org/projects/certi
(install doc is here: http://www.nongnu.org/certi/certi_doc/index.html
 but there is not much to discover)

We  did face the same "m4 not found" trouble and it has
been "fixed" by putting
C:/Programme/GnuWin32/bin
in the system PATH and restart (at least) Visual Studio.

> Setting the environment path does not help
> (as visual studio does not care for these settings).

That's true the culprit here is bison.exe which assume m4.exe is in the path.

our (primitive) FindLexYacc.cmake is here:
http://cvs.savannah.gnu.org/viewvc/certi/scripts/FindLexYacc.cmake?root=certi&view=markup

the CUSTOM command and others concerning Lex/Yacc handling may
be found in the following CMakeLists.txt
http://cvs.savannah.gnu.org/viewvc/certi/libCERTI/CMakeLists.txt?root=certi&view=markup

those 2 are not what I would call "pure academic" examples but they do work
for us on several Windows box (200x, XP, Vista, ...) with different IDEs
(Visual, Code::Blocks, ...)

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list