I would like to point cmake to a specific location to find the Bison executable on a specific platform. Is there a way to do this?
if(PLATFORM STREQUAL "Darwin")
find_package(
BISON 3.0.0 REQUIRED
# Would like to do something like:
PATH "/usr/local/opt/bison/bin/bison"
)
else()
find_package(
BISON 3.0.0 REQUIRED
)
endif()
if(BISON_FOUND)
BISON_TARGET(
Parser
${CMAKE_CURRENT_LIST_DIR}/Parser.yy
${CMAKE_CURRENT_BINARY_DIR}/Parser.cpp
)
target_sources(
MyLib PRIVATE
${BISON_Parser_OUTPUTS}
)
endif()
According to documentation for module
FindBISON.cmake
, this module sets variable BISON_EXECUTABLE pointed to the program's executable.Actually, this is cached variable, which is set be the script with find_program call. So you may set this cached variable manually for fix executable:
Note, that variables listed in documentation for different scripts
FindXXX.cmake
underdon't need to be cached, so setting them will affect on result. E.g., variable BISON_VERSION listed in the same documentation for
FindBISON.cmake
is not cached, so you may not redefine it for affect on the script.