From f50e5ec4f490f3b672cbc8a0735aa7c67b014882 Mon Sep 17 00:00:00 2001 From: Simon Praetorius Date: Sun, 18 Jul 2021 12:23:10 +0200 Subject: [PATCH] CMake warnings reduced --- CMakeLists.txt | 10 +++++++--- cmake/modules/AddAmdisExecutable.cmake | 2 +- cmake/modules/AmdisMacros.cmake | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2018ea97..2c9737a5 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 fc41762b..0edbd12a 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 4cd1687d..9fe9f58a 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") -- GitLab