Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conventional install locations #98

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ if (NANOBENCH_STANDALONE_PROJECT)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

option(NANOBENCH_BUILD_TEST "Build nanobench tests" ON)

# configuration see .clang-tidy
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
find_program(CLANG_TIDY_PROGRAM NAMES clang-tidy)
Expand Down Expand Up @@ -84,8 +86,10 @@ if (NANOBENCH_STANDALONE_PROJECT)


include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/cmake)
set(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
set(
NANOBENCH_INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
CACHE PATH "Installation directory for CMake configuration files"
)

# Install library target
add_library(nanobench STATIC ${PROJECT_SOURCE_DIR}/src/test/app/nanobench.cpp)
Expand All @@ -98,8 +102,6 @@ if (NANOBENCH_STANDALONE_PROJECT)
install(
TARGETS nanobench
EXPORT install_targets
LIBRARY DESTINATION ${INSTALL_LIBDIR}
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
)

# Install targets file
Expand All @@ -109,19 +111,19 @@ if (NANOBENCH_STANDALONE_PROJECT)
NAMESPACE
${PROJECT_NAME}::
DESTINATION
${INSTALL_CONFIGDIR}
${NANOBENCH_INSTALL_CONFIGDIR}
)

# Install ${PROJECT_NAME}Config.cmake
include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION ${INSTALL_CONFIGDIR}
INSTALL_DESTINATION ${NANOBENCH_INSTALL_CONFIGDIR}
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
DESTINATION ${INSTALL_CONFIGDIR}
DESTINATION ${NANOBENCH_INSTALL_CONFIGDIR}
)

# Install headers
Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
add_subdirectory(cmake)
add_subdirectory(include)
add_subdirectory(test)
if(NANOBENCH_BUILD_TEST)
add_subdirectory(test)
endif()