CMakeLists.txt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # macro to configure the use of local or system version of a package
  2. # Uses:
  3. # HAVE_LOCAL_${name} - is local version available?
  4. # ${name}_LOCAL_LIBRARIES - libraries of the local version
  5. # ${name}_LOCAL_INCLUDE_DIRS - include directories of the local version
  6. # HAVE_SYSTEM_${name} - is system version available?
  7. # ${name}_SYSTEM_LIBRARIES - libraries of the system version
  8. # ${name}_SYSTEM_INCLUDE_DIRS - include directories of the system version
  9. # Generates:
  10. # WITH_LOCAL_${name} - use the local version of the package (only when local is available)
  11. # WITH_${name} - use this package
  12. # ${name}_LIBRARIES - libraries
  13. # ${name}_INCLUDE_DIRS - include directories
  14. macro( CONFIGURE_WITH_LOCAL_OR_SYSTEM name )
  15. unset( ${name}_LIBRARIES CACHE )
  16. unset( ${name}_INCLUDE_DIRS CACHE )
  17. if( HAVE_LOCAL_${name} )
  18. set( WITH_LOCAL_${name} ON
  19. CACHE BOOL "use local version of ${name}" )
  20. else()
  21. unset( WITH_LOCAL_${name} CACHE )
  22. endif()
  23. if( WITH_LOCAL_${name} )
  24. message( STATUS "Configuring for local ${name}" )
  25. set( ${name}_LIBRARIES ${${name}_LOCAL_LIBRARIES} )
  26. set( ${name}_INCLUDE_DIRS ${${name}_LOCAL_INCLUDE_DIRS} )
  27. message( STATUS "Configuring for local ${name} - done" )
  28. elseif( HAVE_SYSTEM_${name} )
  29. message( STATUS "Configuring for system ${name}" )
  30. set( ${name}_LIBRARIES ${${name}_SYSTEM_LIBRARIES} )
  31. set( ${name}_INCLUDE_DIRS ${${name}_SYSTEM_INCLUDE_DIRS} )
  32. message( STATUS "Configuring for system ${name} - done" )
  33. endif()
  34. if( WITH_LOCAL_${name} OR HAVE_SYSTEM_${name} )
  35. set( WITH_${name} ON
  36. CACHE BOOL "use ${name}" )
  37. else()
  38. unset( WITH_${name} CACHE )
  39. endif()
  40. set( ${name}_LIBRARIES ${${name}_LIBRARIES}
  41. CACHE PATH "${name} libraries" )
  42. set( ${name}_INCLUDE_DIRS ${${name}_INCLUDE_DIRS}
  43. CACHE PATH "${name} include directories" )
  44. mark_as_advanced( ${name}_LIBRARIES )
  45. mark_as_advanced( ${name}_INCLUDE_DIRS )
  46. endmacro( CONFIGURE_WITH_LOCAL_OR_SYSTEM )
  47. add_subdirectory( httplib )
  48. add_subdirectory( json )
  49. add_subdirectory( libconfig )
  50. add_subdirectory( mysql )
  51. add_subdirectory( pcre )
  52. add_subdirectory( rapidyaml )
  53. add_subdirectory( yaml-cpp )
  54. add_subdirectory( zlib )