Changeset View
Changeset View
Standalone View
Standalone View
kdesu/CMakeLists.txt
1 | option(KDESU_SYMLINK "Symlink kdesu from libexec to bindir as kdesu5" ON) | ||||
---|---|---|---|---|---|
2 | | ||||
1 | add_executable(kdesu_executable kdesu.cpp sudlg.cpp) | 3 | add_executable(kdesu_executable kdesu.cpp sudlg.cpp) | ||
2 | target_compile_definitions(kdesu_executable PRIVATE -DPROJECT_VERSION="${PROJECT_VERSION}") | 4 | target_compile_definitions(kdesu_executable PRIVATE -DPROJECT_VERSION="${PROJECT_VERSION}") | ||
3 | 5 | | |||
4 | # in KDELibsDependencies.cmake installed by kdelibs there is a dependency to "kdesu" | 6 | # in KDELibsDependencies.cmake installed by kdelibs there is a dependency to "kdesu" | ||
5 | # which is then recognized here as the target name for this executable | 7 | # which is then recognized here as the target name for this executable | ||
6 | # so give the target here a different name and use the OUTPUT_NAME property to | 8 | # so give the target here a different name and use the OUTPUT_NAME property to | ||
7 | # give it the name kdesu | 9 | # give it the name kdesu | ||
8 | set_target_properties(kdesu_executable PROPERTIES OUTPUT_NAME kdesu) | 10 | set_target_properties(kdesu_executable PROPERTIES OUTPUT_NAME kdesu) | ||
9 | 11 | | |||
10 | target_link_libraries(kdesu_executable KF5::WidgetsAddons KF5::I18n KF5::ConfigCore KF5::WindowSystem KF5::Su) | 12 | target_link_libraries(kdesu_executable KF5::WidgetsAddons KF5::I18n KF5::ConfigCore KF5::WindowSystem KF5::Su) | ||
11 | 13 | | |||
12 | install(TARGETS kdesu_executable DESTINATION ${KDE_INSTALL_LIBEXECDIR_KF5}) | 14 | install(TARGETS kdesu_executable DESTINATION ${KDE_INSTALL_LIBEXECDIR_KF5}) | ||
13 | 15 | | |||
14 | 16 | # Symlink bin/kdesu5 to libexec | |||
15 | 17 | if(KDESU_SYMLINK) | |||
16 | 18 | get_target_property(kdesu_output_name kdesu_executable OUTPUT_NAME) | |||
17 | 19 | file(RELATIVE_PATH libexec_from_bin /${KDE_INSTALL_BINDIR} /${KDE_INSTALL_LIBEXECDIR_KF5}/${kdesu_output_name}) | |||
20 | execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${libexec_from_bin} ${CMAKE_CURRENT_BINARY_DIR}/${kdesu_output_name}.symlink) | ||||
21 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${kdesu_output_name}.symlink | ||||
22 | DESTINATION ${KDE_INSTALL_BINDIR} | ||||
23 | RENAME kdesu5 | ||||
24 | endif() |