# CMakeLists.txt ---
# Copyright © 2011 Jordi Gutiérrez Hermoso
# Author: Jordi Gutiérrez Hermoso
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
set(project-name "multidecksieve")
project(${project-name})
cmake_minimum_required(VERSION 2.8.4)
find_program(MKOCTFILE_EXECUTABLE mkoctfile)
if(NOT MKOCTFILE_EXECUTABLE)
message(SEND_ERROR "Failed to find mkoctfile, is it in your $PATH?")
endif()
## Compile the mexfiles
# add_subdirectory("graphCUTS/GCmex1point4/")
## Compile the octfile
set(OCT_CXXFLAGS "-O2 -Wall -Wextra -std=c++0x")
set(ENV{CXXFLAGS} ${OCT_CXXFLAGS})
set(OCT_FILE "multidecksieve.oct")
set(OCT_SRC "${CMAKE_CURRENT_SOURCE_DIR}/multidecksieve.cpp" "${CPPLIB_SIEVE_LIBRARY}")
set(CPPLIB_DIR "${CMAKE_SOURCE_DIR}/../ammannsieve")
set(CPPLIB_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/../ammannsieve")
find_library(CPPLIB_SIEVE_LIBRARY NAMES "sieve" PATHS CPPLIB_DIR)
if ("${CPPLIB_SIEVE_LIBRARY}" STREQUAL "CPPLIB_SIEVE_LIBRARY-NOTFOUND")
message(FATAL_ERROR "One of the libraries wasn't found!")
endif ()
set(CPPLIB_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../ammansieve")
set(CPPLIB_HINT_INCLUDE_DIR ${CPPLIB_DIR})
include_directories(${CPPLIB_INCLUDE_DIR})
add_custom_command(OUTPUT ${OCT_FILE}
COMMAND ${MKOCTFILE_EXECUTABLE} "${OCT_SRC}"
DEPENDS "multidecksieve.cpp"
COMMENT "Generating ${OCT_FILE}"
VERBATIM)
add_custom_target(multidecksieve ALL
DEPENDS ${OCT_FILE})
set(data_dir "${CMAKE_CURRENT_SOURCE_DIR}")
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${OCT_FILE}
DESTINATION ${data_dir})