Skip to content

Commit f1e0876

Browse files
[CMake] Group all 'install' commands in one place
1 parent 775a1ea commit f1e0876

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
@@ -142,12 +142,6 @@ target_include_directories(
142142
umf_headers INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
143143
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
144144

145-
# Add the include directory and the headers target to the install.
146-
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
147-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
148-
149-
install(TARGETS umf_headers EXPORT ${PROJECT_NAME}-targets)
150-
151145
if(WINDOWS)
152146
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
153147
# set PATH to DLLs on Windows
@@ -372,7 +366,9 @@ if(UMF_FORMAT_CODE_STYLE)
372366
COMMENT "Format files using clang-format and cmake-format")
373367
endif()
374368

375-
# Add license to the installation path
369+
# --------------------------------------------------------------------------- #
370+
# Configure make install/uninstall and packages
371+
# --------------------------------------------------------------------------- #
376372
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.TXT
377373
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}/")
378374

@@ -382,6 +378,12 @@ install(
382378
FILES_MATCHING
383379
PATTERN "*.c")
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)