diff --git a/projects/amdsmi/CMakeLists.txt b/projects/amdsmi/CMakeLists.txt index 31aa11d5dc..a709822e95 100755 --- a/projects/amdsmi/CMakeLists.txt +++ b/projects/amdsmi/CMakeLists.txt @@ -55,6 +55,8 @@ include(GNUInstallDirs) option(BUILD_TESTS "Build test suite" OFF) option(ENABLE_LDCONFIG "Set library links and caches using ldconfig." ON) +# Set share path here because project name != amd_smi +set(SHARE_INSTALL_PREFIX "share/${AMD_SMI}" CACHE STRING "Tests and Example install directory") # Packaging directives set(CPACK_PACKAGE_NAME ${AMD_SMI_PACKAGE} @@ -212,6 +214,7 @@ install( #License file set(CPACK_RPM_PACKAGE_LICENSE "NCSA") +# docs are installed into different share directory from tests and examples install( FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION share/doc/${AMD_SMI} diff --git a/projects/amdsmi/cmake_modules/help_package.cmake b/projects/amdsmi/cmake_modules/help_package.cmake index e1d74f4114..94f71ce5d1 100644 --- a/projects/amdsmi/cmake_modules/help_package.cmake +++ b/projects/amdsmi/cmake_modules/help_package.cmake @@ -14,13 +14,15 @@ function(generic_add_rocm) set(CMAKE_INSTALL_PREFIX ${ROCM_DIR} CACHE STRING "Default installation directory.") set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE STRING "Default packaging prefix.") - set(SHARE_INSTALL_PREFIX "share/${CMAKE_PROJECT_NAME}" CACHE STRING "Tests and Example install directory") # add package search paths set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /usr/local PARENT_SCOPE) set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /usr/lib64 /usr/lib/x86_64-linux-gnu PARENT_SCOPE) endfunction() function(generic_package) + # Used by test and example CMakeLists + set(SHARE_INSTALL_PREFIX "share/${CMAKE_PROJECT_NAME}" CACHE STRING "Tests and Example install directory") + if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4.0) message("Compiler version is " ${CMAKE_CXX_COMPILER_VERSION}) message(FATAL_ERROR "Require at least gcc-5.4.0") diff --git a/projects/amdsmi/example/CMakeLists.txt b/projects/amdsmi/example/CMakeLists.txt index ba375c27cd..f8cbbb41b9 100644 --- a/projects/amdsmi/example/CMakeLists.txt +++ b/projects/amdsmi/example/CMakeLists.txt @@ -4,7 +4,7 @@ # copy .cc files into install directory install( DIRECTORY ./ - DESTINATION share/example/amd-smi + DESTINATION ${SHARE_INSTALL_PREFIX}/example FILES_MATCHING PATTERN "*.cc") @@ -12,7 +12,7 @@ install( install( FILES CMakeLists.txt.in RENAME CMakeLists.txt - DESTINATION share/example/amd-smi) + DESTINATION ${SHARE_INSTALL_PREFIX}/example) # compile example files but do not install # this is only useful if running from build directory diff --git a/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt b/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt index 090ce93d7d..93c2bbab04 100644 --- a/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt +++ b/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt @@ -68,5 +68,5 @@ target_link_libraries(${TEST} amd_smi c stdc++ pthread GTest::gtest_main) # TODO: Remove GTest from here in the future and rely on INSTALL_GTEST? install( TARGETS ${TEST} gtest gtest_main - DESTINATION ${SHARE_INSTALL_PREFIX}/tests/amd_smi + DESTINATION ${SHARE_INSTALL_PREFIX}/tests COMPONENT tests) diff --git a/projects/amdsmi/tests/rocm_smi_test/CMakeLists.txt b/projects/amdsmi/tests/rocm_smi_test/CMakeLists.txt index 30fde142ab..456cb225fe 100755 --- a/projects/amdsmi/tests/rocm_smi_test/CMakeLists.txt +++ b/projects/amdsmi/tests/rocm_smi_test/CMakeLists.txt @@ -60,5 +60,5 @@ target_link_libraries(${TEST} rocm_smi64 c stdc++ pthread GTest::gtest_main) #install( # TARGETS ${TEST} -# DESTINATION ${SHARE_INSTALL_PREFIX}/tests/amd_smi +# DESTINATION ${SHARE_INSTALL_PREFIX}/tests # COMPONENT tests)