File: Macros.cmake

package info (click to toggle)
libnfs 5.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,648 kB
  • sloc: ansic: 39,600; sh: 1,654; makefile: 315; xml: 178
file content (23 lines) | stat: -rw-r--r-- 850 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Add sources to main application
# Arguments:
#   name name of the library to add
# Implicit arguments:
#   SOURCES the sources of the library
#   HEADERS the headers of the library (only for IDE support)
# On return:
#   Library will be built and added to ${CORE_LIBRARIES}
function(core_add_library name)
  set(name nfs_${name})
  set(CMAKE_POSITION_INDEPENDENT_CODE ON)
  add_library(${name} OBJECT ${SOURCES} ${HEADERS})
  target_include_directories(${name} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
  set(CORE_LIBRARIES "${name};${CORE_LIBRARIES}" CACHE INTERNAL "")

  # no need to install core libs if we build shared library
  if(NOT BUILD_SHARED_LIBS)
    install(TARGETS ${name} EXPORT libnfs
            RUNTIME DESTINATION bin
            ARCHIVE DESTINATION lib
            LIBRARY DESTINATION lib)
  endif()
endfunction()