Skip to content

Commit 62fa283

Browse files
[CMake] Group all 'install' commands in one place
1 parent d1940ad commit 62fa283

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,6 @@ target_include_directories(
145145
umf_headers INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
146146
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
147147

148-
# Add the include directory and the headers target to the install.
149-
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
150-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
151-
152-
install(TARGETS umf_headers EXPORT ${PROJECT_NAME}-targets)
153-
154148
if(WINDOWS)
155149
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
156150
# set PATH to DLLs on Windows
@@ -375,13 +369,21 @@ if(UMF_FORMAT_CODE_STYLE)
375369
COMMENT "Format files using clang-format and cmake-format")
376370
endif()
377371

378-
# Add license to the installation path
372+
# --------------------------------------------------------------------------- #
373+
# Configure make install/uninstall and packages
374+
# --------------------------------------------------------------------------- #
379375
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.TXT
380376
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}/")
381377

382378
install(FILES examples/basic/basic.c
383379
DESTINATION "${CMAKE_INSTALL_DOCDIR}/examples")
384380

381+
# Add the include directory and the headers target to the install.
382+
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
383+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
384+
385+
install(TARGETS umf_headers EXPORT ${PROJECT_NAME}-targets)
386+
385387
# Add the list of installed targets to the install. This includes the namespace
386388
# which all installed targets will be prefixed with, e.g. for the headers target
387389
# users will depend on ${PROJECT_NAME}::headers.
@@ -408,6 +410,7 @@ install(FILES ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake
408410
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config-version.cmake
409411
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
410412

413+
# Configure uninstall commands
411414
configure_file("${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
412415
"${PROJECT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
413416

0 commit comments

Comments
 (0)