IAP GITLAB

Skip to content
Snippets Groups Projects
Commit f2c318b5 authored by Ralf M Ulrich's avatar Ralf M Ulrich
Browse files

allow example options

parent c24f308e
No related branches found
No related tags found
1 merge request!199Resolve "remove examples from coverage"
Pipeline #1337 failed
......@@ -181,14 +181,24 @@ endfunction (CORSIKA_ADD_TEST)
# target_link_libraries(testSomething ...) and so on.
#
function (CORSIKA_ADD_EXAMPLE)
cmake_parse_arguments (PARSE_ARGV 1 _ "" "" "SOURCES")
set (options "")
set (oneValueArgs RUN_OPTIONS)
set (multiValueArgs SOURCES)
cmake_parse_arguments (CORSKA_ADD_EXAMPLE "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN} )
set (name ${ARGV0})
if (NOT __SOURCES)
if (NOT CORSIKA_ADD_EXAMPLE_SOURCES)
set (sources ${name}.cc)
else ()
set (sources ${__SOURCES})
set (sources ${CORSIKA_ADD_EXAMPLE_SOURCES})
endif ()
if (NOT CORSIKA_ADD_EXAMPLE_RUN_OPTIONS)
set (run_options "")
else ()
set (run_option ${CORSIKA_ADD_EXAMPLE_RUN_OPTIONS})
endif ()
add_executable (${name} ${sources})
......@@ -204,7 +214,7 @@ function (CORSIKA_ADD_EXAMPLE)
COMMAND ${CMAKE_COMMAND} -E echo ""
COMMAND ${CMAKE_COMMAND} -E echo "***************************************"
COMMAND ${CMAKE_COMMAND} -E echo "***** running example: ${name}"
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name}
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name} ${run_options}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/example_outputs)
install (TARGETS ${name} DESTINATION share/examples)
endfunction (CORSIKA_ADD_EXAMPLE)
......@@ -82,7 +82,7 @@ if (Pythia8_FOUND)
CORSIKAprocesssequence
)
CORSIKA_ADD_EXAMPLE (vertical_EAS)
CORSIKA_ADD_EXAMPLE (vertical_EAS RUN_OPTIONS "4 2 10000.")
target_link_libraries (vertical_EAS
SuperStupidStack
CORSIKAunits
......
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