PageRenderTime 55ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/v5_7_0/CMakeLists.txt

#
CMake | 209 lines | 116 code | 29 blank | 64 comment | 13 complexity | 32295ef341fba12d955d6661e3dce6bc MD5 | raw file
Possible License(s): LGPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, Apache-2.0, GPL-2.0
  1. # Top-level CMakeLists.txt for PLplot
  2. ###
  3. ### Process this file with cmake to produce Makefile
  4. ###
  5. # Copyright (C) 2006 Alan W. Irwin
  6. #
  7. # This file is part of PLplot.
  8. #
  9. # PLplot is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU Library General Public License as published
  11. # by the Free Software Foundation; version 2 of the License.
  12. #
  13. # PLplot is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU Library General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU Library General Public License
  19. # along with PLplot; if not, write to the Free Software
  20. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. # Version 2.4.3 or above of cmake is required!
  22. CMAKE_MINIMUM_REQUIRED(VERSION 2.4.3 FATAL_ERROR)
  23. # Recommended way to do user overrides of C-related variables, is given at
  24. # http://public.kitware.com/pipermail/cmake/2006-July/010334.html.
  25. # See also, CMakeCInformation.cmake. There are also C++, and Fortran-specific
  26. # overrides that can be done. However, I prefer putting overrides in just
  27. # one file so I use the overall variable CMAKE_USER_MAKE_RULES_OVERRIDE
  28. # instead.
  29. set(
  30. CMAKE_USER_MAKE_RULES_OVERRIDE
  31. ${CMAKE_SOURCE_DIR}/cmake/UserOverride.cmake
  32. )
  33. project(plplot)
  34. # 2.4.3 bug workarounds here.
  35. message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
  36. if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
  37. SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-soname,")
  38. endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
  39. if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
  40. if(NOT XCODE)
  41. SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-install_name")
  42. endif(NOT XCODE)
  43. set(CMAKE_Fortran_CREATE_SHARED_LIBRARY "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
  44. endif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
  45. # End of 2.4.3 bug workarounds.
  46. set(PACKAGE plplot)
  47. # Location where PLplot cmake build system first looks for cmake modules.
  48. set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
  49. # Version data that need modification for each release.
  50. include(plplot_version)
  51. # parameters to control overall cmake behaviour.
  52. # Configure PLplot component variables....
  53. include(plplot)
  54. # Use configured variables to process configurable top-level files.
  55. configure_file(
  56. ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
  57. ${CMAKE_CURRENT_BINARY_DIR}/config.h
  58. )
  59. # Allow access to the generated config.h for this build.
  60. ADD_DEFINITIONS("-DHAVE_CONFIG_H")
  61. # Install top-level files
  62. # Enable testing framework for examples
  63. if (BUILD_TEST)
  64. enable_testing()
  65. endif (BUILD_TEST)
  66. # Disable warnings about deprecated functions (Visual C++ 2005)
  67. if(MSVC_VERSION GREATER 1399)
  68. ADD_DEFINITIONS("/D_CRT_SECURE_NO_DEPRECATE")
  69. endif(MSVC_VERSION GREATER 1399)
  70. # Borland Compiler must compile in ANSII mode
  71. if(BORLAND)
  72. ADD_DEFINITIONS(-A)
  73. endif(BORLAND)
  74. set(top_level_DOCFILES
  75. AUTHORS
  76. COPYING.LIB
  77. ChangeLog
  78. Copyright
  79. FAQ
  80. NEWS
  81. PROBLEMS
  82. README
  83. README.release
  84. )
  85. install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR})
  86. # Process other directories including using configured variables to
  87. # process configurable files in those directories.
  88. # N.B. Order is important here at the cmake stage because targets must
  89. # be processed by cmake in a specific order e.g., due to get_target_property
  90. # invocations. Note, this order has nothing to do with the order which make
  91. # processes these subdirectories at build time. That build-time order
  92. # is determined by the dependencies between targets and also by file
  93. # dependencies that are established by the cmake configuration files.
  94. # needs no cmake processing
  95. #add_subdirectory(fonts)
  96. add_subdirectory(lib)
  97. add_subdirectory(include)
  98. add_subdirectory(src)
  99. add_subdirectory(data)
  100. add_subdirectory(bindings)
  101. add_subdirectory(drivers)
  102. add_subdirectory(examples)
  103. add_subdirectory(utils)
  104. add_subdirectory(test)
  105. add_subdirectory(scripts)
  106. add_subdirectory(doc)
  107. add_subdirectory(pkgcfg)
  108. # needs no cmake processing
  109. #add_subdirectory(cf)
  110. summary()
  111. if(PREBUILD_DIST)
  112. # Pre-build everything required for a distribution tarball and copy it to
  113. # the source tree (if build tree is different from source tree).
  114. # List of targets that must be (pre-)built.
  115. # N.B. the plhershey-unicode.h_built target has to be pre-built only because
  116. # of the needs of the old windows build at sys/win32/msdev.
  117. set(
  118. DIST_TARGETS
  119. plhershey-unicode.h_built
  120. )
  121. if(ENABLE_octave)
  122. set(DIST_TARGETS ${DIST_TARGETS} make_documentation)
  123. endif(ENABLE_octave)
  124. if(BUILD_PRINT)
  125. set(DIST_TARGETS ${DIST_TARGETS} print)
  126. endif(BUILD_PRINT)
  127. if(BUILD_INFO)
  128. set(DIST_TARGETS ${DIST_TARGETS} info)
  129. endif(BUILD_INFO)
  130. if(BUILD_MAN)
  131. set(DIST_TARGETS ${DIST_TARGETS} man)
  132. endif(BUILD_MAN)
  133. if(BUILD_HTML)
  134. set(DIST_TARGETS ${DIST_TARGETS} html)
  135. endif(BUILD_HTML)
  136. if(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  137. add_custom_target(prebuild_dist)
  138. else(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  139. # copy prebuilds back to source tree.
  140. add_custom_target(
  141. prebuild_dist
  142. COMMAND ${CMAKE_COMMAND} -E copy
  143. ${CMAKE_BINARY_DIR}/include/plhershey-unicode.h
  144. ${CMAKE_SOURCE_DIR}/include
  145. COMMAND ${CMAKE_COMMAND} -E copy_directory
  146. ${CMAKE_BINARY_DIR}/bindings/octave/plplot_octave_txt
  147. ${CMAKE_SOURCE_DIR}/bindings/octave/plplot_octave_txt
  148. COMMAND cp
  149. `cat static_built_files ${INFO_MANIFEST} ${MAN_MANIFEST} ${HTML_MANIFEST}`
  150. ${CMAKE_SOURCE_DIR}/doc/docbook/src
  151. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc/docbook/src
  152. )
  153. endif(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
  154. add_dependencies(prebuild_dist ${DIST_TARGETS})
  155. endif(PREBUILD_DIST)
  156. #
  157. # Packing stuff
  158. #
  159. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Scientific Plotting Library PLplot")
  160. set(CPACK_PACKAGE_VENDOR "PLplot development team")
  161. set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
  162. set(CPACK_GENERATOR TGZ)
  163. set(
  164. CPACK_SOURCE_PACKAGE_FILE_NAME
  165. "plplot-${VERSION}"
  166. CACHE INTERNAL "tarball basename"
  167. )
  168. set(CPACK_SOURCE_GENERATOR TGZ)
  169. # The following components are regex's to match anywhere (unless anchored)
  170. # in absolute path + filename to find files or directories to be excluded
  171. # from source tarball.
  172. set(CPACK_SOURCE_IGNORE_FILES
  173. "~$"
  174. "\\\\.cvsignore$"
  175. "^${PROJECT_SOURCE_DIR}.*/CVS/"
  176. "^${PROJECT_SOURCE_DIR}/debian/"
  177. "^${PROJECT_SOURCE_DIR}/old/"
  178. )
  179. #message("CPACK_SOURCE_IGNORE_FILES = ${CPACK_SOURCE_IGNORE_FILES}")
  180. include(CPack)