aboutsummaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAndrea Pappacoda <[email protected]>2021-11-09 10:34:05 +0100
committerMatthew Gregan <[email protected]>2021-11-10 08:53:06 +1300
commite690fc21bbfbedaf61a704fbc86c4bbdc304b5ed (patch)
tree762f12b3dbdf1547a7d3d8e71bbef6e073d1f132 /CMakeLists.txt
parenta4e701ff602eb38d12f24e6ea2424336b470e225 (diff)
downloadcubeb-e690fc21bbfbedaf61a704fbc86c4bbdc304b5ed.tar.gz
cubeb-e690fc21bbfbedaf61a704fbc86c4bbdc304b5ed.zip
build: minor CMake cleanups
These are minor cleanups that do not affect the behaviour of the script. In particular, I removed most `DESTINATION` arguments from `install()`, since they are automatically deduced based on the type of file to be installed. In #662 I also added doxygen_add_docs and gtest_discover_tests, but they require CMake version 3.9 and 3.10 respectively, and I think that the advantages they provide are not worth dropping support for older versions
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt28
1 files changed, 7 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 651953d..66f87eb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,17 +99,9 @@ target_include_directories(cubeb
PUBLIC $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/exports>
)
-if(UNIX)
- include(GNUInstallDirs)
-else()
- set(CMAKE_INSTALL_LIBDIR "lib")
- set(CMAKE_INSTALL_BINDIR "bin")
- set(CMAKE_INSTALL_DATADIR "share")
- set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATADIR}/doc")
- set(CMAKE_INSTALL_INCLUDEDIR "include")
-endif()
+include(GNUInstallDirs)
-install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/${PROJECT_NAME} TYPE INCLUDE)
install(DIRECTORY ${CMAKE_BINARY_DIR}/exports/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
include(CMakePackageConfigHelpers)
@@ -124,18 +116,12 @@ configure_package_config_file(
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
-install(TARGETS cubeb
- EXPORT "${PROJECT_NAME}Targets"
- DESTINATION ${CMAKE_INSTALL_PREFIX}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-)
install(
FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
+
+install(TARGETS cubeb EXPORT "${PROJECT_NAME}Targets")
install(
EXPORT "${PROJECT_NAME}Targets"
NAMESPACE "${PROJECT_NAME}::"
@@ -383,7 +369,7 @@ if(BUILD_TESTS)
target_link_libraries(test_${NAME} PRIVATE cubeb gtest_main)
add_test(${NAME} test_${NAME})
add_sanitizers(test_${NAME})
- install(TARGETS test_${NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
+ install(TARGETS test_${NAME})
endmacro(cubeb_add_test)
cubeb_add_test(sanity)
@@ -398,7 +384,7 @@ if(BUILD_TESTS)
target_link_libraries(test_resampler PRIVATE cubeb gtest_main speex)
add_test(resampler test_resampler)
add_sanitizers(test_resampler)
- install(TARGETS test_resampler DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
+ install(TARGETS test_resampler)
cubeb_add_test(duplex)
@@ -420,7 +406,7 @@ if(BUILD_TOOLS)
target_include_directories(cubeb-test PRIVATE src)
target_link_libraries(cubeb-test PRIVATE cubeb)
add_sanitizers(cubeb-test)
- install(TARGETS cubeb-test DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
+ install(TARGETS cubeb-test)
endif()
add_custom_target(clang-format-check