You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
cmake_minimum_required(VERSION 3.5) |
|
|
|
project(elysius NONE) |
|
|
|
option(BUILD_MENU "Add the Main Menu" ON) |
|
option(BUILD_CSTN "Include constants collection" ON) |
|
option(BUILD_CHIM "Include chemical equations analyser" ON) |
|
option(BUILD_PRDQ "Include periodic elements table" ON) |
|
option(BUILD_CONV "Include units conversion program" ON) |
|
option(BUILD_ELEC "Include electronic circuits solver" ON) |
|
|
|
add_subdirectory(srcs) |
|
|
|
if(BUILD_CSTN) |
|
set(DEFINITION "${DEFINITION} -DCONSTANT") |
|
endif() |
|
|
|
if(BUILD_CHIM) |
|
set(DEFINITION "${DEFINITION} -DCHEMISTRY") |
|
endif() |
|
|
|
if(BUILD_PRDQ) |
|
set(DEFINITION "${DEFINITION} -DPERIODIC") |
|
endif() |
|
|
|
if(BUILD_CONV) |
|
set(DEFINITION "${DEFINITION} -DCONVERT") |
|
endif() |
|
|
|
if(BUILD_ELEC) |
|
set(DEFINITION "${DEFINITION} -DCIRCUIT") |
|
endif() |
|
|
|
add_custom_target(menu ALL) |
|
find_program(FOO_EXECUTABLE foo) |
|
function(preprocess_foo out_var) |
|
set(result) |
|
foreach(in_f ${ARGN}) |
|
add_custom_command( |
|
PRE_BUILD |
|
TARGET menu |
|
COMMAND cd ${PROJECT_SOURCE_DIR} && ./pithon.sh srcs/${in_f} ${DEFINITION} |
|
DEPENDS srcs/${in_f} |
|
COMMENT "Creating preprocessed foo file ${in_f}" |
|
VERBATIM |
|
) |
|
list(APPEND result ${out_f}) |
|
endforeach() |
|
set(${out_var} "${result}" PARENT_SCOPE) |
|
endfunction() |
|
|
|
preprocess_foo(prep_files ${SOURCEFILES})
|
|
|