diff --git a/CMakeLists.txt b/CMakeLists.txt index e82bbecc4..a6bf9c456 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,6 +143,7 @@ if(UNIX) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") endif() +# keep these variables lest some Rime plugin's cmake file is still using them { if(NOT DEFINED LIB_INSTALL_DIR) set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) endif() @@ -150,6 +151,7 @@ endif() if(NOT DEFINED BIN_INSTALL_DIR) set(BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR}) endif() +# } # uninstall target configure_file( @@ -162,22 +164,24 @@ add_custom_target(uninstall if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|DragonFly|GNU") set(prefix "${CMAKE_INSTALL_PREFIX}") set(exec_prefix "${CMAKE_INSTALL_PREFIX}") - set(bindir "${exec_prefix}/${BIN_INSTALL_DIR}") - set(libdir "${exec_prefix}/${LIB_INSTALL_DIR}") - set(pkgdatadir "${prefix}${rime_data_dir}") - set(includedir "${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") + set(bindir "${CMAKE_INSTALL_FULL_BINDIR}") + set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}") + set(pkgdatadir "${CMAKE_INSTALL_PREFIX}${rime_data_dir}") + set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") configure_file( ${PROJECT_SOURCE_DIR}/rime.pc.in ${PROJECT_BINARY_DIR}/rime.pc @ONLY) install(FILES ${PROJECT_BINARY_DIR}/rime.pc - DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) + DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig) endif() -install(FILES cmake/RimeConfig.cmake DESTINATION share/cmake/rime) +install(FILES cmake/RimeConfig.cmake + DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/cmake/rime) file(GLOB rime_public_header_files ${PROJECT_SOURCE_DIR}/src/*.h) -install(FILES ${rime_public_header_files} DESTINATION include) +install(FILES ${rime_public_header_files} + DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}) if(BUILD_DATA) file(GLOB rime_preset_data_files ${PROJECT_SOURCE_DIR}/data/preset/*.yaml) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 17a6cc58a..f8a505b89 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -43,7 +43,7 @@ foreach(plugin ${plugins}) if(XCODE_VERSION) set_target_properties(${plugin_name} PROPERTIES INSTALL_NAME_DIR "@rpath") endif(XCODE_VERSION) - install(TARGETS ${plugin_name} DESTINATION ${LIB_INSTALL_DIR}) + install(TARGETS ${plugin_name} DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) endif() endforeach(plugin) diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt index 4632fb9cb..0376aa2bc 100644 --- a/sample/CMakeLists.txt +++ b/sample/CMakeLists.txt @@ -26,7 +26,7 @@ if(BUILD_SAMPLE) PROPERTIES INSTALL_NAME_DIR "@rpath") endif(XCODE_VERSION) - install(TARGETS ${sample_library} DESTINATION ${LIB_INSTALL_DIR}) + install(TARGETS ${sample_library} DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) add_subdirectory(tools) if(BUILD_TEST) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 45dd92179..c6acac8d4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -75,7 +75,7 @@ if(BUILD_SHARED_LIBS) if(XCODE_VERSION) set_target_properties(rime PROPERTIES INSTALL_NAME_DIR "@rpath") endif() - install(TARGETS rime DESTINATION ${LIB_INSTALL_DIR}) + install(TARGETS rime DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) if(BUILD_SEPARATE_LIBS) add_library(rime-dict ${rime_dict_module_src}) @@ -88,7 +88,7 @@ if(BUILD_SHARED_LIBS) if(XCODE_VERSION) set_target_properties(rime-dict PROPERTIES INSTALL_NAME_DIR "@rpath") endif() - install(TARGETS rime-dict DESTINATION ${LIB_INSTALL_DIR}) + install(TARGETS rime-dict DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) add_library(rime-gears ${rime_gears_src}) target_link_libraries(rime-gears @@ -101,7 +101,7 @@ if(BUILD_SHARED_LIBS) if(XCODE_VERSION) set_target_properties(rime-gears PROPERTIES INSTALL_NAME_DIR "@rpath") endif() - install(TARGETS rime-gears DESTINATION ${LIB_INSTALL_DIR}) + install(TARGETS rime-gears DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) add_library(rime-levers ${rime_levers_src}) target_link_libraries(rime-levers @@ -114,7 +114,7 @@ if(BUILD_SHARED_LIBS) if(XCODE_VERSION) set_target_properties(rime-levers PROPERTIES INSTALL_NAME_DIR "@rpath") endif() - install(TARGETS rime-levers DESTINATION ${LIB_INSTALL_DIR}) + install(TARGETS rime-levers DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) if(rime_plugins_library) add_library(rime-plugins @@ -131,12 +131,12 @@ if(BUILD_SHARED_LIBS) if(XCODE_VERSION) set_target_properties(rime-plugins PROPERTIES INSTALL_NAME_DIR "@rpath") endif() - install(TARGETS rime-plugins DESTINATION ${LIB_INSTALL_DIR}) + install(TARGETS rime-plugins DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) endif() endif() else() add_library(rime-static STATIC ${rime_src}) target_link_libraries(rime-static ${rime_deps}) set_target_properties(rime-static PROPERTIES OUTPUT_NAME "rime" PREFIX "lib") - install(TARGETS rime-static DESTINATION ${LIB_INSTALL_DIR}) + install(TARGETS rime-static DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) endif()