File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ include(InstallBasicPackageFiles)
118
118
install_basic_package_files(${PROJECT_NAME}
119
119
VERSION ${${PROJECT_NAME} _VERSION}
120
120
COMPATIBILITY AnyNewerVersion
121
- TARGETS_PROPERTY ${PROJECT_NAME} _TARGETS
121
+ EXPORT ${PROJECT_NAME}
122
122
VARS_PREFIX ${PROJECT_NAME}
123
123
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
124
124
# Add the uninstall target
Original file line number Diff line number Diff line change 2
2
# The actual file name of the library built is constructed based on conventions
3
3
# of the native platform, such as lib<LIBRARY_TARGET_NAME>.a,
4
4
# lib<LIBRARY_TARGET_NAME>.dylib or <LIBRARY_TARGET_NAME>.lib.
5
- set (LIBRARY_TARGET_NAME LibTemplateCMake)
5
+ #
6
+ # In order to use a library name that is not the same as the `EXPORT` (in the
7
+ # `install` command), it is necessary to pass the `FIRST_TARGET` option to
8
+ # `install_basic_package_files` in the main CMakeLists.txt file.
9
+ # In this case the project name is used for both, therefore it is not necessary.
10
+ set (LIBRARY_TARGET_NAME ${PROJECT_NAME} )
6
11
7
12
# List of CPP (source) library files.
8
13
set (${LIBRARY_TARGET_NAME} _SRC
@@ -64,5 +69,3 @@ install(TARGETS ${LIBRARY_TARGET_NAME}
64
69
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR} " COMPONENT lib
65
70
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR} " COMPONENT bin
66
71
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} /${LIBRARY_TARGET_NAME} " COMPONENT dev)
67
-
68
- set_property (GLOBAL APPEND PROPERTY ${PROJECT_NAME} _TARGETS ${LIBRARY_TARGET_NAME} )
You can’t perform that action at this time.
0 commit comments