[cmake-developers] BISON_TARGET doesn't use CMAKE_CURRENT_BINARY_DIR as WORKING_DIRECTORY

Mingjie Xing mingjie.xing at gmail.com
Tue Dec 25 01:17:25 EST 2018


Hello,

I run into a problem when use FindBISON module in CMakeLists.txt. The BISON_TARGET will run bison command in CMAKE_CURRENT_SOURCE_DIR. The GNU Bison has problem for ‘—defines=‘ option because it will always generate the header file in the working directory. So, 

BISON_TARGET(Parser ${CMAKE_CURRENT_SOURCE_DIR}/Parser.y
${CMAKE_CURRENT_BINARY_DIR}/Parser.bison
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/Parser.h)

will not work, because ‘Parser.h’ will be generated under CMAKE_CURRENT_SOURCE_DIR.

So I just wonder whither it is better for  BISON_TARGET to use CMAKE_CURRENT_BINARY_DIR as WORKING_DIRECTORY.

Thanks
Mingjie


More information about the cmake-developers mailing list