@@ -19,30 +19,20 @@ write_basic_package_version_file(
1919
2020# Define installation targets
2121set (LSLTargets lsl)
22- if (LSL_BUILD_STATIC)
23- list (APPEND LSLTargets lslobj lslboost)
24- endif ()
2522
2623# Install the targets and store configuration information.
2724install (TARGETS ${LSLTargets}
28- EXPORT LSLTargets # generates a CMake package config; TODO: Why the same name as the list of targets?
25+ EXPORT LSLTargets
2926 COMPONENT liblsl
3027 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
3128 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
3229 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
33- INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
34- # If we use CMake 3.23 FILE_SET, replace INCLUDES line with: FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
35- )
36-
37- # TODO: What does this do? Why do we need LSLTargets.cmake in the build dir?
38- export (EXPORT LSLTargets
39- FILE "${CMAKE_CURRENT_BINARY_DIR} /LSLTargets.cmake"
40- NAMESPACE LSL::
30+ FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
4131)
4232
4333# Generate the LSLConfig.cmake file and mark it for installation
4434install (EXPORT LSLTargets
45- FILE LSLTargets.cmake # TODO: I think we can use this to generate LSLConfig.cmake, no?
35+ FILE LSLConfig.cmake
4636 COMPONENT liblsl
4737 NAMESPACE "LSL::"
4838 DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/LSL
@@ -53,28 +43,10 @@ install(EXPORT LSLTargets
5343# INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lsl)
5444# If we use this method, then we need a corresponding install(FILES ...) command to install the generated file.
5545
56- # Copy hardcoded CMake files to the build directory.
57- # TODO: Why bother with this copy? Is it not enough to install (into cmake/LSL)?
58- configure_file (cmake/LSLCMake.cmake "${CMAKE_CURRENT_BINARY_DIR} /LSLCMake.cmake" COPYONLY )
59- # TODO: Why bother with this copy? Is it not enough to install (into cmake/LSL)?
60- # TODO: Why use hardcoded files? We can generate the LSLConfig.cmake.
61- configure_file (cmake/LSLConfig.cmake "${CMAKE_CURRENT_BINARY_DIR} /LSLConfig.cmake" COPYONLY )
62-
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-
7146# Install the version file and the helper CMake script.
7247install (
7348 FILES
74- # TODO: Keep this. But why does the configure_file(... COPYONLY) above exist?
7549 cmake/LSLCMake.cmake
76- # TODO: Next line shouldn't be necessary if install(EXPORT...) uses LSLConfig.cmake instead of LSLTargets.cmake
77- ${CMAKE_CURRENT_BINARY_DIR} /LSLConfig.cmake
7850 ${CMAKE_CURRENT_BINARY_DIR} /LSLConfigVersion.cmake
7951 COMPONENT liblsl
8052 DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/LSL
0 commit comments