Skip to content

Commit f4adfdb

Browse files
committed
Revert a small change to cmake installation commands order and one of the variable names.
1 parent 21c3f29 commit f4adfdb

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

cmake/Installation.cmake

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Configure installation
2+
include(CMakePackageConfigHelpers)
23

34
# Paths
45
if(LSL_UNIXFOLDERS)
@@ -9,53 +10,42 @@ else()
910
set(CMAKE_INSTALL_INCLUDEDIR LSL/include)
1011
endif()
1112

13+
# Generate a version file for the package.
14+
write_basic_package_version_file(
15+
"${CMAKE_CURRENT_BINARY_DIR}/LSLConfigVersion.cmake"
16+
VERSION "${liblsl_VERSION_MAJOR}.${liblsl_VERSION_MINOR}.${liblsl_VERSION_PATCH}"
17+
COMPATIBILITY AnyNewerVersion
18+
)
19+
1220
# Define installation targets
1321
set(LSLTargets lsl)
1422
if(LSL_BUILD_STATIC)
1523
list(APPEND LSLTargets lslobj lslboost)
1624
endif()
25+
26+
# Install the targets and store configuration information.
1727
install(TARGETS ${LSLTargets}
18-
EXPORT lslTargets # generates a CMake package config; should not be same name as the list of targets
28+
EXPORT LSLTargets # generates a CMake package config; TODO: Why the same name as the list of targets?
1929
COMPONENT liblsl
2030
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
2131
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
2232
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
2333
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
2434
# If we use CMake 3.23 FILE_SET, replace INCLUDES line with: FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
2535
)
26-
# Install the public headers.
27-
# TODO: Verify that this is necessary, given that we already installed the INCLUDES above.
28-
# TODO: Verify if it is still necessary to install the headers if we use FILE_SET.
29-
install(DIRECTORY include/
30-
COMPONENT liblsl
31-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
32-
)
33-
34-
# Generate and install CMake package config.
35-
# This allows other CMake projects to find and use the lsl library
36-
# using find_package(lsl).
37-
include(CMakePackageConfigHelpers)
38-
39-
# Generate a version file for the package.
40-
write_basic_package_version_file(
41-
"${CMAKE_CURRENT_BINARY_DIR}/LSLConfigVersion.cmake"
42-
VERSION "${liblsl_VERSION_MAJOR}.${liblsl_VERSION_MINOR}.${liblsl_VERSION_PATCH}"
43-
COMPATIBILITY AnyNewerVersion
44-
)
4536

4637
# TODO: What does this do? Why do we need LSLTargets.cmake in the build dir?
47-
export(EXPORT lslTargets
38+
export(EXPORT LSLTargets
4839
FILE "${CMAKE_CURRENT_BINARY_DIR}/LSLTargets.cmake"
4940
NAMESPACE LSL::
5041
)
5142

5243
# Generate the LSLConfig.cmake file and mark it for installation
53-
install(
54-
EXPORT lslTargets
55-
FILE LSLTargets.cmake # TODO: I think we can use this to generate LSLConfig.cmake, no?
56-
COMPONENT liblsl
57-
NAMESPACE "LSL::"
58-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LSL
44+
install(EXPORT LSLTargets
45+
FILE LSLTargets.cmake # TODO: I think we can use this to generate LSLConfig.cmake, no?
46+
COMPONENT liblsl
47+
NAMESPACE "LSL::"
48+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LSL
5949
)
6050
# A common alternative to installing the exported package config file is to generate it from a template.
6151
#configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/lslConfig.cmake.in
@@ -70,6 +60,14 @@ configure_file(cmake/LSLCMake.cmake "${CMAKE_CURRENT_BINARY_DIR}/LSLCMake.cmake"
7060
# TODO: Why use hardcoded files? We can generate the LSLConfig.cmake.
7161
configure_file(cmake/LSLConfig.cmake "${CMAKE_CURRENT_BINARY_DIR}/LSLConfig.cmake" COPYONLY)
7262

63+
# Install the public headers.
64+
# TODO: Verify that this is necessary, given that we already installed the INCLUDES above.
65+
# TODO: Verify if it is still necessary to install the headers if we use FILE_SET.
66+
install(DIRECTORY include/
67+
COMPONENT liblsl
68+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
69+
)
70+
7371
# Install the version file and the helper CMake script.
7472
install(
7573
FILES

0 commit comments

Comments
 (0)