diff --git a/CMakeLists.txt b/CMakeLists.txt index c725b8d1274a206c11bdaf528c63116c9a950fe5..8ca301fdb17e43558accca871695055427f428a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,26 +15,35 @@ option(CM_ALL_AUTO_DOC "Enables creation of auto-documentation") cmake_policy(SET CMP0004 OLD) enable_language(CXX) +enable_language(C) + +if (CM_ALL_USE_F08) + if (CM_ALL_FORTRAN) + message(FATAL_ERROR "Flag for Fortran 08 MPI interface set, while Fortran interface is not enabled!") + endif (CM_ALL_FORTRAN) +endif (CM_ALL_USE_F08) if (CM_ALL_FORTRAN) enable_language(Fortran) +# todo(s.schulz): This should be extended for other compilers, if they +# support standard checking. The Intel Fortran compiler +# does not. + if(CM_ALL_USE_F08) + add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<Fortran_COMPILER_ID:GNU>>:-std=f2008>) + else() + add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<Fortran_COMPILER_ID:GNU>>:-std=f2003>) + endif() + add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<Fortran_COMPILER_ID:GNU>>:-fbacktrace>) + add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<Fortran_COMPILER_ID:Intel>>:-traceback>) endif (CM_ALL_FORTRAN) # set standards compliance flags set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -# todo(s.schulz): This should be extended for other compilers, if they -# support standard checking. The Intel Fortran compiler -# does not. -if(CM_ALL_USE_F08) - add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<Fortran_COMPILER_ID:GNU>>:-std=f2008>) -else() - add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<Fortran_COMPILER_ID:GNU>>:-std=f2003>) -endif() -add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<Fortran_COMPILER_ID:GNU>>:-fbacktrace>) -add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<Fortran_COMPILER_ID:Intel>>:-traceback>) -add_compile_options("$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:Fortran>,$<Fortran_COMPILER_ID:GNU>>:-Wall;-Wextra>") +if (CM_ALL_FORTRAN) + add_compile_options("$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:Fortran>,$<Fortran_COMPILER_ID:GNU>>:-Wall;-Wextra>") +endif (CM_ALL_FORTRAN) add_compile_options("$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:GNU>>:-Wall;-Wextra>") add_compile_options("$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:GNU>>:-Wall;-Wextra>") @@ -46,7 +55,12 @@ project(ALL # add custom find-scripts to module path set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) -find_package(MPI REQUIRED) +if (CM_ALL_FORTRAN) + find_package(MPI REQUIRED COMPONENTS CXX Fortran) +else() + find_package(MPI REQUIRED COMPONENTS CXX) +endif (CM_ALL_FORTRAN) + if(CM_ALL_VTK_OUTPUT) message("Using VTK output")