FindVLE.cmake 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. # FindVLE.cmake
  2. # =============
  3. #
  4. # Try to find VLE
  5. #
  6. # Copyright 2012-2014 INRA
  7. # Gauthier Quesnel <quesnel@users.sourceforge.net>
  8. # Ronan Trépos <ronan.trepos@toulouse.inra.fr>
  9. #
  10. # Distributed under the OS-approved BSD License (the "License");
  11. # This software is distributed WITHOUT ANY WARRANTY; without even the
  12. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. # See the License for more information.
  14. #
  15. # Once done this will define:
  16. #
  17. # VLE_FOUND - The system has VLE
  18. # VLE_INCLUDE_DIRS - The VLE include directory
  19. # VLE_LIBRARY_DIRS - Directories containing libraries to link
  20. # VLE_LIBRARIES - Link these to use shared libraries of VLE
  21. #
  22. # CMake variables used by this module:
  23. # VLE_ABI_VERSION - gives the VLE version to search for (e.g 1.1, 1.2)
  24. # (REQUIRED)
  25. # VLE_DEBUG - If true, prints debug traces
  26. # (default OFF)
  27. # VLE_USING_CMAKE - If true, on windows, use cmake for finding VLE,
  28. # else use pkgconfig
  29. # (default ON)
  30. # VLE_BASEPATH_LOCAL - cmake variable for base path of vle
  31. # (default NOT_DEFINED)
  32. #
  33. # Environment variables used by this module:
  34. #
  35. # VLE_BASEPATH - environment variable for base path of vle
  36. #
  37. #=============================================================================
  38. #
  39. # Notes :
  40. # ---------
  41. # FindVLE will try to find VLE and the gtkmm dependencies,
  42. # only some boost libraries are not included into the libraries given
  43. #
  44. #=============================================================================
  45. #
  46. # Usage
  47. # -----
  48. #
  49. # set(VLE_ABI_VERSION 1.2)
  50. # find_package(VLE REQUIRED)
  51. #
  52. #=============================================================================
  53. #
  54. # Check VLE_ABI_VERSION
  55. #
  56. if (NOT DEFINED VLE_ABI_VERSION)
  57. message (FATAL_ERROR "Cmake variable VLE_ABI_VERSION is not set")
  58. endif ()
  59. #
  60. # Set default behavior of find vle
  61. #
  62. if (WIN32)
  63. if (DEFINED VLE_USING_CMAKE)
  64. set (_find_vle_using_cmake ${VLE_USING_CMAKE})
  65. else (DEFINED VLE_USING_CMAKE)
  66. set (_find_vle_using_cmake 1)
  67. endif (DEFINED VLE_USING_CMAKE)
  68. else (WIN32)
  69. set (_find_vle_using_cmake 0)
  70. endif (WIN32)
  71. if (DEFINED VLE_DEBUG)
  72. set (_vle_debug ${VLE_DEBUG})
  73. else ()
  74. set (_vle_debug 0)
  75. endif ()
  76. #
  77. # Find VLE
  78. #
  79. if (${_find_vle_using_cmake})
  80. find_path(_vle_base_include zlib.h PATHS
  81. $ENV{VLE_BASEPATH}/include
  82. ${VLE_BASEPATH_LOCAL}/include
  83. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;Path]/include"
  84. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;]/include"
  85. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/include")
  86. find_path(_vle_base_bin zlib1.dll PATHS
  87. $ENV{VLE_BASEPATH}/bin
  88. ${VLE_BASEPATH_LOCAL}/bin
  89. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;Path]/bin"
  90. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;]/bin"
  91. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/bin")
  92. find_path(_vle_base_lib libz.dll.a PATHS
  93. $ENV{VLE_BASEPATH}/lib
  94. ${VLE_BASEPATH_LOCAL}/lib
  95. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;Path]/lib"
  96. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\VLE ${VLE_ABI_VERSION}.0;]/lib"
  97. "[HKEY_LOCAL_MACHINE\\SOFTWARE\\VLE Development Team\\Wow6432Node\\VLE ${VLE_ABI_VERSION}.0;]/lib")
  98. if (${_vle_debug})
  99. message (" vle_debug _vle_base_include ${_vle_base_include}")
  100. message (" vle_debug _vle_base_bin ${_vle_base_bin}")
  101. message (" vle_debug _vle_base_lib ${_vle_base_lib}")
  102. endif ()
  103. if(NOT _vle_base_include OR NOT _vle_base_bin OR NOT _vle_base_lib)
  104. message (FATAL_ERROR "Missing vle dependencies")
  105. endif ()
  106. set(VLE_INCLUDE_DIRS
  107. ${_vle_base_include}/vle-${VLE_ABI_VERSION};
  108. ${_vle_base_include}; ${_vle_base_include}/libxml2;
  109. ${_vle_base_include}/glibmm-2.4;${_vle_base_lib}/glibmm-2.4/include;
  110. ${_vle_base_include}/sigc++-2.0;${_vle_base_lib}/sigc++-2.0/include;
  111. ${_vle_base_include}/glib-2.0;${_vle_base_lib}/glib-2.0/include)
  112. set(VLE_LIBRARY_DIRS
  113. ${_vle_base_bin};${_vle_base_lib})
  114. set (VLE_LIBRARIES
  115. vle-${VLE_ABI_VERSION} xml2 glibmm-2.4 gobject-2.0 sigc-2.0 gthread-2.0
  116. glib-2.0 intl)
  117. else (${_find_vle_using_cmake})
  118. find_package(PkgConfig REQUIRED)
  119. PKG_CHECK_MODULES(VLE vle-${VLE_ABI_VERSION})
  120. endif (${_find_vle_using_cmake})
  121. # handle the QUIETLY and REQUIRED arguments and set VLE_FOUND to TRUE if all
  122. # listed variables are TRUE
  123. include(FindPackageHandleStandardArgs)
  124. FIND_PACKAGE_HANDLE_STANDARD_ARGS(VLE REQUIRED_VARS VLE_INCLUDE_DIRS
  125. VLE_LIBRARIES)
  126. if (${_vle_debug})
  127. message (" vle_debug VLE_INCLUDE_DIRS ${VLE_INCLUDE_DIRS}")
  128. message (" vle_debug VLE_LIBRARY_DIRS ${VLE_LIBRARY_DIRS}")
  129. message (" vle_debug VLE_LIBRARIES ${VLE_LIBRARIES}")
  130. endif ()
  131. #mark_as_advanced(VLE_INCLUDE_DIRS VLE_LIBRARIES VLE_LIBRARY_DIRS)