diff --git a/cmake/modules/DunePerftoolMacros.cmake b/cmake/modules/DunePerftoolMacros.cmake index b41785183706378813dbd8e9b58facee7b44d908..545ec22d2436eb58ae6b9dafc69ff2e72f43a14e 100644 --- a/cmake/modules/DunePerftoolMacros.cmake +++ b/cmake/modules/DunePerftoolMacros.cmake @@ -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() diff --git a/cmake/modules/GeneratedSystemtests.cmake b/cmake/modules/GeneratedSystemtests.cmake index 4badbae9eff808b718cfd9b7a35b6202652c6416..024d19466e543eda61fd7fd817905dd989cff2e2 100644 --- a/cmake/modules/GeneratedSystemtests.cmake +++ b/cmake/modules/GeneratedSystemtests.cmake @@ -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})