Fix compile error for IBM VMX on ppc64
[gromacs/AngularHB.git] / src / external / tng_io / CMakeLists.txt
blob87c10be8be43ef8f6fdda77ec6536a176f62711f
1 cmake_minimum_required(VERSION 2.8.8)
3 project(TNG_IO)
6 if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
7     set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall")
8 elseif(WIN32)
9     set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W2")
10 endif()
12 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
13 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
15 option(BUILD_SHARED_LIBS "Enable shared libraries" ON)
17 option(TNG_BUILD_FORTRAN "Build Fortran compatible library and examples for testing" OFF)
19 option(TNG_BUILD_EXAMPLES "Build examples showing usage of the TNG API" ON)
20 option(TNG_BUILD_TEST "Build TNG testing binary." ON)
21 option(TNG_BUILD_COMPRESSION_TESTS "Build tests of the TNG compression library" OFF)
23 find_package(ZLIB QUIET)
24 option(TNG_BUILD_WITH_ZLIB "Build TNG with zlib compression" ${ZLIB_FOUND})
26 include(CheckIncludeFile)
27 check_include_file(inttypes.h   HAVE_INTTYPES_H)
29 include(BuildTNG.cmake)
30 tng_get_source_list(TNG_SOURCES TNG_COMPILE_DEFS)
32 tng_set_source_properties(WITH_ZLIB ${ZLIB_FOUND})
34 add_library(tng_io ${TNG_SOURCES})
36 if (ZLIB_FOUND)
37   list(APPEND EXTRA_LIBRARIES ${ZLIB_LIBRARIES})
38   include_directories(${ZLIB_INCLUDE_DIRS})
39 endif()
41 if (UNIX)
42   list(APPEND EXTRA_LIBRARIES m)
43 endif()
45 target_link_libraries(tng_io ${EXTRA_LIBRARIES})
47 set_target_properties(tng_io PROPERTIES VERSION ${TNG_IO_VERSION} SOVERSION ${TNG_MAJOR_VERSION})
49 # Create the tng_ioConfig.cmake and tng_ioConfigVersion.cmake files for the install tree
50 set(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include")
51 configure_file(              src/lib/tng_io-config.cmake.in
52   "${CMAKE_CURRENT_BINARY_DIR}/cmake/tng_io-config.cmake" @ONLY)
53 configure_file(              src/lib/tng_io-configVersion.cmake.in
54   "${CMAKE_CURRENT_BINARY_DIR}/cmake/tng_io-configVersion.cmake" @ONLY)
56 # Use GNUInstallDirst to set paths on multiarch systems
57 include(GNUInstallDirs)
59 # Install the tng_ioConfig.cmake and tng_ioConfigVersion.cmake
60 install(FILES
61   "${CMAKE_CURRENT_BINARY_DIR}/cmake/tng_io-config.cmake"
62   "${CMAKE_CURRENT_BINARY_DIR}/cmake/tng_io-configVersion.cmake"
63   DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/tng_io")
65 install(TARGETS tng_io
66         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
67         ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
69 install(FILES include/tng/tng_io.h include/tng/tng_io_fwd.h ${CMAKE_CURRENT_BINARY_DIR}/include/tng/version.h
70         DESTINATION include/tng)
72 #-- Add an Option to toggle the generation of the API documentation
73 option(TNG_BUILD_DOCUMENTATION "Use Doxygen to create the HTML based API documentation" OFF)
74 if(TNG_BUILD_DOCUMENTATION)
75   find_package(Doxygen)
76   if (NOT DOXYGEN_FOUND)
77     message(FATAL_ERROR
78       "Doxygen is needed to build the documentation. Please install it correctly")
79   endif()
80   #-- Configure the Template Doxyfile for our specific project
81   configure_file(Doxyfile.in
82                  ${PROJECT_BINARY_DIR}/Doxyfile  @ONLY IMMEDIATE)
83   #-- Add a custom target to run Doxygen when ever the project is built
84   add_custom_target (Docs ALL
85                                         COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
86                                         SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
87   # IF you do NOT want the documentation to be generated EVERY time you build the project
88   # then leave out the 'ALL' keyword from the above command.
90   install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Documentation/
91       DESTINATION share/tng/doc)
92 endif()
94 add_subdirectory(src)