diff options
author | Andrea Pappacoda <[email protected]> | 2021-11-09 10:34:05 +0100 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2021-11-10 08:53:06 +1300 |
commit | e690fc21bbfbedaf61a704fbc86c4bbdc304b5ed (patch) | |
tree | 762f12b3dbdf1547a7d3d8e71bbef6e073d1f132 | |
parent | a4e701ff602eb38d12f24e6ea2424336b470e225 (diff) | |
download | cubeb-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
-rw-r--r-- | CMakeLists.txt | 28 | ||||
-rw-r--r-- | Config.cmake.in | 2 |
2 files changed, 8 insertions, 22 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 diff --git a/Config.cmake.in b/Config.cmake.in index c5326ef..be464aa 100644 --- a/Config.cmake.in +++ b/Config.cmake.in @@ -1,4 +1,4 @@ @PACKAGE_INIT@ include("${CMAKE_CURRENT_LIST_DIR}/cubebTargets.cmake") -check_required_components(cubeb)
\ No newline at end of file +check_required_components(cubeb) |