summaryrefslogtreecommitdiff
path: root/libproxy/cmake/pxmodule.cmk
blob: bd7d49be7b1b27072c04cccf1b3dc7c2043e9788 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Module function
function(px_module name build builtin)
  if(build)
    if(builtin)
      set(built "*")
      set_property(SOURCE modules/${name}.cpp PROPERTY COMPILE_DEFINITIONS LIBEXECDIR="${LIBEXEC_INSTALL_DIR}";MM_MODULE_BUILTIN=${name})
      set(LIBPROXY_SOURCES ${LIBPROXY_SOURCES} modules/${name}.cpp PARENT_SCOPE)
      set(BUILTIN_MODULES "${BUILTIN_MODULES} \"${name}\"," PARENT_SCOPE)
      if(${ARGC} GREATER 3)
        set(LIBPROXY_LIBRARIES ${LIBPROXY_LIBRARIES} ${ARGN} PARENT_SCOPE)
      endif()
    else()
      set(built "m")
      set_property(SOURCE modules/${name}.cpp PROPERTY COMPILE_DEFINITIONS LIBEXECDIR="${LIBEXEC_INSTALL_DIR}")
      add_library(${name} MODULE modules/${name}.cpp)
      target_link_libraries(${name} libproxy)
      set_target_properties(${name} PROPERTIES PREFIX "")
      install(TARGETS ${name} LIBRARY DESTINATION ${MODULE_INSTALL_DIR})
      if(${ARGC} GREATER 3)
        target_link_libraries(${name} ${ARGN})
      endif()
    endif()
  endif()
  message("\t${built}\t${name}")
endfunction(px_module)