cmake: cmake < 2.6 doesn't know FILE(STRINGS ...)
This commit is contained in:
parent
452b89d6ec
commit
f231e8496a
|
@ -130,12 +130,24 @@ ADD_DEPENDENCIES(${PROJECT_AWE_NAME} generated_headers)
|
|||
IF(GENERATE_MANPAGES)
|
||||
|
||||
MACRO(a_file_match infile regex result_var)
|
||||
FILE(STRINGS ${infile} matches REGEX ${regex} LIMIT_COUNT 1)
|
||||
IF(matches)
|
||||
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6)
|
||||
# cmake < 2.6 doesn't know FILE(STRINGS ...)
|
||||
EXECUTE_PROCESS(COMMAND ${GREP_EXECUTABLE} -l ${regex} ${infile}
|
||||
RESULT_VARIABLE exit_code
|
||||
OUTPUT_QUIET)
|
||||
IF(exit_code EQUAL 0)
|
||||
SET(${result_var} TRUE)
|
||||
ELSE()
|
||||
SET(${result_var} FALSE)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
FILE(STRINGS ${infile} match REGEX ${regex} LIMIT_COUNT 1)
|
||||
IF(match)
|
||||
SET(${result_var} TRUE)
|
||||
ELSE()
|
||||
SET(${result_var} FALSE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# find .c files exporting lua functions
|
||||
|
|
|
@ -23,6 +23,7 @@ ADD_DEFINITIONS(-std=gnu99 -ggdb3 -fno-strict-aliasing -Wall -Wextra
|
|||
|
||||
# {{{ Find external utilities
|
||||
FIND_PROGRAM(CAT_EXECUTABLE cat)
|
||||
FIND_PROGRAM(GREP_EXECUTABLE grep)
|
||||
FIND_PROGRAM(GIT_EXECUTABLE git)
|
||||
FIND_PROGRAM(LUA_EXECUTABLE lua)
|
||||
# programs needed for man pages
|
||||
|
|
Loading…
Reference in New Issue