PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
CMake | 111 lines | 62 code | 12 blank | 37 comment | 4 complexity | 343ba627ce8c5745cdb7090fd7477dc9 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}
  50. ARCHIVE DESTINATION ${LIB_DIR}
  51. LIBRARY DESTINATION ${LIB_DIR}
  52. RUNTIME DESTINATION ${BIN_DIR}
  53. )
  54. install(FILES
  55. ${plplotcxx${LIB_TAG}_INSTALLED_HEADERS}
  56. DESTINATION ${INCLUDE_DIR}
  57. )
  58. # Configure pkg-config *.pc file corresponding to libplplotcxx${LIB_TAG}
  59. if(PKGCONFIG_EXECUTABLE)
  60. if(LIB_TAG)
  61. set(PC_PRECISION "double")
  62. else(LIB_TAG)
  63. set(PC_PRECISION "single")
  64. endif(LIB_TAG)
  65. # Each list element must consist of a colon-separated string with the
  66. # following fields which are parsed out in the foreach loop below and
  67. # used to configure the corresponding pkg-config *.pc file.
  68. # BINDING - ENABLE_${BINDING} keeps track of whether a
  69. # binding has been enabled (ON) or not (OFF).
  70. # Also, ${BINDING} used to determine PC_FILE_SUFFIX
  71. # which helps to determine name of configured
  72. # *.pc file.
  73. # PC_SHORT_NAME - Used in *.pc NAME: field
  74. # PC_LONG_NAME - Used in *.pc Description: field
  75. # PC_LIBRARY_NAME - Used in *.pc Libs: field
  76. # Also used to determine PC_LINK_FLAGS and
  77. # PC_COMPILE_FLAGS used in *.pc Libs: and Cflags:
  78. # fields.
  79. set(PC_DATA "c++:C++:C++ bindings, :plplotcxx${LIB_TAG}")
  80. string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" BINDING ${PC_DATA})
  81. set(PC_FILE_SUFFIX "-${BINDING}")
  82. set(PC_REQUIRES "plplot${LIB_TAG}")
  83. string(REGEX REPLACE "^.*:(.*):.*:.*$" "\\1" PC_SHORT_NAME ${PC_DATA})
  84. string(REGEX REPLACE "^.*:.*:(.*):.*$" "\\1" PC_LONG_NAME ${PC_DATA})
  85. string(REGEX REPLACE "^.*:.*:.*:(.*)$" "\\1" PC_LIBRARY_NAME ${PC_DATA})
  86. set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS}")
  87. set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}")
  88. set(PC_LINK_FLAGS "-l${PC_LIBRARY_NAME} ${PC_LINK_FLAGS}")
  89. set(PC_CONFIGURED_FILE
  90. ${CMAKE_BINARY_DIR}/pkgcfg/plplot${LIB_TAG}${PC_FILE_SUFFIX}.pc
  91. )
  92. configure_file(
  93. ${CMAKE_SOURCE_DIR}/pkgcfg/plplot-template.pc.cmake
  94. ${PC_CONFIGURED_FILE}
  95. @ONLY
  96. )
  97. install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR})
  98. endif(PKGCONFIG_EXECUTABLE)
  99. endif(ENABLE_cxx)