From 155b0d40088a9d7831c2bb6292abd7350bc4b95d Mon Sep 17 00:00:00 2001 From: Bram Oosterhuis Date: Thu, 16 May 2024 11:30:24 +0200 Subject: [PATCH 1/3] cmake: include default install path --- CMakeLists.txt | 1 + cmake/project.cmake.in | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c40a9c3d..942a70463 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,7 @@ endif() include(platform) include(CmakeHelperFunctions) +include(GNUInstallDirs) set(PLATFORM "PC_UNIX" CACHE STRING "Defines on what platform the application will run") diff --git a/cmake/project.cmake.in b/cmake/project.cmake.in index ecf33ac0c..602111bc9 100644 --- a/cmake/project.cmake.in +++ b/cmake/project.cmake.in @@ -20,6 +20,8 @@ ## https://github.com/toeb/cmakepp ## +include(GNUInstallDirs) + macro(project_version) string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _VERSION_MAJOR "${ARGV0}") string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" _VERSION_MINOR "${ARGV0}") From d0682079fd609edd4578254903d476bc9524fcb4 Mon Sep 17 00:00:00 2001 From: Bram Oosterhuis Date: Thu, 16 May 2024 12:45:08 +0200 Subject: [PATCH 2/3] CMake: adopt CMAKE_INSTALL_ for install locations --- CMakeLists.txt | 6 ++-- Source/WPEFramework/CMakeLists.txt | 8 ++--- Source/WPEFramework/GenericConfig.cmake | 4 +-- Source/WPEFramework/scripts/CMakeLists.txt | 2 +- Source/WPEProcess/CMakeLists.txt | 8 ++--- Source/com/CMakeLists.txt | 36 +++++++++---------- Source/core/CMakeLists.txt | 12 +++---- Source/cryptalgo/CMakeLists.txt | 12 +++---- Source/extensions/hibernate/CMakeLists.txt | 12 +++---- Source/extensions/localtracer/CMakeLists.txt | 2 +- .../localtracer/example/CMakeLists.txt | 2 +- .../privilegedrequest/CMakeLists.txt | 2 +- .../privilegedrequest/example/CMakeLists.txt | 2 +- .../processcontainers/CMakeLists.txt | 12 +++---- .../warningreporting/CMakeLists.txt | 12 +++---- Source/messaging/CMakeLists.txt | 12 +++---- Source/plugins/CMakeLists.txt | 26 +++++++------- Source/websocket/CMakeLists.txt | 12 +++---- Tests/comrpctester/CMakeLists.txt | 2 +- Tests/file-unlink/CMakeLists.txt | 4 +-- Tests/httpsclient/CMakeLists.txt | 2 +- Tests/loader/CMakeLists.txt | 2 +- Tests/message-buffer/CMakeLists.txt | 2 +- Tests/redirect/CMakeLists.txt | 2 +- Tests/workerpool-test/CMakeLists.txt | 2 +- cmake/common/CmakeHelperFunctions.cmake | 13 +++---- docs/plugin/interfaces/interfaces.md | 8 ++--- 27 files changed, 110 insertions(+), 109 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 942a70463..bf68fc500 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,18 +97,18 @@ configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/project.cmake.in" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${NAMESPACE}.cmake" RENAME "${NAMESPACE}Config.cmake" - DESTINATION lib/cmake/${NAMESPACE}) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}) if(CMAKE_VERSION VERSION_LESS 3.20.0 AND LEGACY_CONFIG_GENERATOR) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/config" - DESTINATION lib/cmake/${NAMESPACE}) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}) endif(CMAKE_VERSION VERSION_LESS 3.20.0 AND LEGACY_CONFIG_GENERATOR) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/common" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates" - DESTINATION lib/cmake/${NAMESPACE}) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}) if(APPLE) # Mac needed variables diff --git a/Source/WPEFramework/CMakeLists.txt b/Source/WPEFramework/CMakeLists.txt index 610930d3f..a327e1c5a 100644 --- a/Source/WPEFramework/CMakeLists.txt +++ b/Source/WPEFramework/CMakeLists.txt @@ -100,10 +100,10 @@ set_target_properties(${TARGET} PROPERTIES install( TARGETS ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin COMPONENT libs # for mac + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac ) install(DIRECTORY diff --git a/Source/WPEFramework/GenericConfig.cmake b/Source/WPEFramework/GenericConfig.cmake index b657282f4..1ba8f47fa 100644 --- a/Source/WPEFramework/GenericConfig.cmake +++ b/Source/WPEFramework/GenericConfig.cmake @@ -284,7 +284,7 @@ json_write("${CMAKE_BINARY_DIR}/Config.json" ${CONFIG}) install( FILES ${CMAKE_BINARY_DIR}/Config.json - DESTINATION ${CMAKE_INSTALL_PREFIX}/../etc/${NAMESPACE}/ + DESTINATION ../${CMAKE_INSTALL_SYSCONFDIR}/${NAMESPACE}/ RENAME config.json COMPONENT ${MODULE_NAME}) else() @@ -295,7 +295,7 @@ else() SKIP_CLASSNAME SKIP_LOCATOR CUSTOM_PARAMS_WHITELIST "${CMAKE_CURRENT_LIST_DIR}/params.config" - INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/../etc/${NAMESPACE}/" + INSTALL_PATH "../${CMAKE_INSTALL_SYSCONFDIR}/${NAMESPACE}/" INSTALL_NAME "config.json" PLUGINS "WPEFramework" ) diff --git a/Source/WPEFramework/scripts/CMakeLists.txt b/Source/WPEFramework/scripts/CMakeLists.txt index e3639aa4e..01b44ba99 100644 --- a/Source/WPEFramework/scripts/CMakeLists.txt +++ b/Source/WPEFramework/scripts/CMakeLists.txt @@ -43,7 +43,7 @@ else() install( FILES ${CMAKE_CURRENT_BINARY_DIR}/wpeframework PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ - DESTINATION ${CMAKE_INSTALL_PREFIX}/../etc/init.d/ + DESTINATION ../${CMAKE_INSTALL_SYSCONFDIR}/init.d/ ) endif() diff --git a/Source/WPEProcess/CMakeLists.txt b/Source/WPEProcess/CMakeLists.txt index 166c8ba0e..77b08c4c1 100644 --- a/Source/WPEProcess/CMakeLists.txt +++ b/Source/WPEProcess/CMakeLists.txt @@ -69,8 +69,8 @@ set_target_properties(${TARGET} PROPERTIES install( TARGETS COMProcess ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin COMPONENT libs # for mac + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac ) diff --git a/Source/com/CMakeLists.txt b/Source/com/CMakeLists.txt index c69ea64a6..337670dc9 100644 --- a/Source/com/CMakeLists.txt +++ b/Source/com/CMakeLists.txt @@ -1,19 +1,19 @@ -# If not stated otherwise in this file or this component's license file the -# following copyright and licenses apply: +#If not stated otherwise in this file or this component's license file the +#following copyright and licenses apply: # -# Copyright 2020 Metrological +#Copyright 2020 Metrological # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +#Licensed under the Apache License, Version 2.0(the "License"); +#you may not use this file except in compliance with the License. +#You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +#http: // www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +#Unless required by applicable law or agreed to in writing, software +#distributed under the License is distributed on an "AS IS" BASIS, +#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +#See the License for the specific language governing permissions and +#limitations under the License. set(TARGET ${NAMESPACE}COM) @@ -93,12 +93,12 @@ set_target_properties(${TARGET} PROPERTIES install( TARGETS ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin COMPONENT libs # for mac - PUBLIC_HEADER DESTINATION include/${NAMESPACE}/com COMPONENT devel # headers for mac (note the different component -> different package) - INCLUDES DESTINATION include/${NAMESPACE} # default include path + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/com COMPONENT devel # headers for mac (note the different component -> different package) + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE} # default include path ) InstallCMakeConfig(TARGETS ${TARGET}) diff --git a/Source/core/CMakeLists.txt b/Source/core/CMakeLists.txt index 2268b5313..b00656d8a 100644 --- a/Source/core/CMakeLists.txt +++ b/Source/core/CMakeLists.txt @@ -271,12 +271,12 @@ endif() # =========================================================================================== install( TARGETS CompileSettings ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin COMPONENT libs # for mac - PUBLIC_HEADER DESTINATION include/${NAMESPACE}/core COMPONENT devel # for mac - INCLUDES DESTINATION include/${NAMESPACE} # default include path + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/core COMPONENT devel # for mac + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE} # default include path ) # =========================================================================================== diff --git a/Source/cryptalgo/CMakeLists.txt b/Source/cryptalgo/CMakeLists.txt index 3b5470de9..424a9e1c3 100644 --- a/Source/cryptalgo/CMakeLists.txt +++ b/Source/cryptalgo/CMakeLists.txt @@ -81,12 +81,12 @@ target_include_directories( ${TARGET} install( TARGETS ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin COMPONENT libs # for mac - PUBLIC_HEADER DESTINATION include/${NAMESPACE}/cryptalgo COMPONENT devel # headers for mac (note the different component -> different package) - INCLUDES DESTINATION include/${NAMESPACE} # default include path + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/cryptalgo COMPONENT devel # headers for mac (note the different component -> different package) + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE} # default include path ) InstallCMakeConfig(TARGETS ${TARGET}) diff --git a/Source/extensions/hibernate/CMakeLists.txt b/Source/extensions/hibernate/CMakeLists.txt index 284a235b8..42698598e 100644 --- a/Source/extensions/hibernate/CMakeLists.txt +++ b/Source/extensions/hibernate/CMakeLists.txt @@ -52,12 +52,12 @@ endif() install( TARGETS ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin COMPONENT libs # for mac - PUBLIC_HEADER DESTINATION include/${NAMESPACE}/hibernate COMPONENT devel # headers for mac (note the different component -> different package) - INCLUDES DESTINATION include/${NAMESPACE}/hibernate # headers + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/hibernate COMPONENT devel # headers for mac (note the different component -> different package) + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/hibernate # headers ) InstallCMakeConfig( diff --git a/Source/extensions/localtracer/CMakeLists.txt b/Source/extensions/localtracer/CMakeLists.txt index e3f039d31..7dbdafb0e 100644 --- a/Source/extensions/localtracer/CMakeLists.txt +++ b/Source/extensions/localtracer/CMakeLists.txt @@ -22,7 +22,7 @@ target_compile_features(${MODULE_NAME} INTERFACE cxx_std_11) install(TARGETS ${MODULE_NAME} EXPORT ${MODULE_NAME}Targets) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/localtracer/localtracer.h - DESTINATION include/${NAMESPACE}/localtracer) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/localtracer) include(HeaderOnlyInstall) diff --git a/Source/extensions/localtracer/example/CMakeLists.txt b/Source/extensions/localtracer/example/CMakeLists.txt index 874580049..09262ddad 100644 --- a/Source/extensions/localtracer/example/CMakeLists.txt +++ b/Source/extensions/localtracer/example/CMakeLists.txt @@ -8,5 +8,5 @@ target_link_libraries(local_trace_test PRIVATE ${NAMESPACE}LocalTracer::${NAMESPACE}LocalTracer) if(EXAMPLE_LOCALTRACER) - install(TARGETS local_trace_test DESTINATION bin) + install(TARGETS local_trace_test DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/Source/extensions/privilegedrequest/CMakeLists.txt b/Source/extensions/privilegedrequest/CMakeLists.txt index 752862a0a..a6969a552 100644 --- a/Source/extensions/privilegedrequest/CMakeLists.txt +++ b/Source/extensions/privilegedrequest/CMakeLists.txt @@ -38,7 +38,7 @@ install(TARGETS ${MODULE_NAME} EXPORT ${MODULE_NAME}Targets) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/privilegedrequest/PrivilegedRequest.h - DESTINATION include/${NAMESPACE}/privilegedrequest) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/privilegedrequest) include(HeaderOnlyInstall) diff --git a/Source/extensions/privilegedrequest/example/CMakeLists.txt b/Source/extensions/privilegedrequest/example/CMakeLists.txt index 4a83a2ae7..d4f7f8aac 100644 --- a/Source/extensions/privilegedrequest/example/CMakeLists.txt +++ b/Source/extensions/privilegedrequest/example/CMakeLists.txt @@ -24,5 +24,5 @@ target_link_libraries(fdpassing PRIVATE ) if(EXAMPLE_PRIVILEGEDREQUEST) -install(TARGETS fdpassing DESTINATION bin) +install(TARGETS fdpassing DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/Source/extensions/processcontainers/CMakeLists.txt b/Source/extensions/processcontainers/CMakeLists.txt index 8ed03ecd5..15b33f348 100644 --- a/Source/extensions/processcontainers/CMakeLists.txt +++ b/Source/extensions/processcontainers/CMakeLists.txt @@ -150,12 +150,12 @@ endif() install( TARGETS ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin COMPONENT libs # for mac - PUBLIC_HEADER DESTINATION include/${NAMESPACE}/processcontainers COMPONENT devel # headers for mac (note the different component -> different package) - INCLUDES DESTINATION include/${NAMESPACE}/processcontainers # headers + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/processcontainers COMPONENT devel # headers for mac (note the different component -> different package) + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/processcontainers # headers ) InstallCMakeConfig( diff --git a/Source/extensions/warningreporting/CMakeLists.txt b/Source/extensions/warningreporting/CMakeLists.txt index f150297ec..65d18bdf0 100644 --- a/Source/extensions/warningreporting/CMakeLists.txt +++ b/Source/extensions/warningreporting/CMakeLists.txt @@ -57,12 +57,12 @@ target_include_directories( ${TARGET} install( TARGETS ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin COMPONENT libs # for mac - PUBLIC_HEADER DESTINATION include/${NAMESPACE}/warningreporting COMPONENT devel # headers for mac (note the different component -> different package) - INCLUDES DESTINATION include/${NAMESPACE} # default include path + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/warningreporting COMPONENT devel # headers for mac (note the different component -> different package) + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE} # default include path ) InstallCMakeConfig(TARGETS ${TARGET}) diff --git a/Source/messaging/CMakeLists.txt b/Source/messaging/CMakeLists.txt index c7bb2fe40..35085c5e9 100644 --- a/Source/messaging/CMakeLists.txt +++ b/Source/messaging/CMakeLists.txt @@ -72,12 +72,12 @@ target_include_directories( ${TARGET} install( TARGETS ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin COMPONENT libs # for mac - PUBLIC_HEADER DESTINATION include/${NAMESPACE}/messaging COMPONENT devel # headers for mac (note the different component -> different package) - INCLUDES DESTINATION include/${NAMESPACE} # default include path + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/messaging COMPONENT devel # headers for mac (note the different component -> different package) + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE} # default include path ) InstallCMakeConfig(TARGETS ${TARGET}) diff --git a/Source/plugins/CMakeLists.txt b/Source/plugins/CMakeLists.txt index 4f751fc19..867b41ba7 100644 --- a/Source/plugins/CMakeLists.txt +++ b/Source/plugins/CMakeLists.txt @@ -142,26 +142,26 @@ set_target_properties(${TARGET_PROXYSTUBS} PROPERTIES # =========================================================================================== install( TARGETS ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin COMPONENT libs # for mac - PUBLIC_HEADER DESTINATION include/${NAMESPACE}/plugins COMPONENT devel # for mac - INCLUDES DESTINATION include/${NAMESPACE} # default include path + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/plugins COMPONENT devel # for mac + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE} # default include path ) install( - FILES ${JSON_DATA_HEADERS} DESTINATION include/${NAMESPACE}/plugins/json COMPONENT devel # for mac + FILES ${JSON_DATA_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/plugins/json COMPONENT devel # for mac ) install( TARGETS ${TARGET_PROXYSTUBS} EXPORT ${TARGET_PROXYSTUBS}Targets # for downstream dependencies - ARCHIVE DESTINATION lib/${NAMESPACE_LIB}/proxystubs COMPONENT libs # static lib - LIBRARY DESTINATION lib/${NAMESPACE_LIB}/proxystubs COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin/${NAMESPACE_LIB}/proxystubs COMPONENT libs # for mac - PUBLIC_HEADER DESTINATION include/${NAMESPACE}/proxystubs COMPONENT devel # for mac - INCLUDES DESTINATION include/${NAMESPACE}/proxystubs # headers + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${NAMESPACE_LIB}/proxystubs COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${NAMESPACE_LIB}/proxystubs COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR}/${NAMESPACE_LIB}/proxystubs COMPONENT libs # for mac + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/proxystubs COMPONENT devel # for mac + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/proxystubs # headers ) # =========================================================================================== diff --git a/Source/websocket/CMakeLists.txt b/Source/websocket/CMakeLists.txt index f37f4ebee..739ef702a 100644 --- a/Source/websocket/CMakeLists.txt +++ b/Source/websocket/CMakeLists.txt @@ -71,12 +71,12 @@ target_include_directories( ${TARGET} install( TARGETS ${TARGET} EXPORT ${TARGET}Targets # for downstream dependencies - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib - RUNTIME DESTINATION bin COMPONENT libs # binaries - FRAMEWORK DESTINATION bin COMPONENT libs # for mac - PUBLIC_HEADER DESTINATION include/${NAMESPACE}/websocket COMPONENT devel # headers for mac (note the different component -> different package) - INCLUDES DESTINATION include/${NAMESPACE} # default include path + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # static lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs # shared lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries + FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # for mac + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/websocket COMPONENT devel # headers for mac (note the different component -> different package) + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE} # default include path ) install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink websocket ${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/${NAMESPACE}/jsonrpc)") diff --git a/Tests/comrpctester/CMakeLists.txt b/Tests/comrpctester/CMakeLists.txt index 23e239861..e6b7b9b39 100644 --- a/Tests/comrpctester/CMakeLists.txt +++ b/Tests/comrpctester/CMakeLists.txt @@ -28,5 +28,5 @@ set_target_properties(comrpctester PROPERTIES CXX_STANDARD_REQUIRED YES ) -install(TARGETS comrpctester DESTINATION bin) +install(TARGETS comrpctester DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/Tests/file-unlink/CMakeLists.txt b/Tests/file-unlink/CMakeLists.txt index 7f9239523..c3b53a425 100644 --- a/Tests/file-unlink/CMakeLists.txt +++ b/Tests/file-unlink/CMakeLists.txt @@ -29,6 +29,6 @@ set_target_properties(FileClient PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES ) -install(TARGETS FileClient DESTINATION bin) -install(TARGETS FileMaster DESTINATION bin) +install(TARGETS FileClient DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS FileMaster DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/Tests/httpsclient/CMakeLists.txt b/Tests/httpsclient/CMakeLists.txt index ea02291f2..d3f02a892 100644 --- a/Tests/httpsclient/CMakeLists.txt +++ b/Tests/httpsclient/CMakeLists.txt @@ -16,4 +16,4 @@ target_link_libraries(httpsclient_test ${NAMESPACE}WebSocket ) -install(TARGETS httpsclient_test DESTINATION bin) +install(TARGETS httpsclient_test DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/Tests/loader/CMakeLists.txt b/Tests/loader/CMakeLists.txt index a9848c52e..1d9c450e9 100644 --- a/Tests/loader/CMakeLists.txt +++ b/Tests/loader/CMakeLists.txt @@ -31,5 +31,5 @@ set_target_properties(WPELibraryTestLoader PROPERTIES CXX_STANDARD_REQUIRED YES ) -install(TARGETS WPELibraryTestLoader DESTINATION bin) +install(TARGETS WPELibraryTestLoader DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/Tests/message-buffer/CMakeLists.txt b/Tests/message-buffer/CMakeLists.txt index 0088bce2d..df4e3ab7e 100644 --- a/Tests/message-buffer/CMakeLists.txt +++ b/Tests/message-buffer/CMakeLists.txt @@ -31,4 +31,4 @@ set_target_properties(MessageBufferTest PROPERTIES CXX_STANDARD_REQUIRED YES ) -install(TARGETS MessageBufferTest DESTINATION bin) +install(TARGETS MessageBufferTest DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/Tests/redirect/CMakeLists.txt b/Tests/redirect/CMakeLists.txt index 539bd02bf..9e3597d38 100644 --- a/Tests/redirect/CMakeLists.txt +++ b/Tests/redirect/CMakeLists.txt @@ -29,5 +29,5 @@ set_target_properties(redirect PROPERTIES SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") -install(TARGETS redirect DESTINATION bin) +install(TARGETS redirect DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/Tests/workerpool-test/CMakeLists.txt b/Tests/workerpool-test/CMakeLists.txt index 3b60232a5..0e4346d8b 100644 --- a/Tests/workerpool-test/CMakeLists.txt +++ b/Tests/workerpool-test/CMakeLists.txt @@ -10,4 +10,4 @@ target_link_libraries(WorkerPoolTest ${NAMESPACE}Core ) -install(TARGETS WorkerPoolTest DESTINATION bin) +install(TARGETS WorkerPoolTest DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/cmake/common/CmakeHelperFunctions.cmake b/cmake/common/CmakeHelperFunctions.cmake index 318758e12..457193fe7 100644 --- a/cmake/common/CmakeHelperFunctions.cmake +++ b/cmake/common/CmakeHelperFunctions.cmake @@ -15,7 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -include (CMakePackageConfigHelpers) +include(CMakePackageConfigHelpers) +include(GNUInstallDirs) macro(add_element list element) list(APPEND ${list} ${element}) @@ -307,7 +308,7 @@ function(InstallCMakeConfig) message(FATAL_ERROR "Unknown keywords given to InstallCMakeConfig(): \"${Argument_UNPARSED_ARGUMENTS}\"") endif() - set(_install_path "lib/cmake") # default path + set(_install_path "${CMAKE_INSTALL_LIBDIR}/cmake") # default path if(Agument_LOCATION) set(_install_path "${Agument_LOCATION}" FORCE) @@ -542,7 +543,7 @@ function(InstallPackageConfig) endif() # Default path on UNIX, if you want Windows or Apple support add the path here. ;-) - set(_install_path "lib/pkgconfig") + set(_install_path "${CMAKE_INSTALL_LIBDIR}/pkgconfig") if (${Argument_OUTPUT_NAME}) set(_pc_filename ${Argument_OUTPUT_NAME}) @@ -625,7 +626,7 @@ function(InstallFindModule) cmake_parse_arguments(Argument "${optionsArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) - set(DESTINATION lib/cmake/${NAMESPACE}/modules) + set(DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/modules) if(Argument_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown keywords given to InstallCMakeConfig(): \"${Argument_UNPARSED_ARGUMENTS}\"") @@ -637,11 +638,11 @@ function(InstallFindModule) else() file(GLOB_RECURSE extra_files "${DIRECTORY}/*.cmake") endif(Argument_RECURSE) - install(FILES "${extra_files}" DESTINATION lib/cmake/${NAMESPACE}/modules) + install(FILES "${extra_files}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/modules) endif() if (Argument_FILES) - install(FILES "${Argument_FILES}" DESTINATION lib/cmake/${NAMESPACE}/modules) + install(FILES "${Argument_FILES}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/modules) endif() endfunction(InstallFindModule) diff --git a/docs/plugin/interfaces/interfaces.md b/docs/plugin/interfaces/interfaces.md index b5c434183..5a293a7c0 100644 --- a/docs/plugin/interfaces/interfaces.md +++ b/docs/plugin/interfaces/interfaces.md @@ -185,22 +185,22 @@ endif() string(TOLOWER ${NAMESPACE} NAMESPACE_LIB) install(TARGETS ExampleProxyStubs EXPORT ExampleProxyStubsTargets # for downstream dependencies - LIBRARY DESTINATION lib/${NAMESPACE_LIB}/proxystubs COMPONENT libs # shared lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${NAMESPACE_LIB}/proxystubs COMPONENT libs # shared lib ) if(JSON_ENUM_SOURCES) install(TARGETS ExampleDefinitions EXPORT ExampleDefinitionsTargets # for downstream dependencies - LIBRARY DESTINATION lib/ COMPONENT libs # shared lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/ COMPONENT libs # shared lib ) endif() install(FILES ${INTERFACES_HEADERS} - DESTINATION include/${NAMESPACE}/interfaces + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/interfaces ) install(FILES ${JSON_HEADERS} - DESTINATION include/${NAMESPACE}/interfaces/json + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/interfaces/json ) ``` From 12dab09dc5e386e2e4e5ac875f204a88046f71c3 Mon Sep 17 00:00:00 2001 From: Bram Oosterhuis Date: Thu, 16 May 2024 14:48:30 +0200 Subject: [PATCH 3/3] CMake: adopt CMAKE_INSTALL_LIBDIR for more locations --- CMakeLists.txt | 2 +- Source/WPEFramework/GenericConfig.cmake | 4 ++-- Source/WPEFramework/scripts/CMakeLists.txt | 2 +- Tests/unit/core/CMakeLists.txt | 2 +- cmake/common/CmakeHelperFunctions.cmake | 12 ++++++------ cmake/common/HeaderOnlyInstall.cmake | 10 +++++----- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf68fc500..18cdc5b7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,7 @@ if(APPLE) set(CMAKE_MACOSX_RPATH ON) set(CMAKE_SKIP_BUILD_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) endif() diff --git a/Source/WPEFramework/GenericConfig.cmake b/Source/WPEFramework/GenericConfig.cmake index 1ba8f47fa..9e8b6892b 100644 --- a/Source/WPEFramework/GenericConfig.cmake +++ b/Source/WPEFramework/GenericConfig.cmake @@ -25,10 +25,10 @@ set(SOFT_KILL_CHECK_WAIT_TIME 10 CACHE STRING "Soft kill check waiting time") set(HARD_KILL_CHECK_WAIT_TIME 4 CACHE STRING "Hard kill check waiting time") set(PERSISTENT_PATH "/root" CACHE STRING "Persistent path") set(DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/${NAMESPACE}" CACHE STRING "Data path") -set(SYSTEM_PATH "${CMAKE_INSTALL_PREFIX}/lib/${NAMESPACE_LIB}/plugins" CACHE STRING "System path") +set(SYSTEM_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${NAMESPACE_LIB}/plugins" CACHE STRING "System path") set(WEBSERVER_PATH "/boot/www" CACHE STRING "Root path for the HTTP server") set(WEBSERVER_PORT 8080 CACHE STRING "Port for the HTTP server") -set(PROXYSTUB_PATH "${CMAKE_INSTALL_PREFIX}/lib/${NAMESPACE_LIB}/proxystubs" CACHE STRING "Proxy stub path") +set(PROXYSTUB_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${NAMESPACE_LIB}/proxystubs" CACHE STRING "Proxy stub path") set(POSTMORTEM_PATH "/opt/minidumps" CACHE STRING "Core file path to do the postmortem of the crash") set(MESSAGECONTROL_PATH "MessageDispatcher" CACHE STRING "MessageControl base path to create message files") set(MESSAGING_PORT 0 CACHE STRING "The port for the messaging") diff --git a/Source/WPEFramework/scripts/CMakeLists.txt b/Source/WPEFramework/scripts/CMakeLists.txt index 01b44ba99..01bf29c13 100644 --- a/Source/WPEFramework/scripts/CMakeLists.txt +++ b/Source/WPEFramework/scripts/CMakeLists.txt @@ -26,7 +26,7 @@ if (SYSTEMD_SERVICE) ) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/wpeframework.service "${MOD_WPEFRAMEWORK_SYSTEMD_SERVICE}") - install(DIRECTORY DESTINATION ${CMAKE_INSTALL_PREFIX}/../lib) + install(DIRECTORY DESTINATION ${CMAKE_INSTALL_PREFIX}/../${CMAKE_INSTALL_LIBDIR}) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/wpeframework.service PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ diff --git a/Tests/unit/core/CMakeLists.txt b/Tests/unit/core/CMakeLists.txt index 79d28d528..5b1323de6 100644 --- a/Tests/unit/core/CMakeLists.txt +++ b/Tests/unit/core/CMakeLists.txt @@ -123,7 +123,7 @@ add_library(helloworld SHARED test_library_helloworld.cpp) install( TARGETS helloworld - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/testdata) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/testdata) add_test(NAME ${TEST_RUNNER_NAME} COMMAND ${TEST_RUNNER_NAME}) diff --git a/cmake/common/CmakeHelperFunctions.cmake b/cmake/common/CmakeHelperFunctions.cmake index 457193fe7..d065de361 100644 --- a/cmake/common/CmakeHelperFunctions.cmake +++ b/cmake/common/CmakeHelperFunctions.cmake @@ -30,7 +30,7 @@ function(_get_default_link_name lib name location) get_filename_component(_location "${_rel_location}" DIRECTORY) if(NOT "${_location}" STREQUAL "") - string(REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}/lib" "" _location ${_location}) + string(REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" "" _location ${_location}) get_filename_component(_location "${_rel_location}" DIRECTORY) endif() @@ -317,7 +317,7 @@ function(InstallCMakeConfig) if("${Argument_TEMPLATE}" STREQUAL "") find_file( _config_template NAMES "defaultConfig.cmake.in" - PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/lib/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/lib/cmake/${NAMESPACE}/templates" + PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH @@ -327,7 +327,7 @@ function(InstallCMakeConfig) find_file(_config_template NAMES "defaultConfig.cmake.in" - PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/lib/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/lib/cmake/${NAMESPACE}/templates" ) + PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" ) if(NOT EXISTS "${_config_template}") message(SEND_ERROR "Config file generation failed, template '${_config_template}' not found") @@ -480,7 +480,7 @@ function(InstallPackageConfig) if("${Argument_TEMPLATE}" STREQUAL "") find_file( _pc_template NAMES "default.pc.in" - PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/lib/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/lib/cmake/${NAMESPACE}/templates" + PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH @@ -490,7 +490,7 @@ function(InstallPackageConfig) find_file(_pc_template NAMES "default.pc.in" - PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/lib/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/lib/cmake/${NAMESPACE}/templates") + PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates") if(NOT EXISTS "${_pc_template}") message(SEND_ERROR "PC file generation failed, template '${_pc_template}' not found") @@ -588,7 +588,7 @@ function(InstallPackageConfig) get_if_link_libraries(libraries link_dirs ${_target}) if(NOT Argument_NO_DEFAULT_LIB_DIR_FILTER) - # remove the default library dir e.g /usr/lib + # remove the default library dir e.g /usr/${CMAKE_INSTALL_LIBDIR} list(LENGTH link_dirs _link_dirs_count) if (_link_dirs_count GREATER 0) list(REMOVE_ITEM link_dirs "${CMAKE_INSTALL_PREFIX}/${TARGET_LIBRARY_DIR}") diff --git a/cmake/common/HeaderOnlyInstall.cmake b/cmake/common/HeaderOnlyInstall.cmake index e7d68c063..93ca517b6 100644 --- a/cmake/common/HeaderOnlyInstall.cmake +++ b/cmake/common/HeaderOnlyInstall.cmake @@ -21,7 +21,7 @@ function(HeaderOnlyInstallCMakeConfig) if("${Argument_TEMPLATE}" STREQUAL "") find_file( _config_template NAMES "defaultConfig.cmake.in" - PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/lib/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/lib/cmake/${NAMESPACE}/templates" + PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH @@ -31,7 +31,7 @@ function(HeaderOnlyInstallCMakeConfig) find_file(_config_template NAMES "defaultConfig.cmake.in" - PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/lib/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/lib/cmake/${NAMESPACE}/templates" ) + PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" ) if(NOT EXISTS "${_config_template}") message(SEND_ERROR "Config file generation failed, template '${_config_template}' not found") @@ -174,7 +174,7 @@ function(HeaderOnlyInstallPackageConfig) if("${Argument_TEMPLATE}" STREQUAL "") find_file( _pc_template NAMES "default.pc.in" - PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/lib/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/lib/cmake/${NAMESPACE}/templates" + PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH @@ -184,7 +184,7 @@ function(HeaderOnlyInstallPackageConfig) find_file(_pc_template NAMES "default.pc.in" - PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/lib/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/lib/cmake/${NAMESPACE}/templates") + PATHS "${PROJECT_SOURCE_DIR}/cmake/templates" "${CMAKE_SYSROOT}/usr/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/${NAMESPACE}/templates") if(NOT EXISTS "${_pc_template}") message(SEND_ERROR "PC file generation failed, template '${_pc_template}' not found") @@ -274,7 +274,7 @@ function(HeaderOnlyInstallPackageConfig) get_if_link_libraries(libraries link_dirs ${TARGET}) if(NOT Argument_NO_DEFAULT_LIB_DIR_FILTER) - # remove the default library dir e.g /usr/lib + # remove the default library dir e.g /usr/${CMAKE_INSTALL_LIBDIR} list(LENGTH link_dirs _link_dirs_count) if (_link_dirs_count GREATER 0) list(REMOVE_ITEM link_dirs "${CMAKE_INSTALL_PREFIX}/${TARGET_LIBRARY_DIR}")