Use compiler from DOLFINConfig.cmake file

Issue #112 resolved
Prof Garth Wells created an issue

DOLFIN demos and JIT compilation should use

DOLFIN_CXX_COMPILER

from DOLFINConfig.cmake.

Using the default compiler can fail because of incompatible flags.

Comments (6)

  1. Johan Hake

    The generated CMakeList.txt file used for JIT compilation of dolfin modules has:

    if (NOT $ENV{CXX})
      set(CMAKE_CXX_COMPILER ${DOLFIN_CXX_COMPILER})
    endif()
    

    so for example all Expressions are compiled using the correct compiler. For JIT compiled UFC modules we have:

    if (NOT $ENV{CXX})
      set(CMAKE_CXX_COMPILER ${UFC_CXX_COMPILER})
    endif()
    

    so that is not using DOLFIN_CXX_COMPILER. That saidin Python is UFC forms compiled without any bindings to DOLFIN, so I guess that should also be OK, right?

  2. Prof Garth Wells reporter

    There is something wrong because on Mac I compile DOLFIN using gcc, and then always have to set CXX to gcc, otherwise JIT compilation uses clang, which breaks on the OpenMP flags since clang does not support OpenMP.

    I don't have the Mac with me right now to test.

  3. Prof Garth Wells reporter

    It seems that

    if (NOT $ENV{CXX})
      set(CMAKE_CXX_COMPILER ${UFC_CXX_COMPILER})
    endif()
    

    was not working. I have seen that position in the CMake file is important. Anyway, a cleaner has been implemented (CMake devs recommend not setting CMAKE_CXX_COMPILER in CMakeLists.txt files) with DOLFIN_CXX_FLAGS no longer used. This has been made possible by not including CGAL header files via the DOLFIN public interface. Using DOLFIN_CXX_FLAGS is dangerous because they may be compiler-specific.

  4. Log in to comment