From cda8e2c746e29a8f46f177690c37a666e8c2ee45 Mon Sep 17 00:00:00 2001 From: rewine Date: Thu, 4 May 2023 11:20:04 +0800 Subject: [PATCH] fix: must set CMAKE_INSTALL_PREFIX before GNUInstallDirs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Log: Never modify the value of CMAKE_INSTALL_PREFIX after including GNUInstallDirs ,Otherwise incorrect CMAKE_INSTALL_FULL_XXXX values will be computed --- CMakeLists.txt | 9 ++++----- plugins/plugin-guide/home_monitor/CMakeLists.txt | 3 --- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 852065729..f35890d8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,10 @@ endif() # generate a compile commands file as complete database for vim-YouCompleteMe or some other similar tools set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +# Install settings +if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX /usr) +endif () include(GNUInstallDirs) if (NOT (${CMAKE_BUILD_TYPE} MATCHES "Debug")) @@ -130,11 +134,6 @@ add_subdirectory("frame") add_subdirectory("plugins") #add_subdirectory("tests") -# Install settings -if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX /usr) -endif () - ## qm files file(GLOB QM_FILES "translations/*.qm") install(FILES ${QM_FILES} diff --git a/plugins/plugin-guide/home_monitor/CMakeLists.txt b/plugins/plugin-guide/home_monitor/CMakeLists.txt index f5811e09d..065f61d94 100644 --- a/plugins/plugin-guide/home_monitor/CMakeLists.txt +++ b/plugins/plugin-guide/home_monitor/CMakeLists.txt @@ -94,8 +94,5 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE ${DdeDockInterface_LIBRARIES} ) -# 设置安装路径的前缀(默认为"/usr/local") -set(CMAKE_INSTALL_PREFIX "/usr") - # 设置执行 make install 时哪个目标应该被 install 到哪个位置 install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)