-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
26 lines (21 loc) · 903 Bytes
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
PROJECT(lemon)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
ADD_EXECUTABLE(lemon lemon.c)
MACRO(LEMON_TARGET Name Input Template)
GET_FILENAME_COMPONENT(LEMON_INPUT_FILENAME ${Input} NAME_WE)
GET_FILENAME_COMPONENT(LEMON_TEMPLATE_EXTENSION ${Template} EXT)
GET_FILENAME_COMPONENT(LEMON_TEMPLATE_PATH ${Template} PATH)
IF(LEMON_TEMPLATE_PATH STREQUAL "")
SET(LEMON_TEMPLATE_PATH ${lemon_SOURCE_DIR}/${Template})
ELSE()
SET(LEMON_TEMPLATE_PATH ${Template})
ENDIF()
SET(LEMON_${Name}_OUTPUTS
${CMAKE_CURRENT_BINARY_DIR}/${LEMON_INPUT_FILENAME}.h
${CMAKE_CURRENT_BINARY_DIR}/${LEMON_INPUT_FILENAME}${LEMON_TEMPLATE_EXTENSION})
ADD_CUSTOM_COMMAND(
OUTPUT ${LEMON_${Name}_OUTPUTS}
COMMAND lemon ARGS ${Input} -P${CMAKE_CURRENT_BINARY_DIR}/ -T${LEMON_TEMPLATE_PATH}
DEPENDS ${Input} ${LEMON_TEMPLATE_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
ENDMACRO()