Skip to content

Commit f4e3163

Browse files
authored
Merge pull request #144 from ClausKlein/feature/install_file_set_headers_too [skip ci]
install FILE_SET HEADERS for the new CMake versions
2 parents ce343c8 + 889e14e commit f4e3163

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/PackageProject.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,22 @@ function(package_project)
148148
# Installation of package (compatible with vcpkg, etc)
149149
set(_targets_list ${_PackageProject_TARGETS})
150150
unset(_PackageProject_TARGETS) # to avoid ycm conflict
151+
152+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.23.0")
153+
# required in CMake 3.23 and more
154+
set(FILE_SET_ARGS "FILE_SET" "HEADERS")
155+
endif()
156+
151157
install(
152158
TARGETS ${_targets_list}
153159
EXPORT ${_PackageProject_EXPORT}
154160
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
155161
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
156162
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
157-
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_PackageProject_NAME}" COMPONENT dev)
163+
PUBLIC_HEADER
164+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_PackageProject_NAME}"
165+
COMPONENT dev
166+
${FILE_SET_ARGS})
158167

159168
# download ForwardArguments
160169
FetchContent_Declare(

0 commit comments

Comments
 (0)