forked from hauke/wireshark
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFindYACC.cmake
46 lines (38 loc) · 973 Bytes
/
FindYACC.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#
# - Find bison/yacc executable
#
INCLUDE(FindCygwin)
INCLUDE(FindChocolatey)
FIND_PROGRAM(YACC_EXECUTABLE
NAMES
bison
win_bison
yacc
PATHS
${CHOCOLATEY_BIN_PATH}/bin
${CYGWIN_INSTALL_PATH}/bin
/bin
/usr/bin
/usr/local/bin
/sbin
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(YACC DEFAULT_MSG YACC_EXECUTABLE)
MARK_AS_ADVANCED(YACC_EXECUTABLE)
MACRO(ADD_YACC_FILES _sources )
FOREACH (_current_FILE ${ARGN})
GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)
SET(_out ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.c)
ADD_CUSTOM_COMMAND(
OUTPUT ${_out}
COMMAND ${YACC_EXECUTABLE}
-d
-p ${_basename}
-o${_out}
${_in}
DEPENDS ${_in}
)
SET(${_sources} ${${_sources}} ${_out} )
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_YACC_FILES)