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

/tags/v5_7_1/bindings/c++/CMakeLists.txt

#
CMake | 107 lines | 58 code | 12 blank | 37 comment | 4 complexity | 89190920b9330c92d1483f37a7576eba MD5 | raw file
Possible License(s): LGPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, Apache-2.0, GPL-2.0
  1. # bindings/c++/CMakeLists.txt
  2. ### Process this file with cmake to produce Makefile
  3. ###
  4. # Copyright (C) 2006 Andrew Ross
  5. #
  6. # This file is part of PLplot.
  7. #
  8. # PLplot is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU Library General Public License as published
  10. # by the Free Software Foundation; version 2 of the License.
  11. #
  12. # PLplot is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU Library General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Library General Public License
  18. # along with PLplot; if not, write to the Free Software
  19. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. if(ENABLE_cxx)
  21. set(plplotcxx${LIB_TAG}_LIB_SRCS
  22. plstream.cc
  23. )
  24. set(plplotcxx${LIB_TAG}_INSTALLED_HEADERS
  25. plstream.h
  26. )
  27. # Set the include path
  28. include_directories(
  29. ${CMAKE_SOURCE_DIR}/include
  30. ${CMAKE_BINARY_DIR}
  31. ${CMAKE_BINARY_DIR}/include
  32. )
  33. # Create plplotcxx[d] library
  34. add_library(plplotcxx${LIB_TAG} ${plplotcxx${LIB_TAG}_LIB_SRCS})
  35. if(WIN32 AND BUILD_SHARED_LIBS)
  36. SET_SOURCE_FILES_PROPERTIES(${plplotcxx${LIB_TAG}_LIB_SRCS}
  37. PROPERTIES COMPILE_FLAGS "-DMAKINGPLDLL" )
  38. endif(WIN32 AND BUILD_SHARED_LIBS)
  39. target_link_libraries(plplotcxx${LIB_TAG} plplot${LIB_TAG})
  40. get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH)
  41. set_target_properties(plplotcxx${LIB_TAG}
  42. PROPERTIES
  43. SOVERSION ${plplotcxx_SOVERSION}
  44. VERSION ${plplotcxx_VERSION}
  45. INSTALL_RPATH "${LIB_INSTALL_RPATH}"
  46. INSTALL_NAME_DIR "${LIB_DIR}"
  47. )
  48. # Install library in lib/
  49. install(TARGETS plplotcxx${LIB_TAG} DESTINATION ${LIB_DIR})
  50. install(FILES
  51. ${plplotcxx${LIB_TAG}_INSTALLED_HEADERS}
  52. DESTINATION ${INCLUDE_DIR}
  53. )
  54. # Configure pkg-config *.pc file corresponding to libplplotcxx${LIB_TAG}
  55. if(PKGCONFIG_EXECUTABLE)
  56. if(LIB_TAG)
  57. set(PC_PRECISION "double")
  58. else(LIB_TAG)
  59. set(PC_PRECISION "single")
  60. endif(LIB_TAG)
  61. # Each list element must consist of a colon-separated string with the
  62. # following fields which are parsed out in the foreach loop below and
  63. # used to configure the corresponding pkg-config *.pc file.
  64. # BINDING - ENABLE_${BINDING} keeps track of whether a
  65. # binding has been enabled (ON) or not (OFF).
  66. # Also, ${BINDING} used to determine PC_FILE_SUFFIX
  67. # which helps to determine name of configured
  68. # *.pc file.
  69. # PC_SHORT_NAME - Used in *.pc NAME: field
  70. # PC_LONG_NAME - Used in *.pc Description: field
  71. # PC_LIBRARY_NAME - Used in *.pc Libs: field
  72. # Also used to determine PC_LINK_FLAGS and
  73. # PC_COMPILE_FLAGS used in *.pc Libs: and Cflags:
  74. # fields.
  75. set(PC_DATA "c++:C++:C++ bindings, :plplotcxx${LIB_TAG}")
  76. string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" BINDING ${PC_DATA})
  77. set(PC_FILE_SUFFIX "-${BINDING}")
  78. set(PC_REQUIRES "plplot${LIB_TAG}")
  79. string(REGEX REPLACE "^.*:(.*):.*:.*$" "\\1" PC_SHORT_NAME ${PC_DATA})
  80. string(REGEX REPLACE "^.*:.*:(.*):.*$" "\\1" PC_LONG_NAME ${PC_DATA})
  81. string(REGEX REPLACE "^.*:.*:.*:(.*)$" "\\1" PC_LIBRARY_NAME ${PC_DATA})
  82. set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS}")
  83. set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}")
  84. set(PC_LINK_FLAGS "-l${PC_LIBRARY_NAME} ${PC_LINK_FLAGS}")
  85. set(PC_CONFIGURED_FILE
  86. ${CMAKE_BINARY_DIR}/pkgcfg/plplot${LIB_TAG}${PC_FILE_SUFFIX}.pc
  87. )
  88. configure_file(
  89. ${CMAKE_SOURCE_DIR}/pkgcfg/plplot-template.pc.cmake
  90. ${PC_CONFIGURED_FILE}
  91. @ONLY
  92. )
  93. install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR})
  94. endif(PKGCONFIG_EXECUTABLE)
  95. endif(ENABLE_cxx)