0031740: Configuration - recover support of Yacc and Lex generation
[occt.git] / adm / cmake / bison.cmake
CommitLineData
316d77d9 1# bison
2
3# execute FindBISON script by "find_package (Bison)" is required to define BISON_TARGET macro
4
fba34cf8 5# delete obsolete 3RDPARTY_BISON_EXECUTABLE cache variable (not used anymore)
6unset (3RDPARTY_BISON_EXECUTABLE CACHE)
316d77d9 7
fba34cf8 8# delete BISON_EXECUTABLE cache variable if it is empty, otherwise find_package will fail
9# without reasonable diagnostic
10if (NOT BISON_EXECUTABLE)
11 unset (BISON_EXECUTABLE CACHE)
12endif()
316d77d9 13
fba34cf8 14# Add paths to 3rdparty subfolders containing name "bison" to CMAKE_PROGRAM_PATH variable to make
15# these paths searhed by find_package
16if (3RDPARTY_DIR)
17 file (GLOB BISON_PATHS LIST_DIRECTORIES true "${3RDPARTY_DIR}/*bison*/")
18 foreach (candidate_path ${BISON_PATHS})
19 if (IS_DIRECTORY ${candidate_path})
20 list (APPEND CMAKE_PROGRAM_PATH ${candidate_path})
21 endif()
22 endforeach()
316d77d9 23endif()
fba34cf8 24
25find_package (BISON 2.7)
316d77d9 26
fba34cf8 27if (NOT BISON_FOUND OR NOT BISON_EXECUTABLE OR NOT EXISTS "${BISON_EXECUTABLE}")
28 list (APPEND 3RDPARTY_NOT_INCLUDED BISON_EXECUTABLE)
316d77d9 29endif()