Skip to content
Snippets Groups Projects
Commit 5745590e authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos
Browse files

Use targets on duneproject

Update template project to use targets and use more modern CMake
parent 7f1ccd13
No related branches found
No related tags found
1 merge request!1460Use targets in duneproject
Pipeline #74959 canceled
......@@ -417,11 +417,12 @@ list(APPEND CMAKE_MODULE_PATH "\${PROJECT_SOURCE_DIR}/cmake/modules"
#include the dune macros
include(DuneMacros)
# deactivate global include-directories (old versions of dune used to need the OLD policy to work)
dune_policy(SET DP_DEFAULT_INCLUDE_DIRS NEW)
# start a dune project with information from dune.module
dune_project()
dune_enable_all_packages()
add_subdirectory(src)
add_subdirectory(dune)
add_subdirectory(doc)
......@@ -515,8 +516,14 @@ mkdir "$PROJECT/src"
echo "- $PROJECT/src/CMakeLists.txt"
cat> "$PROJECT/src/CMakeLists.txt" << M_DELIM
add_executable("${MODULE}" ${MODULE}.cc)
target_link_dune_default_libraries("${MODULE}")
# create custom target
add_executable(${MODULE} ${MODULE}.cc)
# link target against found dune libraries (e.g. dune-common)
target_link_dune_default_libraries(${MODULE})
# link target against other dune registered packages (e.g. TBB, METIS, etc.)
dune_target_enable_all_packages(${MODULE})
M_DELIM
################## PROJECT.CC ##################
......
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