Changeset View
Changeset View
Standalone View
Standalone View
tests/ECMGenerateExportHeaderTest/library/CMakeLists.txt
- This file was added.
1 | cmake_minimum_required(VERSION 3.0.0) | ||||
---|---|---|---|---|---|
2 | | ||||
3 | # keep version in sync with the one used in consumer/CMakeLists.txt for the library | ||||
4 | # ideally would be send over by an exported target property, | ||||
5 | # but exporting custom properties via EXPORT_PROPERTIES only was added in CMake 3.12 | ||||
6 | project(library VERSION 2.40.0) | ||||
7 | | ||||
8 | set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules) | ||||
9 | include(ECMGenerateExportHeader) | ||||
10 | | ||||
11 | set(_public_includedir "include/library") | ||||
12 | | ||||
13 | add_library(library library.cpp) | ||||
14 | target_include_directories(library | ||||
15 | PUBLIC | ||||
16 | "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>" | ||||
17 | "$<INSTALL_INTERFACE:${_public_includedir}>" | ||||
18 | ) | ||||
19 | | ||||
20 | if(SET_GROUP) | ||||
21 | set(_group_args GROUP_BASE_NAME LIBGROUP) | ||||
22 | endif() | ||||
23 | | ||||
24 | ecm_generate_export_header(library | ||||
25 | ${_group_args} | ||||
26 | VERSION ${library_VERSION} | ||||
27 | DEPRECATION_VERSIONS 2.0 2.12 | ||||
28 | EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} | ||||
29 | ) | ||||
30 | | ||||
31 | install(TARGETS library DESTINATION lib EXPORT library_targets) | ||||
32 | | ||||
33 | install(EXPORT library_targets FILE LibraryTargets.cmake DESTINATION lib/library) | ||||
34 | install(FILES | ||||
35 | library.hpp | ||||
36 | "${CMAKE_CURRENT_BINARY_DIR}/library_export.h" | ||||
37 | DESTINATION ${_public_includedir} | ||||
38 | ) | ||||
39 | | ||||
40 | add_executable(dummy main.cpp) |