licensecc-config.cmake 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # licensecc-config.cmake - package configuration file
  2. # SELF_DIR = /extlib/Licensecc/cmake/licensecc
  3. get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
  4. #TODO windows?
  5. # LCC_PRJ_BASE = extlib/Licensecc/licensecc/
  6. set(LCC_PRJ_BASE "${SELF_DIR}/../../licensecc")
  7. set(LCC_FOUND false)
  8. if(licensecc_FIND_COMPONENTS)
  9. foreach(component ${licensecc_FIND_COMPONENTS})
  10. set(cmakefile "${LCC_PRJ_BASE}/${component}/cmake/licensecc.cmake")
  11. if(EXISTS "${cmakefile}")
  12. include("${cmakefile}")
  13. set(${component}_FOUND true CACHE BOOL "Licensecc ${component} present")
  14. set(LCC_FOUND true)
  15. else(EXISTS "${cmakefile}")
  16. set(${component}_FOUND false CACHE BOOL "Licensecc ${component} present")
  17. message( WARNING "Component ${component} declared but not found." )
  18. endif(EXISTS "${cmakefile}")
  19. mark_as_advanced(${component}_FOUND)
  20. endforeach(component)
  21. else(licensecc_FIND_COMPONENTS)
  22. if(LCC_PROJECT_NAME)
  23. if(EXISTS "${LCC_PRJ_BASE}/${LCC_PROJECT_NAME}/cmake/licensecc.cmake")
  24. include("${LCC_PRJ_BASE}/${LCC_PROJECT_NAME}/cmake/licensecc.cmake")
  25. set(${LCC_PROJECT_NAME}_FOUND true CACHE BOOL "Licensecc ${LCC_PROJECT_NAME} present")
  26. set(LCC_FOUND true)
  27. else()
  28. message( WARNING "Variable LCC_PROJECT_NAME declared but project ${LCC_PROJECT_NAME} not found.")
  29. endif()
  30. mark_as_advanced(${LCC_PROJECT_NAME}_FOUND)
  31. else(LCC_PROJECT_NAME)
  32. if(PROJECT_NAME AND (EXISTS "${LCC_PRJ_BASE}/${PROJECT_NAME}/cmake/licensecc.cmake"))
  33. include("${LCC_PRJ_BASE}/${PROJECT_NAME}/cmake/licensecc.cmake")
  34. set(${PROJECT_NAME}_FOUND true CACHE BOOL "Licensecc ${PROJECT_NAME} present")
  35. mark_as_advanced(${PROJECT_NAME}_FOUND)
  36. set(LCC_FOUND true)
  37. endif()
  38. endif(LCC_PROJECT_NAME)
  39. endif(licensecc_FIND_COMPONENTS)
  40. if(LCC_FOUND)
  41. get_property(COMPILE_DEF TARGET licensecc::licensecc_static PROPERTY INTERFACE_COMPILE_DEFINITIONS)
  42. if("HAS_OPENSSL" IN_LIST COMPILE_DEF AND NOT OpenSSL_FOUND)
  43. #message( VERBOSE "Trying to find openssl (required by the target)")
  44. SET ( OPENSSL_USE_STATIC_LIBS ON )
  45. find_package(OpenSSL REQUIRED COMPONENTS Crypto)
  46. endif()
  47. endif(LCC_FOUND)