From f8039c0bc837103aaac1d948d192fdf5ab88b3dd Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 3 Jan 2021 00:21:48 +0100 Subject: [PATCH] CMake: Add -DYY_NO_UNISTD_H definition to built flex sources --- cmake/macros/AddFlexTarget.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/macros/AddFlexTarget.cmake b/cmake/macros/AddFlexTarget.cmake index b24aeb95fc..c669acb6e4 100644 --- a/cmake/macros/AddFlexTarget.cmake +++ b/cmake/macros/AddFlexTarget.cmake @@ -74,4 +74,8 @@ function(add_flex_target output_cxx input_lxx) ${commands} DEPENDS ${depends}) endif() + + if(MSVC) + set_source_files_properties(${outputs} PROPERTIES COMPILE_DEFINITIONS YY_NO_UNISTD_H=1) + endif() endfunction(add_flex_target)