Add TNG writing and reading support
[alexxy/gromacs.git] / src / external / tng_io / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8)
2
3 if(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake)")
4     set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W2")
5 else()
6     set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
7 endif()
8
9 project(TNG_IO)
10 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
11 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
12
13 option(BUILD_SHARED_LIBS "Enable shared libraries" ON)
14
15 option(TNG_BUILD_FORTRAN "Build Fortran compatible library and examples for testing" OFF)
16
17 option(TNG_BUILD_EXAMPLES "Build examples showing usage of the TNG API" ON)
18 option(TNG_BUILD_TEST "Build TNG testing binary." ON)
19 option(TNG_BUILD_COMPRESSION_TESTS "Build tests of the TNG compression library" OFF)
20
21 option(TNG_USE_OPENMP "Try to use the OpenMP library (if available)" OFF)
22 if(TNG_USE_OPENMP)
23   find_package(OpenMP)
24   if(OPENMP_FOUND)
25     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
26     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
27   endif()
28 endif()
29
30 find_package(ZLIB)
31
32 include(CheckIncludeFile)
33 check_include_file(inttypes.h   HAVE_INTTYPES_H)
34
35 add_subdirectory(src)
36
37 install(FILES include/tng_io.h DESTINATION include/)
38
39 #-- Add an Option to toggle the generation of the API documentation
40 option(TNG_BUILD_DOCUMENTATION "Use Doxygen to create the HTML based API documentation" OFF)
41 if(TNG_BUILD_DOCUMENTATION)
42   find_package(Doxygen)
43   if (NOT DOXYGEN_FOUND)
44     message(FATAL_ERROR
45       "Doxygen is needed to build the documentation. Please install it correctly")
46   endif()
47   #-- Configure the Template Doxyfile for our specific project
48   configure_file(Doxyfile.in
49                  ${PROJECT_BINARY_DIR}/Doxyfile  @ONLY IMMEDIATE)
50   #-- Add a custom target to run Doxygen when ever the project is built
51   add_custom_target (Docs ALL
52                                         COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
53                                         SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
54   # IF you do NOT want the documentation to be generated EVERY time you build the project
55   # then leave out the 'ALL' keyword from the above command.
56 endif()
57