File: CMakeLists.txt

package info (click to toggle)
libpqxx 6.4.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,992 kB
  • sloc: cpp: 12,634; sh: 4,426; xml: 1,104; makefile: 309; python: 294; ansic: 3
file content (56 lines) | stat: -rw-r--r-- 1,414 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
cmake_minimum_required (VERSION 3.7)

file(READ VERSION VER_FILE_CONTENT)
string(STRIP ${VER_FILE_CONTENT} VER_FILE_CONTENT)

project(libpqxx VERSION ${VER_FILE_CONTENT} LANGUAGES CXX)

if(NOT "${CMAKE_CXX_STANDARD}")
    set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

if(NOT SKIP_BUILD_TEST)
	option(BUILD_TEST "Build all test cases" ON)
endif()

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(config)

add_subdirectory(src)
add_subdirectory(include)
if (BUILD_TEST)
  add_subdirectory(test)
endif ()

# installation
write_basic_package_version_file(
  "${CMAKE_CURRENT_BINARY_DIR}/libpqxx-config-version.cmake"
  VERSION ${PROJECT_VERSION}
  COMPATIBILITY SameMajorVersion
)
install(FILES cmake/libpqxx-config.cmake "${CMAKE_CURRENT_BINARY_DIR}/libpqxx-config-version.cmake"
  DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libpqxx
)
install(
  EXPORT libpqxx-targets
  NAMESPACE libpqxx::
  DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libpqxx
)
# Build tree export
export(EXPORT libpqxx-targets
  NAMESPACE libpqxx::
  FILE ${CMAKE_CURRENT_BINARY_DIR}/libpqxx-targets.cmake
)
configure_file(
  cmake/libpqxx-config.cmake
  ${CMAKE_CURRENT_BINARY_DIR}/libpqxx-config.cmake
  COPYONLY
)
# Package generation
set(CPACK_GENERATOR TGZ)
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
include(CPack)