diff --git a/CMakeLists.txt b/CMakeLists.txt index 541c759..6995272 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required( VERSION 3.15 ) # 3.1 target_compile_features -# 3.8 target_compile_features( cxx_std_11 ) +# 3.8 target_compile_features( cxx_std_17 ) # 3.14 install( LIBRARY DESTINATION lib ) default # 3.15 $<$COMPILE_LANG_AND_ID # optional # 3.15 message DEBUG @@ -147,31 +147,37 @@ if (testsweeper_is_project) endif() #------------------------------------------------------------------------------- +# Install rules. # When TestSweeper is used as a sub-project, # the parent (e.g., BLAS++) may not want to install it. if (testsweeper_install) # GNU Filesystem Conventions include( GNUInstallDirs ) - set( INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/testsweeper ) + if (WIN32) + set( install_configdir "testsweeper" ) + else() + set( install_configdir "${CMAKE_INSTALL_LIBDIR}/cmake/testsweeper" ) + endif() # Install library and add to Targets.cmake install( TARGETS testsweeper EXPORT testsweeperTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # no default before 3.14 - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ) # Install header files install( FILES "testsweeper.hh" - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) # Install Targets.cmake install( EXPORT testsweeperTargets - DESTINATION ${INSTALL_CONFIGDIR} + DESTINATION "${install_configdir}" ) # Also export Targets.cmake in build directory @@ -186,7 +192,7 @@ if (testsweeper_install) configure_package_config_file( "testsweeperConfig.cmake.in" "testsweeperConfig.cmake" - INSTALL_DESTINATION ${INSTALL_CONFIGDIR} + INSTALL_DESTINATION "${install_configdir}" ) write_basic_package_version_file( "testsweeperConfigVersion.cmake" @@ -196,6 +202,6 @@ if (testsweeper_install) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/testsweeperConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/testsweeperConfigVersion.cmake" - DESTINATION ${INSTALL_CONFIGDIR} + DESTINATION "${install_configdir}" ) endif()