Author: akhaldi
Date: Thu Aug 27 23:00:49 2015
New Revision: 68840
URL:
http://svn.reactos.org/svn/reactos?rev=68840&view=rev
Log:
[CMAKE] Introduce a way to use auto generation using bison and flex. Dedicated to Eric
Kohl. CORE-10055
Added:
trunk/reactos/cmake/bison-flex.cmake (with props)
Modified:
trunk/reactos/CMakeLists.txt
Modified: trunk/reactos/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/CMakeLists.txt?rev=68840&a…
==============================================================================
--- trunk/reactos/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/CMakeLists.txt [iso-8859-1] Thu Aug 27 23:00:49 2015
@@ -74,6 +74,9 @@
if(NOT MSVC_IDE)
unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
endif()
+
+# Bison and Flex support
+# include(cmake/bison-flex.cmake)
if(NOT CMAKE_CROSSCOMPILING)
Added: trunk/reactos/cmake/bison-flex.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/bison-flex.cmake?rev…
==============================================================================
--- trunk/reactos/cmake/bison-flex.cmake (added)
+++ trunk/reactos/cmake/bison-flex.cmake [iso-8859-1] Thu Aug 27 23:00:49 2015
@@ -0,0 +1,27 @@
+
+# Simply use :
+# add_bison_files(foo.y)
+# and
+# add_flex_files(foo.l)
+# then add ${CMAKE_CURRENT_BINARY_DIR}/foo.tab.c
+# and ${CMAKE_CURRENT_BINARY_DIR}/foo.yy.c to the source list
+
+function(add_bison_files)
+ foreach(_file ${ARGN})
+ get_filename_component(_name ${_file} NAME_WE)
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_name}.tab.c
${CMAKE_CURRENT_BINARY_DIR}/${_name}.tab.h
+ COMMAND bison -p ${_name}_ -o ${CMAKE_CURRENT_BINARY_DIR}/${_name}.tab.c
--defines=${CMAKE_CURRENT_BINARY_DIR}/${_name}.tab.h ${CMAKE_CURRENT_SOURCE_DIR}/${_file}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
+ endforeach()
+endfunction()
+
+function(add_flex_files)
+ foreach(_file ${ARGN})
+ get_filename_component(_name ${_file} NAME_WE)
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_name}.yy.c
${CMAKE_CURRENT_BINARY_DIR}/${_name}.yy.h
+ COMMAND flex -o ${CMAKE_CURRENT_BINARY_DIR}/${_name}.yy.c
--header-file=${CMAKE_CURRENT_BINARY_DIR}/${_name}.yy.h
${CMAKE_CURRENT_SOURCE_DIR}/${_file}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
+ endforeach()
+endfunction()
Propchange: trunk/reactos/cmake/bison-flex.cmake
------------------------------------------------------------------------------
svn:eol-style = native