Commit 6bb4032e authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Simplify accounts dir cmake code

Instead of doing some complex pkgconfig machinery define it relative to CMAKE_INSTALL_DATADIR
parent 2eda5712
......@@ -89,5 +89,3 @@ install (FILES
${CMAKE_CURRENT_BINARY_DIR}/kaccounts_version.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KAccounts COMPONENT Devel
)
add_subdirectory(cmake)
......@@ -13,11 +13,8 @@ function(kaccounts_add_provider provider_in_file)
if(NOT intltool_output EQUAL 0)
message(FATAL_ERROR "error processing ${provider_in_file}: ${intltool_output} ${intltool_error}")
endif()
if (NOT ACCOUNTS_PROVIDERS_DIR)
message(FATAL_ERROR "ACCOUNTS_PROVIDERS_DIR not set, did you find_package (KAccounts REQUIRED) ?")
endif()
# The suffix must match whatever we set for $XDG_CURRENT_DESKTOP
install(FILES ${provider_file} DESTINATION ${ACCOUNTS_PROVIDERS_DIR}/kde/)
install(FILES ${provider_file} DESTINATION ${CMAKE_INSTALL_DATADIR}/accounts/providers/kde/)
endfunction()
function(kaccounts_add_service service_file_in)
......@@ -35,9 +32,6 @@ function(kaccounts_add_service service_file_in)
if(NOT intltool_output EQUAL 0)
message(FATAL_ERROR "error processing ${service_file_in}: ${intltool_output} ${intltool_error}")
endif()
if (NOT ACCOUNTS_SERVICES_DIR)
message(FATAL_ERROR "ACCOUNTS_SERVICES_DIR not set, did you find_package (KAccounts REQUIRED) ?")
endif()
# The suffix must match whatever we set for $XDG_CURRENT_DESKTOP
install(FILES ${service_file} DESTINATION ${ACCOUNTS_SERVICES_DIR}/kde/)
install(FILES ${service_file} DESTINATION ${CMAKE_INSTALL_DATADIR}/accounts/services/kde/)
endfunction()
install(FILES FindAccountsFileDir.cmake DESTINATION ${CMAKECONFIG_INSTALL_DIR})
find_package(PkgConfig REQUIRED)
execute_process(
COMMAND "${PKG_CONFIG_EXECUTABLE}" --variable=prefix libaccounts-glib
OUTPUT_VARIABLE _pkgconfig_invoke_result
RESULT_VARIABLE _pkgconfig_failed
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if (_pkgconfig_failed)
message(FATAL_ERROR "Couldn't find the prefix for libaccounts-glib")
else()
set(ACCOUNTS_PREFIX_DIR ${_pkgconfig_invoke_result})
endif()
execute_process(
COMMAND "${PKG_CONFIG_EXECUTABLE}" --variable=providerfilesdir libaccounts-glib
OUTPUT_VARIABLE _pkgconfig_invoke_result
RESULT_VARIABLE _pkgconfig_failed
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if (_pkgconfig_failed)
message(FATAL_ERROR "Couldn't find the providerfilesdir for libaccounts-glib")
else()
if (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
string(REPLACE ${ACCOUNTS_PREFIX_DIR} ${CMAKE_INSTALL_PREFIX} _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
endif()
set(ACCOUNTS_PROVIDERS_DIR ${_pkgconfig_invoke_result})
endif()
execute_process(
COMMAND "${PKG_CONFIG_EXECUTABLE}" --variable=servicefilesdir libaccounts-glib
OUTPUT_VARIABLE _pkgconfig_invoke_result
RESULT_VARIABLE _pkgconfig_failed
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if (_pkgconfig_failed)
message(FATAL_ERROR "Couldn't find the servicefilesdir for libaccounts-glib")
else()
if (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
string(REPLACE ${ACCOUNTS_PREFIX_DIR} ${CMAKE_INSTALL_PREFIX} _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
endif()
set(ACCOUNTS_SERVICES_DIR ${_pkgconfig_invoke_result})
endif()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment