cmake_minimum_required (VERSION 2.8)

project(SelfAssembly)
file(COPY Data DESTINATION ${CMAKE_BINARY_DIR})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

file(GLOB SELFASSEMBLY_HEADERS "src/*.h")
file(GLOB SELFASSEMBLY_SOURCES "src/*.cpp")
add_executable(SelfAssembly ${SELFASSEMBLY_HEADERS} ${SELFASSEMBLY_SOURCES} "polypartition/polypartition")


#--- Tell CMake he'll be able to include ".cmake" configurations 
# files in the folder where the current file is located
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})


#--- FIND MOSEK
find_package(MOSEK REQUIRED)
include_directories(${MOSEK_INCLUDE_DIRS})

#--- On Darwin mosek comes with a relative loader_path. Either use the following line to copy the
# mosek64.7.0 library into the build dir, or manually adapt the install name as described in
# http://docs.mosek.com/7.0/capi/Testing_installation_and_compiling_examp.html, 6.2.2.3
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
get_filename_component(MOSEK_LIBRARIES_PARENT_DIR ${MOSEK_LIBRARIES} DIRECTORY)
file( COPY "${MOSEK_LIBRARIES_PARENT_DIR}/libmosek64.7.0.dylib" DESTINATION ${CMAKE_BINARY_DIR} )
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

target_link_libraries( SelfAssembly ${MOSEK_LIBRARIES})
if(NOT MOSEK_FOUND)
    message(ERROR " MOSEK not found!")
endif() 

#—-- FIND EIGEN3
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIRS})
if(NOT EIGEN3_FOUND)
	message(ERROR " EIGEN not found!")
endif()
