File: FlexHelper.cmake

package info (click to toggle)
nmodl 0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,016 kB
  • sloc: cpp: 28,492; javascript: 9,841; yacc: 2,804; python: 1,971; lex: 1,674; xml: 181; sh: 136; ansic: 37; makefile: 17; pascal: 7
file content (15 lines) | stat: -rw-r--r-- 749 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Often older version of flex is available in /usr. Even we set PATH for newer flex, CMake will set
# FLEX_INCLUDE_DIRS to /usr/include. This will result in compilation errors. Hence we check for flex
# include directory for the corresponding FLEX_EXECUTABLE. If found, we add that first and then we
# include include path from CMake.

get_filename_component(FLEX_BIN_DIR ${FLEX_EXECUTABLE} DIRECTORY)

if(NOT FLEX_BIN_DIR MATCHES "/usr/bin")
  get_filename_component(FLEX_INCLUDE_PATH ${FLEX_BIN_DIR} PATH)
  set(FLEX_INCLUDE_PATH ${FLEX_INCLUDE_PATH}/include/)
  if(EXISTS "${FLEX_INCLUDE_PATH}/FlexLexer.h")
    message(STATUS " Adding Flex include path as : ${FLEX_INCLUDE_PATH}")
    include_directories(${FLEX_INCLUDE_PATH})
  endif()
endif()