From d391c33f5bf15e549163fadaf78e35a349c29acc Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sun, 30 Apr 2017 17:30:27 -0400 Subject: [PATCH] moved definition of Fortran and C compilers before calling "project" --- CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d95f87fb..9770996b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,11 @@ message ("Found PETSC_LINKER:\n${PETSC_LINKER}\n" ) message ("Found MPI Fortran Compiler:\n${PETSC_MPIFC}\n" ) message ("Found MPI C Compiler:\n${PETSC_MPICC}\n" ) +# set compiler commands to match PETSc (needs to be done before defining the project) +# https://cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F +set (CMAKE_Fortran_COMPILER "${PETSC_MPIFC}") +set (CMAKE_C_COMPILER "${PETSC_MPICC}") + #--------------------------------------------------------------------------------------- # Now start to care about DAMASK @@ -110,16 +115,13 @@ elseif ("${DAMASK_SOLVER}" STREQUAL "FEM") message ("Building FEM Solver\n") endif () +# set linker commands (needs to be done after defining the project) +set (CMAKE_LINKER "${PETSC_LINKER}") + if ("${CMAKE_BUILD_TYPE}" STREQUAL "") set (CMAKE_BUILD_TYPE "RELEASE") endif () -# set compiler and linker commands (need to be done after defining the project) -# https://cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F -set (CMAKE_Fortran_COMPILER "${PETSC_MPIFC}") -set (CMAKE_C_COMPILER "${PETSC_MPICC}") -set (CMAKE_LINKER "${PETSC_LINKER}") - # Predefined sets for OPTIMIZATION/OPENMP based on BUILD_TYPE if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG" OR "${CMAKE_BUILD_TYPE}" STREQUAL "SYNTAXONLY" ) set (PARALLEL "OFF")