Skip to content

Commit

Permalink
cmake: add "cmake" directory to install
Browse files Browse the repository at this point in the history
  • Loading branch information
mgates3 committed Aug 3, 2023
1 parent db03064 commit ca2b8a1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ endif()
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 <package>Targets.cmake
install(
Expand All @@ -171,7 +175,7 @@ if (testsweeper_install)
# Install <package>Targets.cmake
install(
EXPORT testsweeperTargets
DESTINATION ${INSTALL_CONFIGDIR}
DESTINATION "${install_configdir}"
)

# Also export <package>Targets.cmake in build directory
Expand All @@ -186,7 +190,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"
Expand All @@ -196,6 +200,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()

0 comments on commit ca2b8a1

Please sign in to comment.