diff --git a/CMakeLists.txt b/CMakeLists.txt index 2018ea978e5f6b2717d27a34eef37f66fdc5242d..2c9737a5f5f35d387afa4cd1fe38eaad692dd712 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,19 @@ cmake_minimum_required(VERSION 3.13) project(amdis LANGUAGES CXX VERSION 0.3) -#find dune-common and set the module path +# find dune-common and set the module path find_package(dune-common REQUIRED) list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules" ${dune-common_MODULE_PATH}) -#include the dune macros +# include the dune macros include(DuneMacros) +# some options to control the cmake behvior +option(ENABLE_ALL_WARNINGS "enable all meaningful warnings" OFF) +option(ENABLE_CCACHE "enable compiler cache" ON) + + # start a dune project with information from dune.module dune_project() dune_add_library(amdis) @@ -42,7 +47,6 @@ if (PETSc_FOUND) endif (PETSc_FOUND) -option(ENABLE_ALL_WARNINGS "enable all meaningful warnings" OFF) if (ENABLE_ALL_WARNINGS) target_compile_options(amdis PUBLIC "-Wall" "-Wpedantic" "-Wextra" "-Wnon-virtual-dtor" diff --git a/cmake/modules/AddAmdisExecutable.cmake b/cmake/modules/AddAmdisExecutable.cmake index fc41762bf478dcbda223109e779f5413cd36e369..0edbd12aa4e2b4d9ef064523f18f07017efa8977 100644 --- a/cmake/modules/AddAmdisExecutable.cmake +++ b/cmake/modules/AddAmdisExecutable.cmake @@ -82,7 +82,7 @@ function(add_amdis_executable) # add all flags to the target! add_dune_all_flags(${ADDEXE_NAME}) target_link_dune_default_libraries(${ADDEXE_NAME}) - target_link_libraries(${ADDEXE_NAME} amdis) + dune_target_link_libraries(${ADDEXE_NAME} amdis) if(ADDEXE_DIM) set(GRIDDIM ${ADDEXE_DIM}) diff --git a/cmake/modules/AmdisMacros.cmake b/cmake/modules/AmdisMacros.cmake index 4cd1687dd2ad51412b38815f53763762c166b427..9fe9f58a5fa5cce21860f39ac328a6790051527b 100644 --- a/cmake/modules/AmdisMacros.cmake +++ b/cmake/modules/AmdisMacros.cmake @@ -3,7 +3,7 @@ include(AddAmdisExecutable) # some optimization of the compile times find_program(CCACHE_PROGRAM ccache) -if (CCACHE_PROGRAM) +if (ENABLE_CCACHE AND CCACHE_PROGRAM) set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") add_compile_options("-fdiagnostics-color")