licensecc-config.cmake 2.0 KB

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