Skip to content
Snippets Groups Projects
Commit 060560df authored by Dominic Kempf's avatar Dominic Kempf
Browse files

[cmake] Add EXCLUDE_FROM_ALL option to add_generated_executable

parent bcded456
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,12 @@
# Additional dependencies of the generated executable (changes in those
# will retrigger generation)
#
# .. cmake_param:: EXCLUDE_FROM_ALL
# :option:
#
# Set this option, if you do not want the target to be automatically
# built. This option is forwarded to the builtin command add_executable.
#
# Add an executable to the project that gets automatically
# generated at configure time with the form compiler uf2pdelab.
# Regeneration is triggered correctly if the UFL file or the
......@@ -65,7 +71,7 @@ endif()
file(GLOB_RECURSE UFL2PDELAB_SOURCES ${UFL2PDELAB_GLOB_PATTERN})
function(add_generated_executable)
set(OPTIONS)
set(OPTIONS EXCLUDE_FROM_ALL)
set(SINGLE TARGET SOURCE UFLFILE INIFILE)
set(MULTI FORM_COMPILER_ARGS DEPENDS)
include(CMakeParseArguments)
......@@ -108,6 +114,11 @@ function(add_generated_executable)
CMAKE_MODULES)
configure_file(${perftool_path}/StandardMain.cmake ${GEN_SOURCE})
endif()
if(GEN_EXCLUDE_FROM_ALL)
set(GEN_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
else()
set(GEN_EXCLUDE_FROM_ALL "")
endif()
# Generate a list of generated headers to teach CMake about
dune_execute_process(COMMAND ${CMAKE_BINARY_DIR}/run-in-dune-env python ${perftool_path}/deplist.py ${GEN_INIFILE} ${GEN_TARGET}
......@@ -125,7 +136,7 @@ function(add_generated_executable)
COMMENT "Generating operators for the target ${GEN_TARGET}"
)
add_executable(${GEN_TARGET} ${GEN_SOURCE} ${GEN_DRIVER} ${header_deps})
add_executable(${GEN_TARGET} ${GEN_EXCLUDE_FROM_ALL} ${GEN_SOURCE} ${GEN_DRIVER} ${header_deps})
target_include_directories(${GEN_TARGET} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(generation ${GEN_TARGET})
endfunction()
......
......@@ -51,11 +51,9 @@ function(dune_add_formcompiler_system_test)
UFLFILE ${SYSTEMTEST_UFLFILE}
INIFILE "${CMAKE_CURRENT_BINARY_DIR}/${inifile}"
DEPENDS ${SYSTEMTEST_INIFILE}
EXCLUDE_FROM_ALL
)
# Exclude the target from all
set_property(TARGET ${tname} PROPERTY EXCLUDE_FROM_ALL 1)
# Add dependency on the metatarget for this systemtest
if(NOT ${INIINFO_${inifile}_suffix} STREQUAL "__empty")
add_dependencies(${SYSTEMTEST_BASENAME} ${tname})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment