|
| 1 | + #************************************************************************* |
| 2 | + # CMakeLists.txt -- This file is part of Netris. * |
| 3 | + # * |
| 4 | + # Copyright (C) 2016, Ivo Filot * |
| 5 | + # * |
| 6 | + # Netris is free software: you can redistribute it and/or modify * |
| 7 | + # it under the terms of the GNU General Public License as published * |
| 8 | + # by the Free Software Foundation, either version 3 of the License, * |
| 9 | + # or (at your option) any later version. * |
| 10 | + # * |
| 11 | + # Netris is distributed in the hope that it will be useful, * |
| 12 | + # but WITHOUT ANY WARRANTY; without even the implied warranty * |
| 13 | + # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * |
| 14 | + # See the GNU General Public License for more details. * |
| 15 | + # * |
| 16 | + # You should have received a copy of the GNU General Public License * |
| 17 | + # along with this program. If not, see http://www.gnu.org/licenses/. * |
| 18 | + # * |
| 19 | + #*************************************************************************/ |
| 20 | + |
| 21 | +# set minimum cmake requirements |
| 22 | +cmake_minimum_required(VERSION 2.8) |
| 23 | +project (hfcxx) |
| 24 | + |
| 25 | +# add custom directory to look for .cmake files |
| 26 | +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules ) |
| 27 | + |
| 28 | +# Enable release build |
| 29 | +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) |
| 30 | + message(STATUS "Setting build type to 'Release' as none was specified.") |
| 31 | + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) |
| 32 | + # Set the possible values of build type for cmake-gui |
| 33 | + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") |
| 34 | +endif() |
| 35 | + |
| 36 | +# Configure static build |
| 37 | +SET(BUILD_SHARED_LIBRARIES OFF) |
| 38 | + |
| 39 | +IF(WIN32) |
| 40 | +SET(CMAKE_FIND_LIBRARY_PREFIXES "") |
| 41 | +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll") |
| 42 | +ELSE() |
| 43 | +SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") |
| 44 | +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") |
| 45 | +ENDIF() |
| 46 | + |
| 47 | +# # add OS specific |
| 48 | +# if(APPLE) |
| 49 | +# add_definitions(-D_APPLE) |
| 50 | +# SET(BOOST_INCLUDEDIR "/opt/local/include") |
| 51 | +# SET(BOOST_LIBRARYDIR "/opt/local/lib") |
| 52 | +# endif() |
| 53 | +# if(UNIX) |
| 54 | +# add_definitions(-Wno-literal-suffix) |
| 55 | +# SET(BOOST_INCLUDEDIR "/usr/include") |
| 56 | +# SET(BOOST_LIBRARYDIR "/usr/lib/x86_64-linux-gnu") |
| 57 | +# endif() |
| 58 | + |
| 59 | +# set Boost |
| 60 | +# set (Boost_NO_SYSTEM_PATHS ON) |
| 61 | +# set (Boost_USE_MULTITHREADED ON) |
| 62 | +# set (Boost_USE_STATIC_LIBS ON) |
| 63 | +# set (Boost_USE_STATIC_RUNTIME OFF) |
| 64 | +# set (BOOST_ALL_DYN_LINK OFF) |
| 65 | + |
| 66 | +# Include libraries |
| 67 | +# find_package(TCLAP REQUIRED) |
| 68 | +# find_package(SUNDIALS REQUIRED) |
| 69 | +# find_package(Boost COMPONENTS system filesystem regex REQUIRED) |
| 70 | +# find_package(CPPUNIT REQUIRED) # for unit tests |
| 71 | + |
| 72 | +# Set include folders |
| 73 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR} |
| 74 | + ${CMAKE_BINARY_DIR} |
| 75 | + ${Boost_INCLUDE_DIRS} |
| 76 | + ${TCLAP_INCLUDE_DIR} |
| 77 | + ${SUNDIALS_INCLUDE_DIR} |
| 78 | + ${CPPUNIT_INCLUDE_DIR}) |
| 79 | + |
| 80 | +# Add sources |
| 81 | +file(GLOB SOURCES "*.cpp") |
| 82 | + |
| 83 | +# add tests |
| 84 | +# enable_testing () |
| 85 | +# add_subdirectory("test") |
| 86 | + |
| 87 | +# Set executable |
| 88 | +add_executable(hfcxx ${SOURCES}) |
| 89 | + |
| 90 | +# Link libraries |
| 91 | +target_link_libraries(hfcxx) |
| 92 | + |
| 93 | +### |
| 94 | +# Installing |
| 95 | +## |
| 96 | +install (TARGETS hfcxx DESTINATION bin) |
0 commit comments