CMakeLists.txt 1.77 KB
Newer Older
1
2
3
4
# Packages are optional: if they are not present, certain code samples are not compiled
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)

find_package(MPI)      # Built-in in CMake
5
find_package(Threads)
6
7
8

include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/common.cmake)

9
10
11
set(LIBMESH_INCLUDE_PATH /usr/local/include CACHE PATH "path to libMesh include directory")
set(LIBMESH_LIBRARY_PATH /usr/local/lib CACHE PATH "path to libMesh library directory")
set(LIBMESH_LIBRARY mesh_opt CACHE FILEPATH "name of libmesh library" )
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# ==================================================================================================

if ("${DWARF_PREFIX}" STREQUAL "")
  set(DWARF_PREFIX 8_unstructured)
endif()

set(NAME ${DWARF_PREFIX}_libmesh)

#TODO: check for libmesh too
if (MPI_FOUND)
	enable_language(CXX)
    include_directories(${MPI_INCLUDE_PATH} ${LIBMESH_INCLUDE_PATH})
    link_directories(${LIBMESH_LIBRARY_PATH}) 
26
    add_executable(${NAME} fem_system_ex4.C heatsystem.C)
27
28
29
30
    set(CMAKE_BUILD_TYPE RelWithDebInfo)
    if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
    	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
    elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
Thomas Steinreiter's avatar
Thomas Steinreiter committed
31
    	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost -std=c++14")
32
    endif()
Thomas Steinreiter's avatar
Thomas Steinreiter committed
33
    set_target_properties(${NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED YES)
34
    target_link_libraries(${NAME} ${LIBMESH_LIBRARY} ${MPI_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
35
36
37
38
39
40
41
42
43
44
45
    install(TARGETS ${NAME} DESTINATION bin)
    message("** Enabling '${NAME}': with MPI")
else()
    message("## Skipping '${NAME}': MPI support missing")
#    dummy_install(${NAME} "MPI")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}")

unset(NAME)
# ==================================================================================================