Commit cd172d6e authored by Thomas Steinreiter's avatar Thomas Steinreiter
Browse files

added FindLibMesh.cmake find module

parent dabfa867
# 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
find_package(Threads)
find_package(MPI REQUIRED) # Built-in in CMake
find_package(Threads REQUIRED)
include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/common.cmake)
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" )
find_package(LibMesh REQUIRED)
# ==================================================================================================
......@@ -18,11 +16,9 @@ endif()
set(NAME ${DWARF_PREFIX}_libmesh)
#TODO: check for libmesh too
if (MPI_FOUND)
if (MPI_FOUND AND LIBMESH_FOUND)
enable_language(CXX)
include_directories(${MPI_INCLUDE_PATH} ${LIBMESH_INCLUDE_PATH})
link_directories(${LIBMESH_LIBRARY_PATH})
include_directories(${LIBMESH_INCLUDE_DIRS} ${MPI_INCLUDE_PATH})
add_executable(${NAME} fem_system_ex4.cpp heatsystem.cpp)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
......@@ -31,12 +27,11 @@ if (MPI_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost -std=c++14")
endif()
set_target_properties(${NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED YES)
target_link_libraries(${NAME} ${LIBMESH_LIBRARY} ${MPI_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${NAME} ${LIBMESH_LIBRARIES} ${MPI_CXX_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
install(TARGETS ${NAME} DESTINATION bin)
message("** Enabling '${NAME}': with MPI")
message("** Enabling '${NAME}': with LibMesh and MPI")
else()
message("## Skipping '${NAME}': MPI support missing")
# dummy_install(${NAME} "MPI")
message("## Skipping '${NAME}': LibMesh or MPI support missing")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment