# Require CMake 2.8
cmake_minimum_required(VERSION 2.8)

project(Projection1D)

# Get DOLFIN configuration data
find_package(dolfin)

# Default build type (can be overridden by user)
if (NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
    "Choose the type of build, options are: Debug MinSizeRel Release RelWithDebInfo." FORCE)
endif()

# Compiler definitions
add_definitions(${DOLFIN_CXX_DEFINITIONS})

# Add special DOLFIN compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DOLFIN_CXX_FLAGS}")

# Generated code is not this robust (yet)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable -g")

# Include directories
include_directories(
  ${DOLFIN_INCLUDE_DIRS}
  ${DOLFIN_3RD_PARTY_INCLUDE_DIRS}
  ${CMAKE_CURRENT_BINARY_DIR})

# Executable
file(GLOB SOURCES ${CMAKE_SOURCE_DIR}/*.cpp)
file(GLOB GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/generated_code/*.cpp)
add_executable(demo ${SOURCES} ${GENERATED_SOURCES})

# Target libraries
target_link_libraries(demo ${DOLFIN_LIBRARIES} ${DOLFIN_3RD_PARTY_LIBRARIES})
